When reverting a running domain to a paused snapshot, the event
that fires should mention that the domain is suspended.
* include/libvirt/libvirt.h.in
(VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT): New sub-event.
* src/qemu/qemu_driver.c (qemuDomainRevertToSnapshot): Use it.
---
include/libvirt/libvirt.h.in | 3 ++-
src/qemu/qemu_driver.c | 10 ++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index aa29fb6..a625479 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -2010,7 +2010,7 @@ typedef enum {
VIR_DOMAIN_EVENT_STARTED_BOOTED = 0, /* Normal startup from boot */
VIR_DOMAIN_EVENT_STARTED_MIGRATED = 1, /* Incoming migration from another host */
VIR_DOMAIN_EVENT_STARTED_RESTORED = 2, /* Restored from a state file */
- VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT = 3, /* Restored from snapshot */
+ VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT = 3, /* Restored from running snapshot */
} virDomainEventStartedDetailType;
/**
@@ -2023,6 +2023,7 @@ typedef enum {
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED = 1, /* Suspended for offline migration */
VIR_DOMAIN_EVENT_SUSPENDED_IOERROR = 2, /* Suspended due to a disk I/O error */
VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG = 3, /* Suspended due to a watchdog firing */
+ VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT = 4, /* Restored from paused snapshot */
} virDomainEventSuspendedDetailType;
/**
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 57ad3d1..12f8179 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8808,14 +8808,16 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr
snapshot,
QEMU_ASYNC_JOB_NONE);
if (rc < 0)
goto endjob;
+ event = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_SUSPENDED,
+ VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT);
} else {
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
VIR_DOMAIN_RUNNING_FROM_SNAPSHOT);
+ event = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_STARTED,
+ VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT);
}
-
- event = virDomainEventNewFromObj(vm,
- VIR_DOMAIN_EVENT_STARTED,
- VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT);
} else {
/* qemu is a little funny with running guests and the restoration
* of snapshots. If the snapshot was taken online,
--
1.7.4.4