]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuBlockStorageSourceGetURI: Pass through query component
authorPeter Krempa <pkrempa@redhat.com>
Fri, 27 Mar 2020 15:34:37 +0000 (16:34 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 30 Mar 2020 14:30:34 +0000 (16:30 +0200)
If the storage source has the query part set, format it in the output.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_block.c
src/qemu/qemu_domain.c
tests/qemuxml2argvdata/disk-cdrom-network.args
tests/qemuxml2argvdata/disk-cdrom-network.x86_64-2.12.0.args
tests/qemuxml2argvdata/disk-cdrom-network.x86_64-latest.args
tests/qemuxml2argvdata/disk-cdrom-network.xml
tests/qemuxml2argvdata/disk-network-http.x86_64-latest.args

index fe5a0a6a7d88cd5004a3a90da2495034573b0ecd..d32277d7fd57dc975fe0c8cdb12e26b33f30116c 100644 (file)
@@ -437,6 +437,8 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src)
         }
     }
 
+    uri->query = g_strdup(src->query);
+
     uri->server = g_strdup(src->hosts->name);
 
     return g_steal_pointer(&uri);
index adda17a49f7a18da1701cbfe0f9a6ffdbe8a7a6f..dd48b6fff394e2ba242322c0d17c66137b8ac89e 100644 (file)
@@ -7132,6 +7132,15 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src,
         }
     }
 
+    if (src->query &&
+        (actualType != VIR_STORAGE_TYPE_NETWORK ||
+         (src->protocol != VIR_STORAGE_NET_PROTOCOL_HTTPS &&
+          src->protocol != VIR_STORAGE_NET_PROTOCOL_HTTP))) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("query is supported only with HTTP(S) protocols"));
+        return -1;
+    }
+
     return 0;
 }
 
index be19bad68a8052dba2b20f7ef5b529c4b843fd86..81ff324a0f6a72542ee85100a4f9e09ae9dfb020 100644 (file)
@@ -30,8 +30,8 @@ id=drive-ide0-0-0,readonly=on \
 -drive file=ftps://host.name:990/url/path/file.iso,format=raw,if=none,\
 id=drive-ide0-0-1,readonly=on \
 -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
--drive file=https://host.name:443/url/path/file.iso,format=raw,if=none,\
-id=drive-ide0-1-0,readonly=on \
+-drive 'file=https://host.name:443/url/path/file.iso?test=val,format=raw,\
+if=none,id=drive-ide0-1-0,readonly=on' \
 -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
 -drive file=tftp://host.name:69/url/path/file.iso,format=raw,if=none,\
 id=drive-ide0-1-1,readonly=on \
index 1ece3d6f46f66562545294b374f2569f9ec8979f..81f6b400aacbd7c908c3bbc944787160e48dca56 100644 (file)
@@ -32,8 +32,8 @@ id=drive-ide0-0-0,readonly=on \
 -drive file=ftps://host.name:990/url/path/file.iso,format=raw,if=none,\
 id=drive-ide0-0-1,readonly=on \
 -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
--drive file=https://host.name:443/url/path/file.iso,format=raw,if=none,\
-id=drive-ide0-1-0,readonly=on \
+-drive 'file=https://host.name:443/url/path/file.iso?test=val,format=raw,\
+if=none,id=drive-ide0-1-0,readonly=on' \
 -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
 -drive file=tftp://host.name:69/url/path/file.iso,format=raw,if=none,\
 id=drive-ide0-1-1,readonly=on \
index 0b4ac07f07733a1e90f7c4aa9163195f58d8f822..2515b256d015e18502dc249a316535a3c53d5c13 100644 (file)
@@ -37,7 +37,8 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 -blockdev '{"node-name":"libvirt-3-format","read-only":true,"driver":"raw",\
 "file":"libvirt-3-storage"}' \
 -device ide-cd,bus=ide.0,unit=1,drive=libvirt-3-format,id=ide0-0-1 \
--blockdev '{"driver":"https","url":"https://host.name:443/url/path/file.iso",\
+-blockdev '{"driver":"https",\
+"url":"https://host.name:443/url/path/file.iso?test=val",\
 "node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"raw",\
 "file":"libvirt-2-storage"}' \
index 0bdc0e1883eb03e90e2b7e5298432776de567839..44473f8ad422d7405e4e6a6422afcbfac1c9ce2f 100644 (file)
@@ -39,7 +39,7 @@
     </disk>
     <disk type='network' device='cdrom'>
       <driver name='qemu' type='raw'/>
-      <source protocol='https' name='/url/path/file.iso'>
+      <source protocol='https' name='/url/path/file.iso' query='test=val'>
         <host name='host.name' port='443'/>
       </source>
       <target dev='hdc' bus='ide'/>
index ed44424dc3cd642e7f69d945b08aa2d635d074de..7b4674a588b83333f3cdcf499db7d718c00fcaa5 100644 (file)
@@ -55,8 +55,9 @@ id=virtio-disk2 \
 -object secret,id=libvirt-1-storage-httpcookie-secret0,\
 data=DrPR9NA6GKJb7qi1KbjHaealKEMVtOWUl2h3yvO5lgIh6cyLHemmlg+h9fcgwREA,\
 keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
--blockdev '{"driver":"https","url":"https://example.org:1234/test4.img",\
-"sslverify":false,"cookie-secret":"libvirt-1-storage-httpcookie-secret0",\
+-blockdev '{"driver":"https",\
+"url":"https://example.org:1234/test4.img?par=val&other=ble","sslverify":false,\
+"cookie-secret":"libvirt-1-storage-httpcookie-secret0",\
 "node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw",\
 "file":"libvirt-1-storage"}' \