[virt-tools-list] [virt-manager PATCH 6/6] guest: Add VirtIO input devices to s390x guests with graphics

Andrea Bolognani abologna at redhat.com
Wed Mar 20 15:52:35 UTC 2019


We're not including any input devices in the generated XML
for s390x guests, and the results is that it's not possible
to interact with them short of using the serial console or
connecting through ssh, which is fine but probably not what
is expected when graphics are present.

USB input devices are not a good fit for s390x guests: USB
requires PCI, and PCI is not widely available or used on
s390x; VirtIO devices, on the other hand, are a perfect
match since s390x guests use basically no emulated devices
and rely on VirtIO for most functionality.

https://bugzilla.redhat.com/show_bug.cgi?id=1683609

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 .../compare/virt-install-s390x-graphics.xml           |  2 ++
 virtinst/guest.py                                     | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/tests/cli-test-xml/compare/virt-install-s390x-graphics.xml b/tests/cli-test-xml/compare/virt-install-s390x-graphics.xml
index beee2136..1ae4f6ce 100644
--- a/tests/cli-test-xml/compare/virt-install-s390x-graphics.xml
+++ b/tests/cli-test-xml/compare/virt-install-s390x-graphics.xml
@@ -29,6 +29,8 @@
     <console type="pty">
       <target type="sclp"/>
     </console>
+    <input type="tablet" bus="virtio"/>
+    <input type="keyboard" bus="virtio"/>
     <graphics type="vnc" port="-1"/>
     <video>
       <model type="virtio"/>
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 483d2df2..9068d8c4 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -729,6 +729,17 @@ class Guest(XMLBuilder):
             dev.bus = "usb"
             self.add_device(dev)
 
+        # s390x guests need VirtIO input devices
+        if self.os.is_s390x() and self.osinfo.supports_virtioinput():
+            dev = DeviceInput(self.conn)
+            dev.type = "tablet"
+            dev.bus = "virtio"
+            self.add_device(dev)
+            dev = DeviceInput(self.conn)
+            dev.type = "keyboard"
+            dev.bus = "virtio"
+            self.add_device(dev)
+
     def _add_default_console_device(self):
         if self.skip_default_console:
             return
-- 
2.20.1




More information about the virt-tools-list mailing list