Avoid vm instance shutdown when power state is NOSTATE

Occasionally when nova uses libvirt lib to query hypervisor
xen the instance state of vm_power_state may end up
with a NOSTATE value. Existing code shuts down the instance
when we hit this state. Remove the check for NOSTATE
to avoid shutting down the instance.

Fixes LP #1085771.

Change-Id: I0025f6800b6ca9cd3d7c7e6119b9a819571bd13c
This commit is contained in:
zhoudongshu
2012-12-04 18:04:29 +08:00
parent ca1a2566d3
commit 95e7770399
+3 -4
View File
@@ -3001,7 +3001,7 @@ class ComputeManager(manager.SchedulerDependentManager):
vm_instance = self.driver.get_info(db_instance)
vm_power_state = vm_instance['state']
except exception.InstanceNotFound:
vm_power_state = power_state.NOSTATE
vm_power_state = power_state.SHUTDOWN
# Note(maoy): the above get_info call might take a long time,
# for example, because of a broken libvirt driver.
# We re-query the DB to get the latest instance info to minimize
@@ -3052,9 +3052,8 @@ class ComputeManager(manager.SchedulerDependentManager):
pass
elif vm_state == vm_states.ACTIVE:
# The only rational power state should be RUNNING
if vm_power_state in (power_state.NOSTATE,
power_state.SHUTDOWN,
power_state.CRASHED):
if vm_power_state in (power_state.SHUTDOWN,
power_state.CRASHED):
LOG.warn(_("Instance shutdown by itself. Calling "
"the stop API."), instance=db_instance)
try: