[PATCH] storage: recognize gluster as networked file

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

 



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@xxxxxxxxxx>
---

This one will be important to my work on gluster backing chains, but
can be reviewed and applied independently now.

 src/util/virstoragefile.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 1b4d4cf..8f04b78 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -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;
 }
-- 
1.8.3.1

--
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]