[PATCH 01/21] qemu: domain: Forbid unsupported 'tftp' protocol and handle tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'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@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c                          | 10 ++++++++++
 tests/qemuxml2argvdata/disk-cdrom-network.args  |  3 ---
 .../disk-cdrom-network.x86_64-2.12.0.args       |  3 ---
 .../disk-cdrom-network.x86_64-latest.args       | 17 ++++++-----------
 tests/qemuxml2argvdata/disk-cdrom-network.xml   |  9 ---------
 5 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d0528dbfe0..d5e3d1a3cc 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -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;
 }

diff --git a/tests/qemuxml2argvdata/disk-cdrom-network.args b/tests/qemuxml2argvdata/disk-cdrom-network.args
index 81ff324a0f..794fdecdcb 100644
--- a/tests/qemuxml2argvdata/disk-cdrom-network.args
+++ b/tests/qemuxml2argvdata/disk-cdrom-network.args
@@ -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
diff --git a/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-2.12.0.args b/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-2.12.0.args
index 81f6b400aa..fa5c0ba087 100644
--- a/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-2.12.0.args
+++ b/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-2.12.0.args
@@ -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 \
diff --git a/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-latest.args b/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-latest.args
index 2515b256d0..1a102949df 100644
--- a/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-latest.args
@@ -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 \
diff --git a/tests/qemuxml2argvdata/disk-cdrom-network.xml b/tests/qemuxml2argvdata/disk-cdrom-network.xml
index 44473f8ad4..18a56f7156 100644
--- a/tests/qemuxml2argvdata/disk-cdrom-network.xml
+++ b/tests/qemuxml2argvdata/disk-cdrom-network.xml
@@ -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'/>
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux