]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: command: Drop formatting of 'media=cdrom' from -drive
authorPeter Krempa <pkrempa@redhat.com>
Mon, 28 Jan 2019 16:18:56 +0000 (17:18 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 8 Feb 2019 07:48:33 +0000 (08:48 +0100)
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@redhat.com>
src/qemu/qemu_command.c
tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args

index 7c79223812ab5e481a7a7630115ff9f45cd13704..eaeeb3a05de13bd375791cd8d5653352b2688f83 100644 (file)
@@ -1757,15 +1757,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 (disk->src->readonly)
         virBufferAddLit(&opt, ",readonly=on");
 
index a64da3edd60b31feaaa0c4fe378079c71693e11b..cb7902dfd0207f94f5b9ae3e596906af51349929 100644 (file)
@@ -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,readonly=on \
+-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,media=cdrom,readonly=on \
--drive if=sd,index=3,media=cdrom,readonly=on \
+-drive file=/root/boot2.iso,format=raw,if=sd,index=2,readonly=on \
+-drive if=sd,index=3,readonly=on \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -msg timestamp=on