diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index 87d98f2cadde..318cb0ec81dc 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -712,8 +712,11 @@ class ComputeTaskManager(base.Base): # RequestSpec object - probably because the instance is old # We need to mock that the old way filter_properties = {'ignore_hosts': [instance.host]} + # build_request_spec expects a primitive image dict + image_meta = nova_object.obj_to_primitive( + instance.image_meta) request_spec = scheduler_utils.build_request_spec( - context, image_ref, [instance]) + context, image_meta, [instance]) elif recreate: # NOTE(sbauza): Augment the RequestSpec object by excluding # the source host for avoiding the scheduler to pick it diff --git a/nova/tests/unit/conductor/test_conductor.py b/nova/tests/unit/conductor/test_conductor.py index a90a1ae75090..66105ba0192e 100644 --- a/nova/tests/unit/conductor/test_conductor.py +++ b/nova/tests/unit/conductor/test_conductor.py @@ -1239,6 +1239,9 @@ class _BaseTaskTestCase(object): self.conductor_manager.rebuild_instance(context=self.context, instance=inst_obj, **rebuild_args) + bs_mock.assert_called_once_with( + self.context, obj_base.obj_to_primitive(inst_obj.image_meta), + [inst_obj]) fp_mock.assert_called_once_with(self.context, request_spec, filter_properties) select_dest_mock.assert_called_once_with(self.context, fake_spec)