[PATCH 10/10] qemu: Defer support checks for external active snapshots to blockdev code or qemu

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

 



Remove libvit's support check for the target of an external snapshot to
the blockdev code or qemu. This will potentially require a more complex
cleanup but removes a level of hardcoded feature checks.

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

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c22f74adaa..d9315e0df4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14931,7 +14931,8 @@ qemuDomainSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDefPtr snapdi

 static int
 qemuDomainSnapshotPrepareDiskExternalActive(virDomainSnapshotDiskDefPtr snapdisk,
-                                            virDomainDiskDefPtr domdisk)
+                                            virDomainDiskDefPtr domdisk,
+                                            bool blockdev)
 {
     int actualType = virStorageSourceGetActualType(snapdisk->src);

@@ -14948,6 +14949,10 @@ qemuDomainSnapshotPrepareDiskExternalActive(virDomainSnapshotDiskDefPtr snapdisk
         break;

     case VIR_STORAGE_TYPE_NETWORK:
+        /* defer all of the checking to either qemu or libvirt's blockdev code */
+        if (blockdev)
+            break;
+
         switch ((virStorageNetProtocol) snapdisk->src->protocol) {
         case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
             break;
@@ -14995,7 +15000,8 @@ static int
 qemuDomainSnapshotPrepareDiskExternal(virDomainDiskDefPtr disk,
                                       virDomainSnapshotDiskDefPtr snapdisk,
                                       bool active,
-                                      bool reuse)
+                                      bool reuse,
+                                      bool blockdev)
 {
     struct stat st;
     int err;
@@ -15018,7 +15024,7 @@ qemuDomainSnapshotPrepareDiskExternal(virDomainDiskDefPtr disk,
         if (qemuDomainSnapshotPrepareDiskExternalInactive(snapdisk, disk) < 0)
             return -1;
     } else {
-        if (qemuDomainSnapshotPrepareDiskExternalActive(snapdisk, disk) < 0)
+        if (qemuDomainSnapshotPrepareDiskExternalActive(snapdisk, disk, blockdev) < 0)
             return -1;
     }

@@ -15119,6 +15125,8 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
                           virDomainSnapshotDefPtr def,
                           unsigned int *flags)
 {
+    qemuDomainObjPrivatePtr priv = vm->privateData;
+    bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
     int ret = -1;
     size_t i;
     bool active = virDomainObjIsActive(vm);
@@ -15177,7 +15185,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
             }

             if (qemuDomainSnapshotPrepareDiskExternal(dom_disk, disk,
-                                                      active, reuse) < 0)
+                                                      active, reuse, blockdev) < 0)
                 goto cleanup;

             external++;
-- 
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