• E
    snapshot: better events when starting paused · c1ff5dc6
    Eric Blake 提交于
    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.
    c1ff5dc6
event-test.c 14.9 KB