Make conductor create InstanceAction in the proper cell
Conductor was not creating the InstanceAction in the appropriate cell (i.e. the same cell as the instance). This fixes that by just moving it into our existing cell-targeted context. Change-Id: I5c1713195585ac9cf34a8f9fc6b5a61afe996034
This commit is contained in:
@@ -918,11 +918,10 @@ class ComputeTaskManager(base.Base):
|
||||
notifications.send_update_with_states(context, instance, None,
|
||||
vm_states.BUILDING, None, None, service="conductor")
|
||||
|
||||
objects.InstanceAction.action_start(
|
||||
context, instance.uuid, instance_actions.CREATE,
|
||||
want_result=False)
|
||||
|
||||
with obj_target_cell(instance, cell):
|
||||
objects.InstanceAction.action_start(
|
||||
context, instance.uuid, instance_actions.CREATE,
|
||||
want_result=False)
|
||||
instance_bdms = self._create_block_device_mapping(
|
||||
instance.flavor, instance.uuid, block_device_mapping)
|
||||
|
||||
|
@@ -1459,6 +1459,19 @@ class ConductorTaskTestCase(_BaseTaskTestCase, test_compute.BaseTestCase):
|
||||
|
||||
self.assertEqual(1, ephemeral[0].volume_size)
|
||||
|
||||
cells = objects.CellMappingList.get_all(self.context)
|
||||
|
||||
# NOTE(danms): Assert that we created the InstanceAction in the
|
||||
# correct cell
|
||||
for cell in cells:
|
||||
with context.target_cell(self.context, cell):
|
||||
actions = objects.InstanceActionList.get_by_instance_uuid(
|
||||
self.context, instance_uuid)
|
||||
if cell.name == 'cell1':
|
||||
self.assertEqual(1, len(actions))
|
||||
else:
|
||||
self.assertEqual(0, len(actions))
|
||||
|
||||
@mock.patch('nova.compute.rpcapi.ComputeAPI.build_and_run_instance')
|
||||
@mock.patch('nova.scheduler.rpcapi.SchedulerAPI.select_destinations')
|
||||
@mock.patch('nova.objects.HostMapping.get_by_host')
|
||||
|
Reference in New Issue
Block a user