c401cc
From c04f1a5c282ffd48a5df4612dc12b2ca44a3ae26 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <c04f1a5c282ffd48a5df4612dc12b2ca44a3ae26@dist-git>
c401cc
From: Eric Blake <eblake@redhat.com>
c401cc
Date: Wed, 26 Feb 2014 14:55:11 +0100
c401cc
Subject: [PATCH] storage: fix omitted slash in gluster volume URI
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1032370
c401cc
c401cc
When doing 'virsh vol-dumpxml' on a gluster pool's volume, the
c401cc
resulting URI incorrectly omitted a slash between hostname and
c401cc
path:  gluster://192.168.122.206rhsvol1/fedora-19.img
c401cc
c401cc
This is fallout from me rebasing earlier versions of my patch
c401cc
that ended up as commit efee1af; I had originally played with
c401cc
always requiring the gluster volume to have a leading slash,
c401cc
but it was easier to use the gluster API if the gluster volume
c401cc
name was guaranteed to have no slash.  While I got the URI of
c401cc
the pool correct, I forgot to fix the URI of a libvirt volume.
c401cc
c401cc
* src/storage/storage_backend_gluster.c
c401cc
(virStorageBackendGlusterRefreshVol): Use correct starting point
c401cc
since uri construction requires leading slash.
c401cc
c401cc
Signed-off-by: Eric Blake <eblake@redhat.com>
c401cc
(cherry picked from commit 6cd60b687acd04ea1538690b7d80f2809e0e29d4)
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 src/storage/storage_backend_gluster.c | 5 ++++-
c401cc
 1 file changed, 4 insertions(+), 1 deletion(-)
c401cc
c401cc
diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
c401cc
index 1be9034..622526b 100644
c401cc
--- a/src/storage/storage_backend_gluster.c
c401cc
+++ b/src/storage/storage_backend_gluster.c
c401cc
@@ -227,7 +227,10 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
c401cc
         goto cleanup;
c401cc
 
c401cc
     tmp = state->uri->path;
c401cc
-    state->uri->path = vol->key;
c401cc
+    if (virAsprintf(&vol->key, "%s%s", state->uri->path, name) < 0) {
c401cc
+        state->uri->path = tmp;
c401cc
+        goto cleanup;
c401cc
+    }
c401cc
     if (!(vol->target.path = virURIFormat(state->uri))) {
c401cc
         state->uri->path = tmp;
c401cc
         goto cleanup;
c401cc
-- 
c401cc
1.9.0
c401cc