[libvirt PATCH 05/11] qemu_snapshot: create: virDomainSnapshotGetCurrent is not used with redefine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move it to code path for creating new snapshot.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/qemu/qemu_snapshot.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 6860133bbb..9a3f90e346 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1703,7 +1703,6 @@ qemuSnapshotCreateXML(virDomainPtr domain,
     virQEMUDriver *driver = domain->conn->privateData;
     virDomainMomentObj *snap = NULL;
     virDomainSnapshotPtr snapshot = NULL;
-    virDomainMomentObj *current = NULL;
     bool update_current = true;
     bool redefine = flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE;
     g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
@@ -1767,6 +1766,8 @@ qemuSnapshotCreateXML(virDomainPtr domain,
                 goto endjob;
         }
     } else {
+        virDomainMomentObj *current = NULL;
+
         if (qemuSnapshotAlignDisks(vm, def, driver, flags) < 0)
             goto endjob;
 
@@ -1777,12 +1778,11 @@ qemuSnapshotCreateXML(virDomainPtr domain,
             goto endjob;
 
         def = NULL;
-    }
 
-    current = virDomainSnapshotGetCurrent(vm->snapshots);
-    if (current) {
-        if (!redefine)
+        current = virDomainSnapshotGetCurrent(vm->snapshots);
+        if (current) {
             snap->def->parent_name = g_strdup(current->def->name);
+        }
     }
 
     /* actually do the snapshot */
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux