]> xenbits.xensource.com Git - libvirt.git/commit
snapshot: better events when starting paused
authorEric Blake <eblake@redhat.com>
Fri, 5 Aug 2011 22:05:50 +0000 (16:05 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 2 Sep 2011 16:00:06 +0000 (10:00 -0600)
commitc1ff5dc63dc9d9ec05485bb695cbc66850759ee5
tree16e54a8df625c4369501e26f479fd36cd4145406
parent4813b3f094261686394234c1c18ec3440ac40e84
snapshot: better events when starting paused

There are two classes of management apps that track events - one
that only cares about on/off (and only needs to track EVENT_STARTED
and EVENT_STOPPED), and one that cares about paused/running (also
tracks EVENT_SUSPENDED/EVENT_RESUMED).  To keep both classes happy,
any transition that can go from inactive to paused must emit two
back-to-back events - one for started and one for suspended (since
later resuming of the domain will only send RESUMED, but the first
class isn't tracking that).

This also fixes a bug where virDomainCreateWithFlags with the
VIR_DOMAIN_START_PAUSED flag failed to start paused when restoring
from a managed save image.

* include/libvirt/libvirt.h.in (VIR_DOMAIN_EVENT_SUSPENDED_RESTORED)
(VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT)
(VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT): New sub-events.
* src/qemu/qemu_driver.c (qemuDomainRevertToSnapshot): Use them.
(qemuDomainSaveImageStartVM): Likewise, and add parameter.
(qemudDomainCreate, qemuDomainObjStart): Send suspended event when
starting paused.
(qemuDomainObjRestore): Add parameter.
(qemuDomainObjStart, qemuDomainRestoreFlags): Update callers.
* examples/domain-events/events-c/event-test.c
(eventDetailToString): Map new detail strings.
examples/domain-events/events-c/event-test.c
include/libvirt/libvirt.h.in
src/qemu/qemu_driver.c