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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to