yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #02248
[Bug 1089772] Re: nova compute need update instance to "Error" state.
** Changed in: nova
Status: Incomplete => Invalid
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1089772
Title:
nova compute need update instance to "Error" state.
Status in OpenStack Compute (Nova):
Invalid
Bug description:
1. nova compute need update instance to "Error" state.
When the VM is deleted on hypervisor directly, but nova compute just try to update it to "power_state=0, vm_state=stopped and status=SHUTOFF".
2. The steps to recreate the issue.
a. launch instance on openstack
b. delete the VM on hypervisor directly
c. but OpenStack nova compute(the function _sync_power_states(self, context) in nova/compute/manager.py) just try to update instance to power_state=0, vm_state=stopped and status=SHUTOFF
3. The proposal to this issue:
add self._set_instance_error_state() into _sync_power_states(self, context) of nova/compute/manager.py to update instance to Error state.
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):
LOG.warn(_("Instance shutdown by itself. Calling "
"the stop API."), instance=db_instance)
try:
# Note(maoy): here we call the API instead of
# brutally updating the vm_state in the database
# to allow all the hooks and checks to be performed.
self.compute_api.stop(context, db_instance)
except Exception:
# Note(maoy): there is no need to propagate the error
# because the same power_state will be retrieved next
# time and retried.
# For example, there might be another task scheduled.
LOG.exception(_("error during stop() in "
"sync_power_state."),
instance=db_instance)
self._set_instance_error_state(context, db_instance['uuid'])
elif vm_power_state in (power_state.PAUSED,
power_state.SUSPENDED):
LOG.warn(_("Instance is paused or 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)
self._set_instance_error_state(context, db_instance['uuid'])
elif vm_state == vm_states.STOPPED:
if vm_power_state not in (power_state.NOSTATE,
power_state.SHUTDOWN,
power_state.CRASHED):
LOG.warn(_("Instance is not stopped. Calling "
"the stop API."), instance=db_instance)
try:
# Note(maoy): this assumes that the stop API is
# idempotent.
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.NOSTATE:
LOG.warn(_("Instance is NOSTATE"), instance=db_instance)
self._set_instance_error_state(context, db_instance['uuid'])
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1089772/+subscriptions