diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index 4956b3d46700..d7a2eb9a042f 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -411,8 +411,10 @@ class ComputeTaskManager(base.Base): ' %(dest)s unexpectedly failed.'), {'instance_id': instance.uuid, 'dest': destination}, exc_info=True) + # Reset the task state to None to indicate completion of + # the operation as it is done in case of known exceptions. _set_vm_state(context, instance, ex, vm_states.ERROR, - instance.task_state) + task_state=None) migration.status = 'error' migration.save() raise exception.MigrationError(reason=six.text_type(ex)) diff --git a/nova/tests/unit/conductor/test_conductor.py b/nova/tests/unit/conductor/test_conductor.py index ff046f527eb5..a436d283c1bb 100644 --- a/nova/tests/unit/conductor/test_conductor.py +++ b/nova/tests/unit/conductor/test_conductor.py @@ -1858,7 +1858,7 @@ class ConductorTaskTestCase(_BaseTaskTestCase, test_compute.BaseTestCase): instance['uuid'], 'compute_task', 'migrate_server', dict(vm_state=vm_states.ERROR, - task_state=inst_obj.task_state, + task_state=None, expected_task_state=task_states.MIGRATING,), expected_ex, request_spec) self.assertEqual(ex.kwargs['reason'], six.text_type(expected_ex))