]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: recognize gluster as networked file
authorEric Blake <eblake@redhat.com>
Mon, 4 Nov 2013 21:27:42 +0000 (14:27 -0700)
committerEric Blake <eblake@redhat.com>
Tue, 5 Nov 2013 15:36:43 +0000 (08:36 -0700)
A qcow2 file with a backing file of 'gluster://host/vol/file' should
not try to look for a directory named './gluster:/' in the file system.

* src/util/virstoragefile.c (virBackingStoreIsFile): Broaden check
to include all protocols.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/util/virstoragefile.c

index 1b4d4cf85e2ce69f27c3798765db4136c2d16c8b..8f04b7839295a69d60091ca4b96cf890050b359a 100644 (file)
@@ -671,8 +671,13 @@ virStorageFileMatchesVersion(int format,
 static bool
 virBackingStoreIsFile(const char *backing)
 {
-    /* Backing store is a network block device or Rados block device */
-    if (STRPREFIX(backing, "nbd:") || STRPREFIX(backing, "rbd:"))
+    char *colon = strchr(backing, ':');
+    char *slash = strchr(backing, '/');
+
+    /* Reject anything that looks like a protocol (such as nbd: or
+     * rbd:); if someone really does want a relative file name that
+     * includes ':', they can always prefix './'.  */
+    if (colon && (!slash || colon < slash))
         return false;
     return true;
 }