devices: disk: Use virtio-scsi for CDROMs where supported

We already use virtio-blk for regular disks whenever possible,
and there's no good reason not to do the same with virtio-scsi
when dealing with CDROMs instead of artificially limiting its
use to s390x and ppc64/pseries guests.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Andrea Bolognani 2019-03-04 17:11:16 +01:00 committed by Cole Robinson
parent 47753eab26
commit a746150bef
3 changed files with 9 additions and 7 deletions

View File

@ -40,10 +40,11 @@
<disk type="file" device="cdrom">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/testvol1.img"/>
<target dev="hda" bus="ide"/>
<target dev="sda" bus="scsi"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="qemu-xhci" ports="15"/>
<controller type="scsi" index="0" model="virtio-scsi"/>
<interface type="user">
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
@ -109,10 +110,11 @@
<target dev="vda" bus="virtio"/>
</disk>
<disk type="file" device="cdrom">
<target dev="hda" bus="ide"/>
<target dev="sda" bus="scsi"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="qemu-xhci" ports="15"/>
<controller type="scsi" index="0" model="virtio-scsi"/>
<interface type="user">
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>

View File

@ -40,7 +40,7 @@
<disk type="file" device="cdrom">
<driver name="qemu"/>
<source file="/tmp/fake-fedora17-tree.iso"/>
<target dev="hda" bus="ide"/>
<target dev="sda" bus="scsi"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="ich9-ehci1"/>
@ -53,6 +53,7 @@
<controller type="usb" index="0" model="ich9-uhci3">
<master startport="4"/>
</controller>
<controller type="scsi" index="0" model="virtio-scsi"/>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
@ -114,7 +115,7 @@
<target dev="vda" bus="virtio"/>
</disk>
<disk type="file" device="cdrom">
<target dev="hda" bus="ide"/>
<target dev="sda" bus="scsi"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="ich9-ehci1"/>
@ -127,6 +128,7 @@
<controller type="usb" index="0" model="ich9-uhci3">
<master startport="4"/>
</controller>
<controller type="scsi" index="0" model="virtio-scsi"/>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>

View File

@ -955,14 +955,12 @@ class DeviceDisk(Device):
return "scsi"
if self.is_disk() and guest.supports_virtiodisk():
return "virtio"
if guest.os.is_pseries() and self.is_cdrom():
if self.is_cdrom() and guest.supports_virtioscsi():
return "scsi"
if guest.os.is_arm():
return "sd"
if guest.os.is_q35():
return "sata"
if self.is_cdrom() and guest.os.is_s390x():
return "scsi"
return "ide"
def set_defaults(self, guest):