This makes it obvious that the function is called for creating new
snapshot and redefining old snapshot as well.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_snapshot.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 7198a2aad3..6860133bbb 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1761,15 +1761,18 @@ qemuSnapshotCreateXML(virDomainPtr domain,
driver->xmlopt,
flags) < 0)
goto endjob;
+
+ if (!snap) {
+ if (!(snap = virDomainSnapshotAssignDef(vm->snapshots, def)))
+ goto endjob;
+ }
} else {
if (qemuSnapshotAlignDisks(vm, def, driver, flags) < 0)
goto endjob;
if (qemuSnapshotPrepare(vm, def, &flags) < 0)
goto endjob;
- }
- if (!snap) {
if (!(snap = virDomainSnapshotAssignDef(vm->snapshots, def)))
goto endjob;
--
2.31.1