[PATCH 1/2] qemu: snapshot: Don't update current snapshot until we're done

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

 



Since commit f105627992e we store whether a snapshot is current globally
rather than locally in the snapshot object.

This means that we don't have to unset the current snapshot prior to
taking/reverting the snapshot and we can do it only when everything is
done tsuccessfully.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8751145ea0..95fe844c34 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16001,13 +16001,6 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
         if (!redefine &&
             VIR_STRDUP(snap->def->parent_name, current->def->name) < 0)
                 goto endjob;
-        if (update_current) {
-            virDomainSnapshotSetCurrent(vm->snapshots, NULL);
-            if (qemuDomainSnapshotWriteMetadata(vm, current,
-                                                driver->caps, driver->xmlopt,
-                                                cfg->snapshotDir) < 0)
-                goto endjob;
-        }
     }

     /* actually do the snapshot */
@@ -16480,7 +16473,6 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
     virDomainObjPtr vm = NULL;
     int ret = -1;
     virDomainMomentObjPtr snap = NULL;
-    virDomainMomentObjPtr current = NULL;
     virDomainSnapshotDefPtr snapdef;
     virObjectEventPtr event = NULL;
     virObjectEventPtr event2 = NULL;
@@ -16580,17 +16572,6 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
         }
     }

-    current = virDomainSnapshotGetCurrent(vm->snapshots);
-    if (current) {
-        virDomainSnapshotSetCurrent(vm->snapshots, NULL);
-        if (qemuDomainSnapshotWriteMetadata(vm, current,
-                                            driver->caps, driver->xmlopt,
-                                            cfg->snapshotDir) < 0)
-            goto endjob;
-        /* XXX Should we restore the current snapshot after this point
-         * in the failure cases where we know there was no change?  */
-    }
-
     if (snap->def->dom) {
         config = virDomainDefCopy(snap->def->dom, caps,
                                   driver->xmlopt, priv->qemuCaps, true);
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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