* Updated readme file with installation of suds-0.4 through easy_install.
* Removed pass functions * Fixed pep8 errors * Few bug fixes and other commits Also rebased this branch to nova revision 761
This commit is contained in:
@@ -23,12 +23,20 @@ import time
|
||||
|
||||
from nova import db
|
||||
from nova import utils
|
||||
from nova.compute import instance_types
|
||||
|
||||
|
||||
def stub_out_db_instance_api(stubs):
|
||||
""" Stubs out the db API for creating Instances """
|
||||
|
||||
INSTANCE_TYPES = {
|
||||
'm1.tiny': dict(memory_mb=512, vcpus=1, local_gb=0, flavorid=1),
|
||||
'm1.small': dict(memory_mb=2048, vcpus=1, local_gb=20, flavorid=2),
|
||||
'm1.medium':
|
||||
dict(memory_mb=4096, vcpus=2, local_gb=40, flavorid=3),
|
||||
'm1.large': dict(memory_mb=8192, vcpus=4, local_gb=80, flavorid=4),
|
||||
'm1.xlarge':
|
||||
dict(memory_mb=16384, vcpus=8, local_gb=160, flavorid=5)}
|
||||
|
||||
class FakeModel(object):
|
||||
""" Stubs out for model """
|
||||
|
||||
@@ -47,7 +55,7 @@ def stub_out_db_instance_api(stubs):
|
||||
def fake_instance_create(values):
|
||||
""" Stubs out the db.instance_create method """
|
||||
|
||||
type_data = instance_types.INSTANCE_TYPES[values['instance_type']]
|
||||
type_data = INSTANCE_TYPES[values['instance_type']]
|
||||
|
||||
base_options = {
|
||||
'name': values['name'],
|
||||
@@ -86,8 +94,16 @@ def stub_out_db_instance_api(stubs):
|
||||
""" Stubs out the db.instance_get_fixed_address method """
|
||||
return '10.10.10.10'
|
||||
|
||||
def fake_instance_type_get_all(context, inactive=0):
|
||||
return INSTANCE_TYPES
|
||||
|
||||
def fake_instance_type_get_by_name(context, name):
|
||||
return INSTANCE_TYPES[name]
|
||||
|
||||
stubs.Set(db, 'instance_create', fake_instance_create)
|
||||
stubs.Set(db, 'network_get_by_instance', fake_network_get_by_instance)
|
||||
stubs.Set(db, 'instance_action_create', fake_instance_action_create)
|
||||
stubs.Set(db, 'instance_get_fixed_address',
|
||||
fake_instance_get_fixed_address)
|
||||
stubs.Set(db, 'instance_type_get_all', fake_instance_type_get_all)
|
||||
stubs.Set(db, 'instance_type_get_by_name', fake_instance_type_get_by_name)
|
||||
|
||||
Reference in New Issue
Block a user