diff options
author | Zuul <zuul@review.openstack.org> | 2018-04-20 05:21:28 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2018-04-20 05:21:28 +0000 |
commit | b4ff5a8d8c403fff71b4173a03258e55a88a8d55 (patch) | |
tree | 07e2619190c8047bb29afb2a2c9737c1b09fe8cf | |
parent | c135d81fc110045340be1bc5b6346341eec3e0a7 (diff) | |
parent | ea53d9f1ea8bab797250f7add535fe16236f9a34 (diff) | |
download | nova-b4ff5a8d8c403fff71b4173a03258e55a88a8d55.tar.gz |
Merge "Pass the correct image to build_request_spec in conductor.rebuild_instance" into stable/ocata
-rw-r--r-- | nova/conductor/manager.py | 5 | ||||
-rw-r--r-- | nova/tests/unit/conductor/test_conductor.py | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index 87d98f2cad..318cb0ec81 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 a90a1ae750..66105ba019 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) |