[libvirt] [PATCH RFC 20/22] qemu: Add support for networked disks for block pull/block rebase

Peter Krempa pkrempa at redhat.com
Tue May 6 13:37:09 UTC 2014


Now that we are able to select images from the backing chain via indexed
access we should also convert possible network sources to
qemu-compatible strings before passing them to qemu.
---
 src/qemu/qemu_driver.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b0a79e4..e9cf5d5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14901,6 +14901,7 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
     virDomainDiskDefPtr disk;
     virStorageSourcePtr baseSource = NULL;
     unsigned int baseIndex = 0;
+    char *basePath = NULL;

     if (!virDomainObjIsActive(vm)) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
@@ -14969,9 +14970,16 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
                                                   base, baseIndex, NULL))))
         goto endjob;

+    if (baseIndex) {
+        if (qemuGetDriveSourceString(baseSource, NULL, &basePath) < 0)
+            goto endjob;
+    } else {
+        if (VIR_STRDUP(basePath, base) < 0)
+            goto endjob;
+    }
+
     qemuDomainObjEnterMonitor(driver, vm);
-    ret = qemuMonitorBlockJob(priv->mon, device,
-                              baseIndex ? baseSource->path : base,
+    ret = qemuMonitorBlockJob(priv->mon, device, basePath,
                               bandwidth, info, mode, async);
     qemuDomainObjExitMonitor(driver, vm);
     if (ret < 0)
@@ -15042,6 +15050,7 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
     }

  cleanup:
+    VIR_FREE(basePath);
     VIR_FREE(device);
     if (vm)
         virObjectUnlock(vm);
-- 
1.9.2




More information about the libvir-list mailing list