From 95e7770399a74e99f3dcad777186ee4f58e4e206 Mon Sep 17 00:00:00 2001 From: zhoudongshu Date: Tue, 4 Dec 2012 18:04:29 +0800 Subject: 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 --- nova/compute/manager.py | 7 +++---- 1 file 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: -- cgit