For SCSI, IDE, and AHCI cdroms the appropriate device types which select
the correct media are used. In qemu there's one other code path that
looks at -drive media=cdrom in the XEN pv code. Thankfully we don't
support it with qemu (see qemuBuildDiskDeviceStr). All other devices
ignore it as the comment states, thus we can drop that code.
The test fallout is expectedly only in the test added for uncommon cdrom
types.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_command.c | 9 ---------
.../disk-cdrom-bus-other.x86_64-latest.args | 9 ++++-----
2 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d85580b857..0a62317a33 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1748,15 +1748,6 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_STORAGE_WERROR))
qemuBuildDiskFrontendAttributeErrorPolicy(disk, &opt);
-
- /* While this is a frontend attribute, it only makes sense to be used when
- * legacy -drive is used. In modern qemu the 'ide-cd' or 'scsi-cd'
are used.
- * virtio and other just ignore the attribute anyways */
- if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
- disk->bus != VIR_DOMAIN_DISK_BUS_SCSI &&
- disk->bus != VIR_DOMAIN_DISK_BUS_IDE)
- virBufferAddLit(&opt, ",media=cdrom");
-
if (!virStorageSourceIsEmpty(disk->src)) {
if (disk->src->readonly)
virBufferAddLit(&opt, ",readonly=on");
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 34849c2e96..aba5599aad 100644
--- a/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args
@@ -24,15 +24,14 @@ 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,media=cdrom,\
-readonly=on \
+-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,\
removable=off \
--drive if=none,id=drive-usb-disk1,media=cdrom \
+-drive if=none,id=drive-usb-disk1 \
-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,media=cdrom,readonly=on \
--drive if=sd,index=3,media=cdrom \
+-drive file=/root/boot2.iso,format=raw,if=sd,index=2,readonly=on \
+-drive if=sd,index=3 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
--
2.20.1