提交 1328a830 编写于 作者: P Peter Krempa

qemu: command: Drop formatting of 'media=cdrom' from -drive

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: NPeter Krempa <pkrempa@redhat.com>
上级 ea13c129
......@@ -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");
......
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册