[PATCH 2/8] qemu: snapshot: Remove monitor code now that 'transaction' is always used

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

 



Since we now always do the snapshot via the 'transaction' command we can
drop the code which would enter monitor for individual disk snapshots.

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

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4f577e50d2..39b745b1db 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14925,14 +14925,12 @@ qemuDomainSnapshotUpdateDiskSources(qemuDomainSnapshotDiskDataPtr dd,
 }


-/* The domain is expected to hold monitor lock.  */
 static int
 qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
                                          virDomainObjPtr vm,
                                          qemuDomainSnapshotDiskDataPtr dd,
                                          virJSONValuePtr actions,
-                                         bool reuse,
-                                         qemuDomainAsyncJob asyncJob)
+                                         bool reuse)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
     char *device = NULL;
@@ -14964,23 +14962,10 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,

     dd->prepared = true;

-    /* create the actual snapshot */
     formatStr = virStorageFileFormatTypeToString(dd->src->format);

-    /* The monitor is only accessed if qemu doesn't support transactions.
-     * Otherwise the following monitor command only constructs the command.
-     */
-    if (!actions &&
-        qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
-        goto cleanup;
-
     ret = rc = qemuMonitorDiskSnapshot(priv->mon, actions, device, source,
                                        formatStr, reuse);
-    if (!actions) {
-        if (qemuDomainObjExitMonitor(driver, vm) < 0)
-            ret = -1;
-    }
-
     virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", rc >= 0);

  cleanup:
@@ -15032,11 +15017,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,

         ret = qemuDomainSnapshotCreateSingleDiskActive(driver, vm,
                                                        &diskdata[i],
-                                                       actions, reuse, asyncJob);
-
-        /* without transaction support the change can't be rolled back */
-        if (!actions)
-            qemuDomainSnapshotUpdateDiskSources(&diskdata[i], &persist);
+                                                       actions, reuse);

         if (ret < 0)
             goto error;
@@ -15044,7 +15025,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
         do_transaction = true;
     }

-    if (actions && do_transaction) {
+    if (do_transaction) {
         if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
             goto cleanup;

-- 
2.16.2

--
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