[libvirt] [PATCH RFC 19/22] storage: Traverse backing chains of network disks

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


Now we don't need to skip backing chain detection for remote disks.
---
 src/qemu/qemu_domain.c       |  8 +++-----
 src/storage/storage_driver.c | 18 ++++++------------
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 7ea9032..cd37ac4 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2414,12 +2414,10 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
     int ret = 0;
     uid_t uid;
     gid_t gid;
-    const char *src = virDomainDiskGetSource(disk);
-    int type = virDomainDiskGetType(disk);
+    int type = virStorageSourceGetActualType(&disk->src);

-    if (!src ||
-        type == VIR_STORAGE_TYPE_NETWORK ||
-        type == VIR_STORAGE_TYPE_VOLUME)
+    if (type != VIR_STORAGE_TYPE_NETWORK &&
+        !disk->src.path)
         goto cleanup;

     if (disk->src.backingStore) {
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index ac49553..1486b72 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -3162,19 +3162,13 @@ virStorageFileGetMetadata(virStorageSourcePtr src,
     if (!(cycle = virHashCreate(5, NULL)))
         return -1;

-    if (virStorageSourceGetActualType(src) != VIR_STORAGE_TYPE_NETWORK) {
-        if (!src->relPath &&
-            VIR_STRDUP(src->relPath, src->path) < 0)
-            goto cleanup;
+    if (!src->relPath &&
+        VIR_STRDUP(src->relPath, src->path) < 0)
+        goto cleanup;

-        if (!src->relDir &&
-            !(src->relDir = mdir_name(src->path))) {
-            virReportOOMError();
-            goto cleanup;
-        }
-    } else {
-        /* TODO: currently unimplemented for non-local storage */
-        ret = 0;
+    if (!src->relDir &&
+        !(src->relDir = mdir_name(src->path))) {
+        virReportOOMError();
         goto cleanup;
     }

-- 
1.9.2




More information about the libvir-list mailing list