diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index 2e8b707e5fa9..1e8998d17fdc 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -488,10 +488,10 @@ class ComputeTaskManager(base.Base): # check retry policy. Rather ugly use of instances[0]... # but if we've exceeded max retries... then we really only # have a single instance. + request_spec = scheduler_utils.build_request_spec( + context, image, instances) scheduler_utils.populate_retry( filter_properties, instances[0].uuid) - request_spec = scheduler_utils.build_request_spec( - context, image, instances) hosts = self._schedule_instances( context, request_spec, filter_properties) except Exception as exc: diff --git a/nova/tests/unit/conductor/test_conductor.py b/nova/tests/unit/conductor/test_conductor.py index 398db5942571..9d0ac5875056 100644 --- a/nova/tests/unit/conductor/test_conductor.py +++ b/nova/tests/unit/conductor/test_conductor.py @@ -573,8 +573,9 @@ class _BaseTaskTestCase(object): @mock.patch.object(conductor_manager.ComputeTaskManager, '_cleanup_allocated_networks') @mock.patch.object(scheduler_utils, 'set_vm_state_and_notify') + @mock.patch.object(scheduler_utils, 'build_request_spec') @mock.patch.object(scheduler_utils, 'populate_retry') - def _test(populate_retry, + def _test(populate_retry, build_spec, set_vm_state_and_notify, cleanup_mock): # build_instances() is a cast, we need to wait for it to # complete @@ -599,7 +600,7 @@ class _BaseTaskTestCase(object): filter_properties, instances[0].uuid) set_vm_state_and_notify.assert_called_once_with( self.context, instances[0].uuid, 'compute_task', - 'build_instances', updates, mock.ANY, {}) + 'build_instances', updates, mock.ANY, build_spec.return_value) cleanup_mock.assert_called_once_with(self.context, mock.ANY, None) _test()