Updated openstack/openstack
Project: openstack/nova  ea47bd56c77e354b2ecf21e146c2f160512593e9

Delay STOPPED lifecycle event for Xen domains

When using libvirt, a reboot from inside of a kvm VM doesn't trigger
any libvirt lifecycle event. That's fine. But rebooting a Xen VM leads
to the events VIR_DOMAIN_EVENT_STOPPED and VIR_DOMAIN_EVENT_STARTED.
Nova compute manager catches these events and tries to sync the power
state of the VM with the power state in the database. In the case the VM
state is ACTIVE but the power state is something that doesn't fit, the
stop API call is executed to trigger all stop hooks. This leads to the
problem that a reboot of a Xen VM without using the API isn't possible.
To fix it, delay the emission of the STOPPED lifecycle event a couple of
seconds. If a VIR_DOMAIN_EVENT_STARTED event is received while the STOPPED
event is pending, cancel the pending STOPPED lifecycle event so the VM
can continue to run.

Closes-Bug: #1293480
Change-Id: I690d3d700ab4d057554350da143ff77d78b509c6