[virt-tools-list] [virt-manager PATCH 4/6] devices: disk: Use virtio-scsi for CDROMs where supported

Andrea Bolognani abologna at redhat.com
Mon Mar 4 16:11:16 UTC 2019


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 at redhat.com>
---
 .../compare/virt-install-kvm-session-defaults.xml           | 6 ++++--
 tests/cli-test-xml/compare/virt-install-location-iso.xml    | 6 ++++--
 virtinst/devices/disk.py                                    | 4 +---
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/tests/cli-test-xml/compare/virt-install-kvm-session-defaults.xml b/tests/cli-test-xml/compare/virt-install-kvm-session-defaults.xml
index cee1e513..fa1ca470 100644
--- a/tests/cli-test-xml/compare/virt-install-kvm-session-defaults.xml
+++ b/tests/cli-test-xml/compare/virt-install-kvm-session-defaults.xml
@@ -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"/>
diff --git a/tests/cli-test-xml/compare/virt-install-location-iso.xml b/tests/cli-test-xml/compare/virt-install-location-iso.xml
index 5bccab2a..880f37b1 100644
--- a/tests/cli-test-xml/compare/virt-install-location-iso.xml
+++ b/tests/cli-test-xml/compare/virt-install-location-iso.xml
@@ -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"/>
diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py
index 533631eb..5ed95b51 100644
--- a/virtinst/devices/disk.py
+++ b/virtinst/devices/disk.py
@@ -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):
-- 
2.20.1




More information about the virt-tools-list mailing list