merged orm

This commit is contained in:
Vishvananda Ishaya
2010-09-09 22:01:32 -07:00
6 changed files with 11 additions and 11 deletions

View File

@@ -583,8 +583,8 @@ class CloudController(object):
base_options['vcpus'] = type_data['vcpus']
base_options['local_gb'] = type_data['local_gb']
for num in range():
inst_id = db.instance_create(context, base_options)
for num in range(num_instances):
inst_id = db.instance_create(context, base_options)['id']
inst = {}
inst['mac_address'] = utils.generate_mac()

View File

@@ -63,7 +63,7 @@ class ComputeTestCase(test.TrialTestCase):
inst['instance_type'] = 'm1.tiny'
inst['mac_address'] = utils.generate_mac()
inst['ami_launch_index'] = 0
return db.instance_create(self.context, inst)
return db.instance_create(self.context, inst)['id']
@defer.inlineCallbacks
def test_run_terminate(self):

View File

@@ -56,12 +56,12 @@ class NetworkTestCase(test.TrialTestCase):
name))
# create the necessary network data for the project
self.network.set_network_host(self.context, self.projects[i].id)
instance_id = db.instance_create(None,
instance_ref = db.instance_create(None,
{'mac_address': utils.generate_mac()})
self.instance_id = instance_id
instance_id = db.instance_create(None,
self.instance_id = instance_ref['id']
instance_ref = db.instance_create(None,
{'mac_address': utils.generate_mac()})
self.instance2_id = instance_id
self.instance2_id = instance_ref['id']
def tearDown(self): # pylint: disable-msg=C0103
super(NetworkTestCase, self).tearDown()

View File

@@ -65,7 +65,7 @@ class QuotaTestCase(test.TrialTestCase):
inst['instance_type'] = 'm1.large'
inst['vcpus'] = cores
inst['mac_address'] = utils.generate_mac()
return db.instance_create(self.context, inst)
return db.instance_create(self.context, inst)['id']
def _create_volume(self, size=10):
"""Create a test volume"""

View File

@@ -87,7 +87,7 @@ class ServiceTestCase(test.BaseTestCase):
host,
binary).AndRaise(exception.NotFound())
service.db.service_create(None,
service_create).AndReturn(service_ref['id'])
service_create).AndReturn(service_ref)
self.mox.ReplayAll()
app = service.Service.create(host=host, binary=binary)
@@ -131,7 +131,7 @@ class ServiceTestCase(test.BaseTestCase):
host,
binary).AndRaise(exception.NotFound())
service.db.service_create(None,
service_create).AndReturn(service_ref['id'])
service_create).AndReturn(service_ref)
service.db.service_get(None, service_ref['id']).AndReturn(service_ref)
service.db.service_update(None, service_ref['id'],
mox.ContainsKeyValue('report_count', 1))

View File

@@ -108,7 +108,7 @@ class VolumeTestCase(test.TrialTestCase):
inst['instance_type'] = 'm1.tiny'
inst['mac_address'] = utils.generate_mac()
inst['ami_launch_index'] = 0
instance_id = db.instance_create(self.context, inst)
instance_id = db.instance_create(self.context, inst)['id']
mountpoint = "/dev/sdf"
volume_id = self._create_volume()
yield self.volume.create_volume(self.context, volume_id)