Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_snapshot.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 950b1a65ff..1d4af221e2 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -2256,14 +2256,18 @@ qemuSnapshotRevert(virDomainObj *vm,
ret = -1;
}
}
- if (ret == 0 && defined && vm->persistent &&
- !(ret = virDomainDefSave(vm->newDef ? vm->newDef : vm->def,
- driver->xmlopt, cfg->configDir))) {
- detail = VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT;
- virObjectEventStateQueue(driver->domainEventState,
- virDomainEventLifecycleNewFromObj(vm,
- VIR_DOMAIN_EVENT_DEFINED,
- detail));
+ if (ret == 0 && defined && vm->persistent) {
+ virDomainDef *saveDef = vm->newDef ? vm->newDef : vm->def;
+
+ ret = virDomainDefSave(saveDef, driver->xmlopt, cfg->configDir);
+
+ if (ret == 0) {
+ detail = VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT;
+ event = virDomainEventLifecycleNewFromObj(vm,
+ VIR_DOMAIN_EVENT_DEFINED,
+ detail);
+ virObjectEventStateQueue(driver->domainEventState, event);
+ }
}
return ret;
--
2.31.1