[PATCH 2/3] qemuBlockStorageSourceGetURI: Properly preserve query component

Peter Krempa pkrempa at redhat.com
Fri Mar 27 15:51:20 UTC 2020


Look for the questionmark in the name and move the contents into the
query portion so that we format the URI back properly.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_block.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 648c3f1026..c51fb2b6ea 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -429,12 +429,18 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src)
     }

     if (src->path) {
+        char *query;
         if (src->volume) {
             uri->path = g_strdup_printf("/%s/%s", src->volume, src->path);
         } else {
             uri->path = g_strdup_printf("%s%s", src->path[0] == '/' ? "" : "/",
                                         src->path);
         }
+
+        if ((query = strchr(uri->path, '?'))) {
+            uri->query = g_strdup(query + 1);
+            *query = '\0';
+        }
     }

     uri->server = g_strdup(src->hosts->name);
-- 
2.24.1




More information about the libvir-list mailing list