Skip to content

Commit

Permalink
Avoid vm instance shutdown when power state is NOSTATE
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zhoudshu committed Dec 6, 2012
1 parent ca1a256 commit 95e7770
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions nova/compute/manager.py
Expand Up @@ -3001,7 +3001,7 @@ def _sync_power_states(self, context):
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
Expand Down Expand Up @@ -3052,9 +3052,8 @@ def _sync_power_states(self, context):
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:
Expand Down

0 comments on commit 95e7770

Please sign in to comment.