Merge "Remove _instance_update usage in _build_instance"
This commit is contained in:
@@ -1340,10 +1340,9 @@ class ComputeManager(manager.Manager):
|
|||||||
instance, requested_networks, macs, security_groups,
|
instance, requested_networks, macs, security_groups,
|
||||||
dhcp_options)
|
dhcp_options)
|
||||||
|
|
||||||
self._instance_update(
|
instance.vm_state = vm_states.BUILDING
|
||||||
context, instance.uuid,
|
instance.task_state = task_states.BLOCK_DEVICE_MAPPING
|
||||||
vm_state=vm_states.BUILDING,
|
instance.save()
|
||||||
task_state=task_states.BLOCK_DEVICE_MAPPING)
|
|
||||||
|
|
||||||
# Verify that all the BDMs have a device_name set and assign a
|
# 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.
|
# default to the ones missing it with the help of the driver.
|
||||||
|
|||||||
@@ -107,7 +107,6 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
|
|||||||
|
|
||||||
self.mox.StubOutWithMock(self.compute, '_get_resource_tracker')
|
self.mox.StubOutWithMock(self.compute, '_get_resource_tracker')
|
||||||
self.mox.StubOutWithMock(self.compute, '_allocate_network')
|
self.mox.StubOutWithMock(self.compute, '_allocate_network')
|
||||||
self.mox.StubOutWithMock(self.compute, '_instance_update')
|
|
||||||
self.mox.StubOutWithMock(objects.BlockDeviceMappingList,
|
self.mox.StubOutWithMock(objects.BlockDeviceMappingList,
|
||||||
'get_by_instance_uuid')
|
'get_by_instance_uuid')
|
||||||
|
|
||||||
@@ -134,17 +133,17 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
|
|||||||
self.compute._allocate_network(mox.IgnoreArg(), instance,
|
self.compute._allocate_network(mox.IgnoreArg(), instance,
|
||||||
mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(),
|
mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(),
|
||||||
mox.IgnoreArg()).WithSideEffects(fake_allocate)
|
mox.IgnoreArg()).WithSideEffects(fake_allocate)
|
||||||
self.compute._instance_update(self.context, instance.uuid,
|
|
||||||
system_metadata={'network_allocated': 'True'})
|
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
self.compute._build_instance(self.context, {}, {},
|
instance, nw_info = self.compute._build_instance(self.context, {}, {},
|
||||||
None, None, None, True,
|
None, None, None, True,
|
||||||
node, instance,
|
node, instance,
|
||||||
{}, False)
|
{}, False)
|
||||||
self.assertFalse(self.admin_context,
|
self.assertFalse(self.admin_context,
|
||||||
"_allocate_network called with 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):
|
def test_allocate_network_fails(self):
|
||||||
self.flags(network_allocate_retries=0)
|
self.flags(network_allocate_retries=0)
|
||||||
|
|||||||
Reference in New Issue
Block a user