summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhoudongshu <zhoudshu@gmail.com>2012-12-04 18:04:29 +0800
committerzhoudongshu <zhoudshu@gmail.com>2012-12-06 09:37:36 +0800
commit95e7770399a74e99f3dcad777186ee4f58e4e206 (patch)
tree1f89bf90ff3ac50db352559b84b40263d209d9ba
parentca1a2566d33aad15de640bf60630330aceb0ef2c (diff)
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
-rw-r--r--nova/compute/manager.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index de3d3ddd4..11416f3b0 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -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: