check task_state in the live_migrate_instance

If server migration fails, the while loop will not break
until retry to 0,
we can check the task_state to avoid this situation.

Closes-Bug: #1728476
Change-Id: I07e1048eb736263a261456ee78c96fee9db13cb5
This commit is contained in:
licanwei
2017-10-25 19:29:54 -07:00
parent deefc857ba
commit 165853ee2c
2 changed files with 24 additions and 0 deletions

View File

@@ -478,6 +478,9 @@ class NovaHelper(object):
'OS-EXT-SRV-ATTR:host') != dest_hostname \
and retry:
instance = self.nova.servers.get(instance.id)
if not getattr(instance, 'OS-EXT-STS:task_state'):
LOG.debug("Instance task state: %s is null" % instance_id)
break
LOG.debug(
'Waiting the migration of {0} to {1}'.format(
instance,