Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix state sync logic related to the PAUSED VM state
A VM may get into the paused state not only because the user request
via API calls, but also due to (temporary) external instrumentations.
Before the virt layer can reliably report the reason, we simply ignore
the state discrepancy. In many cases, the VM state will go back to
running after the external instrumentation is done.

Fix bug 1097806.

Change-Id: I8edef45d60fa79d6ddebf7d0438042a7b3986b55
(cherry picked from commit f7fbdeb)
  • Loading branch information
maoy authored and David Scannell committed Jan 23, 2013
1 parent 03c3e9b commit 7ace55f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions nova/compute/manager.py
Expand Up @@ -2755,17 +2755,25 @@ def _sync_power_states(self, context):
LOG.exception(_("error during stop() in "
"sync_power_state."),
instance=db_instance)
elif vm_power_state in (power_state.PAUSED,
power_state.SUSPENDED):
LOG.warn(_("Instance is paused or suspended "
"unexpectedly. Calling "
elif vm_power_state == power_state.SUSPENDED:
LOG.warn(_("Instance is suspended unexpectedly. Calling "
"the stop API."), instance=db_instance)
try:
self.compute_api.stop(context, db_instance)
except Exception:
LOG.exception(_("error during stop() in "
"sync_power_state."),
instance=db_instance)
elif vm_power_state == power_state.PAUSED:
# Note(maoy): a VM may get into the paused state not only
# because the user request via API calls, but also
# due to (temporary) external instrumentations.
# Before the virt layer can reliably report the reason,
# we simply ignore the state discrepancy. In many cases,
# the VM state will go back to running after the external
# instrumentation is done. See bug 1097806 for details.
LOG.warn(_("Instance is paused unexpectedly. Ignore."),
instance=db_instance)
elif vm_state == vm_states.STOPPED:
if vm_power_state not in (power_state.NOSTATE,
power_state.SHUTDOWN,
Expand Down

0 comments on commit 7ace55f

Please sign in to comment.