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