qemu: domain: Forbid unsupported 'tftp' protocol and handle tests

'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>
This commit is contained in:
Peter Krempa 2020-05-13 20:41:45 +02:00
parent de8216af13
commit 26c8b4f1fc
5 changed files with 16 additions and 26 deletions

View 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;
}

View 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

View 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 \

View 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 \

View File

@ -46,15 +46,6 @@
<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'/>