[PATCH 5/5] utils: storage: Fall back to "raw" disk on backing store parse failure

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

 



When libvirt can't parse the backing store format for some reasons we
should fall back to something safe rather than marking the backing chain
as broken.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1134878
---
 src/util/virstoragefile.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index a17ced1..b471e37 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2287,6 +2287,9 @@ virStorageSourceNewFromBackingAbsolute(const char *path)
     if (VIR_ALLOC(ret) < 0)
         return NULL;

+    /* XXX We will need hypervisor-specific disk source parser callbacks here
+     * in the future */
+
     if (virStorageIsFile(path)) {
         ret->type = VIR_STORAGE_TYPE_FILE;

@@ -2298,15 +2301,22 @@ virStorageSourceNewFromBackingAbsolute(const char *path)
         /* handle URI formatted backing stores */
         if (strstr(path, "://")) {
             if (virStorageSourceParseBackingURI(ret, path) < 0)
-                goto error;
+                goto fallback;
         } else {
             if (virStorageSourceParseBackingColon(ret, path) < 0)
-                goto error;
+                goto fallback;
         }
     }

     return ret;

+ fallback:
+    ret->type = VIR_STORAGE_TYPE_RAW;
+    if (VIR_STRDUP(ret->path, path) < 0)
+        goto error;
+
+    return ret;
+
  error:
     virStorageSourceFree(ret);
     return NULL;
-- 
2.0.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]