Allow VIM to evacuate instances from powered off host

When an active AIO-DX controller is powered down, maintenance sends
the VIM a host state change to the offline state and then to the
power-off state. The VIM may not attempt to evacuate instances
from the controller right away, because it is waiting for nova to
indicate the hypervisor on the newly active controller is
available. If the VIM doesn't attempt the evacuates until after
the power-off state is reached, the evacuates will not be allowed,
because the VIM only allows evacuates if the host is in the offline
state. The fix is to allow the VIM to evacuate instances if the
host is in either the offline or power-off states.

Change-Id: I436c0fb3107219445694e2aee25e758c3c08080a
This commit is contained in:
Bart Wensley 2018-03-27 08:34:27 -05:00 committed by Al Bailey
parent 0b06f1dbd4
commit 2e04f15000
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