When domain is reverted to a snapshot it's configuration and state
may be changed. If the domain state was changed libvirt emits one
or more <NEW STATE>_FROM_SNAPSHOT events.
In case when domain and target states both are offline there will be
no state changes and no events. Lack of the event become a problem
for virt-manager
https://bugzilla.redhat.com/show_bug.cgi?id=1081148
This commit adds DEFINED event emission in this signle case and only
if snapshot have the domain configuration.
---
src/qemu/qemu_driver.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a762521..1fb41e3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15179,7 +15179,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
VIR_DOMAIN_SNAPSHOT_REVERT_FORCE, -1);
/* We have the following transitions, which create the following events:
- * 1. inactive -> inactive: none
+ * 1. inactive -> inactive: EVENT_DEFINED if snapshot has config
* 2. inactive -> running: EVENT_STARTED
* 3. inactive -> paused: EVENT_STARTED, EVENT_PAUSED
* 4. running -> inactive: EVENT_STOPPED
@@ -15465,6 +15465,12 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
VIR_DOMAIN_EVENT_SUSPENDED,
detail);
}
+ } else if (config && !event) {
+ /* Transition 1 */
+ detail = VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT;
+ event = virDomainEventLifecycleNewFromObj(vm,
+ VIR_DOMAIN_EVENT_DEFINED,
+ detail);
}
break;
--
1.8.3.1