Merge "Allow VIM to evacuate instances from powered off host"

This commit is contained in:
Zuul 2018-06-18 13:21:31 +00:00 committed by Gerrit Code Review
commit da93ce42c7
3 changed files with 16 additions and 5 deletions

View File

@ -1 +1 @@
TIS_PATCH_VER=69
TIS_PATCH_VER=70

View File

@ -688,12 +688,13 @@ class EvacuateTaskWork(state_machine.StateTaskWork):
host_table = tables.tables_get_host_table()
host = host_table.get(self._instance.host_name, None)
if host is not None:
if not host.is_offline():
# We must wait for the compute host to go offline before
# attempting to evacuate the instance. It is not safe to
if not (host.is_offline() or host.is_power_off()):
# We must wait for the compute host to go offline or power off
# before attempting to evacuate the instance. It is not safe to
# evacuate an instance that may still be running.
DLOG.debug("Evacuate-Instance for %s, but host %s is not "
"offline." % (self._instance.name, host.name))
"offline or power-off." %
(self._instance.name, host.name))
return state_machine.STATE_TASK_WORK_RESULT.WAIT, empty_reason
self._do_evacuate()

View File

@ -379,6 +379,16 @@ class Host(ObjectData):
return False
def is_power_off(self):
"""
Returns true if the host is powered off
"""
if nfvi.objects.v1.HOST_AVAIL_STATUS.POWER_OFF \
== self._nfvi_host.avail_status:
return True
return False
def is_failed(self):
"""
Returns true if the host is failed or not