Merge "Remove _instance_update usage in _build_instance"

This commit is contained in:
Jenkins
2014-08-22 07:53:54 +00:00
committed by Gerrit Code Review
2 changed files with 6 additions and 8 deletions

View File

@@ -1340,10 +1340,9 @@ class ComputeManager(manager.Manager):
instance, requested_networks, macs, security_groups,
dhcp_options)
self._instance_update(
context, instance.uuid,
vm_state=vm_states.BUILDING,
task_state=task_states.BLOCK_DEVICE_MAPPING)
instance.vm_state = vm_states.BUILDING
instance.task_state = task_states.BLOCK_DEVICE_MAPPING
instance.save()
# Verify that all the BDMs have a device_name set and assign a
# default to the ones missing it with the help of the driver.

View File

@@ -107,7 +107,6 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
self.mox.StubOutWithMock(self.compute, '_get_resource_tracker')
self.mox.StubOutWithMock(self.compute, '_allocate_network')
self.mox.StubOutWithMock(self.compute, '_instance_update')
self.mox.StubOutWithMock(objects.BlockDeviceMappingList,
'get_by_instance_uuid')
@@ -134,17 +133,17 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
self.compute._allocate_network(mox.IgnoreArg(), instance,
mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(),
mox.IgnoreArg()).WithSideEffects(fake_allocate)
self.compute._instance_update(self.context, instance.uuid,
system_metadata={'network_allocated': 'True'})
self.mox.ReplayAll()
self.compute._build_instance(self.context, {}, {},
instance, nw_info = self.compute._build_instance(self.context, {}, {},
None, None, None, True,
node, instance,
{}, False)
self.assertFalse(self.admin_context,
"_allocate_network called with admin context")
self.assertEqual(vm_states.BUILDING, instance.vm_state)
self.assertEqual(task_states.BLOCK_DEVICE_MAPPING, instance.task_state)
def test_allocate_network_fails(self):
self.flags(network_allocate_retries=0)