We can't set the type of the device on the 'sd' bus and realistically a
cdrom doesn't even make sense there. Forbid it.
Note that the output of in disk-cdrom-bus-other.x86_64-latest.args
switched to blockdev as it's no longer locked out due to use of a disk
on 'sd' bus.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_validate.c | 5 +++--
.../disk-cdrom-bus-other.x86_64-latest.args | 13 ++++++-------
tests/qemuxml2argvdata/disk-cdrom-bus-other.xml | 11 -----------
tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml | 11 -----------
4 files changed, 9 insertions(+), 31 deletions(-)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index a7c918e5fd..f49181b639 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -1946,9 +1946,10 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef
*disk,
}
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
- disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
+ (disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO ||
+ disk->bus == VIR_DOMAIN_DISK_BUS_SD)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("disk type 'virtio' of '%s' does not
support ejectable media"),
+ _("disk type of '%s' does not support ejectable
media"),
disk->dst);
return -1;
}
diff --git a/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args
b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args
index b1c30dd4d8..be091f150f 100644
--- a/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args
@@ -28,14 +28,13 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-no-acpi \
-boot strict=on \
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
--drive file=/root/boot.iso,format=raw,if=none,id=drive-usb-disk0,readonly=on \
--device usb-storage,bus=usb.0,port=1,drive=drive-usb-disk0,id=usb-disk0,\
+-blockdev
'{"driver":"file","filename":"/root/boot.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 usb-storage,bus=usb.0,port=1,drive=libvirt-2-format,id=usb-disk0,\
removable=off \
--drive if=none,id=drive-usb-disk1,readonly=on \
--device usb-storage,bus=usb.0,port=2,drive=drive-usb-disk1,id=usb-disk1,\
-removable=off \
--drive file=/root/boot2.iso,format=raw,if=sd,index=2,readonly=on \
--drive if=sd,index=3,readonly=on \
+-device usb-storage,bus=usb.0,port=2,id=usb-disk1,removable=off \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml
b/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml
index e73db8c6ab..e6bf1ea797 100644
--- a/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml
+++ b/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml
@@ -26,17 +26,6 @@
<target dev='sdb' bus='usb'/>
<readonly/>
</disk>
- <disk type='file' device='cdrom'>
- <driver name='qemu' type='raw'/>
- <source file='/root/boot2.iso'/>
- <target dev='sdc' bus='sd'/>
- <readonly/>
- </disk>
- <disk type='file' device='cdrom'>
- <driver name='qemu' type='raw'/>
- <target dev='sdd' bus='sd'/>
- <readonly/>
- </disk>
<controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='pci' index='0' model='pci-root'/>
diff --git a/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml
b/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml
index 10262e40d7..ec86d19f1d 100644
--- a/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml
+++ b/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml
@@ -26,17 +26,6 @@
<target dev='sdb' bus='usb'/>
<readonly/>
</disk>
- <disk type='file' device='cdrom'>
- <driver name='qemu' type='raw'/>
- <source file='/root/boot2.iso'/>
- <target dev='sdc' bus='sd'/>
- <readonly/>
- </disk>
- <disk type='file' device='cdrom'>
- <driver name='qemu' type='raw'/>
- <target dev='sdd' bus='sd'/>
- <readonly/>
- </disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x2'/>
</controller>
--
2.26.2