]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: domain: Forbid unsupported 'tftp' protocol and handle tests
authorPeter Krempa <pkrempa@redhat.com>
Wed, 13 May 2020 18:41:45 +0000 (20:41 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 20 May 2020 07:41:57 +0000 (09:41 +0200)
'tftp' storage protocol was supported by qemu until 2.7.0. Add an
interlock when blockdev is used and drop the test case for it as it's
IMO not worth adding another test file just for that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
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

index d0528dbfe0e8584f0615fab8c4d5056a1bae2b51..d5e3d1a3cc960b2240f55f965896b26832cffe29 100644 (file)
@@ -5319,6 +5319,16 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src,
         return -1;
     }
 
+    /* TFTP protocol was not supported for some time, lock it out at least with
+     * -blockdev */
+    if (actualType == VIR_STORAGE_TYPE_NETWORK &&
+        src->protocol == VIR_STORAGE_NET_PROTOCOL_TFTP &&
+        blockdev) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("'tftp' protocol is not supported with this QEMU binary"));
+        return -1;
+    }
+
     return 0;
 }
 
index 81ff324a0f6a72542ee85100a4f9e09ae9dfb020..794fdecdcb1b092b4890983942a7810d7cbda12a 100644 (file)
@@ -33,7 +33,4 @@ id=drive-ide0-0-1,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 \
--device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
index 81f6b400aacbd7c908c3bbc944787160e48dca56..fa5c0ba0875c8a783fbbd088c54313c170284994 100644 (file)
@@ -35,9 +35,6 @@ id=drive-ide0-0-1,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 \
--device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
index 2515b256d015e18502dc249a316535a3c53d5c13..1a102949df57f536ad70c6a46091367e5c5416eb 100644 (file)
@@ -28,26 +28,21 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 -boot strict=on \
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
 -blockdev '{"driver":"ftp","url":"ftp://host.name:21/url/path/file.iso",\
-"node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-4-format","read-only":true,"driver":"raw",\
-"file":"libvirt-4-storage"}' \
--device ide-cd,bus=ide.0,unit=0,drive=libvirt-4-format,id=ide0-0-0,bootindex=1 \
--blockdev '{"driver":"ftps","url":"ftps://host.name:990/url/path/file.iso",\
 "node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \
 -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?test=val",\
+-device ide-cd,bus=ide.0,unit=0,drive=libvirt-3-format,id=ide0-0-0,bootindex=1 \
+-blockdev '{"driver":"ftps","url":"ftps://host.name:990/url/path/file.iso",\
 "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"}' \
--device ide-cd,bus=ide.1,unit=0,drive=libvirt-2-format,id=ide0-1-0 \
--blockdev '{"driver":"tftp","url":"tftp://host.name:69/url/path/file.iso",\
+-device ide-cd,bus=ide.0,unit=1,drive=libvirt-2-format,id=ide0-0-1 \
+-blockdev '{"driver":"https",\
+"url":"https://host.name:443/url/path/file.iso?test=val",\
 "node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":true,"driver":"raw",\
 "file":"libvirt-1-storage"}' \
--device ide-cd,bus=ide.1,unit=1,drive=libvirt-1-format,id=ide0-1-1 \
+-device ide-cd,bus=ide.1,unit=0,drive=libvirt-1-format,id=ide0-1-0 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
index 44473f8ad422d7405e4e6a6422afcbfac1c9ce2f..18a56f7156721d1f81d6c11fb4244313ce7fe821 100644 (file)
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <disk type='network' device='cdrom'>
-      <driver name='qemu' type='raw'/>
-      <source protocol='tftp' name='/url/path/file.iso'>
-        <host name='host.name' port='69'/>
-      </source>
-      <target dev='hdd' bus='ide'/>
-      <readonly/>
-      <address type='drive' controller='0' bus='1' target='0' unit='1'/>
-    </disk>
     <controller type='usb' index='0'/>
     <controller type='pci' index='0' model='pci-root'/>
     <controller type='ide' index='0'/>