Instance remains in migrating state forever

An unexpected failure during live migration leaves the instance
to migrating state forever.
The issue is that in case of unexpected failure the task state is
set to be same as the instance task state. It should be set to
'None' instead.

Change-Id: I254977fbebf87ac712322f321792a5dfe3f0df0e
Closes-Bug: 1694406
This commit is contained in:
manas.mandlekar 2017-07-14 06:56:07 -04:00
parent 83e234a6e9
commit 2d3486d0ee
2 changed files with 4 additions and 2 deletions

View File

@ -443,8 +443,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))

View File

@ -1872,7 +1872,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))