Merge "Pass the correct image to build_request_spec in conductor.rebuild_instance" into stable/ocata

This commit is contained in:
Zuul 2018-04-20 05:21:28 +00:00 committed by Gerrit Code Review
commit b4ff5a8d8c
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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)