[virt-tools-list] [virt-manager PATCH 4/6] guest: Add USB input devices to pSeries guests with graphics

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


libvirt already does this for us, sort of: it will automatically
add a USB keyboard and mouse to ppc64 guests, regardless of
whether or not they have graphics; in addition, these devices
are impossible to remove.

Unfortunately this results in a pretty poor experience for the
user, since the relative pointing device makes interacting with
the GUI an exercise in frustration.

As of commit 186bb479d0f4, libvirt will still add the USB
keyboard automatically but will skip the USB mouse if a USB
tablet is already present, so by explicitly including USB input
devices in the generated XML we can create guests that are
actually usable.

We can do this unconditionally, without having to worry about
what version of libvirt we're running against: if it's new
enough we'll take advantage of the fix, and if not then the
resulting guest will not be any more broken than it would have
been before.

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

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 tests/cli-test-xml/compare/virt-install-ppc64-graphics.xml      | 2 ++
 .../cli-test-xml/compare/virt-install-ppc64-machdefault-f20.xml | 2 ++
 tests/cli-test-xml/compare/virt-install-ppc64-pseries-f20.xml   | 2 ++
 tests/cli-test-xml/compare/virt-install-ppc64le-kvm-import.xml  | 2 ++
 virtinst/guest.py                                               | 2 +-
 5 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/cli-test-xml/compare/virt-install-ppc64-graphics.xml b/tests/cli-test-xml/compare/virt-install-ppc64-graphics.xml
index 5b27017b..1aa0a2f4 100644
--- a/tests/cli-test-xml/compare/virt-install-ppc64-graphics.xml
+++ b/tests/cli-test-xml/compare/virt-install-ppc64-graphics.xml
@@ -32,6 +32,8 @@
       <source mode="bind"/>
       <target type="virtio" name="org.qemu.guest_agent.0"/>
     </channel>
+    <input type="tablet" bus="usb"/>
+    <input type="keyboard" bus="usb"/>
     <graphics type="vnc" port="-1"/>
     <video>
       <model type="vga"/>
diff --git a/tests/cli-test-xml/compare/virt-install-ppc64-machdefault-f20.xml b/tests/cli-test-xml/compare/virt-install-ppc64-machdefault-f20.xml
index 62d4c90a..e80e4c6f 100644
--- a/tests/cli-test-xml/compare/virt-install-ppc64-machdefault-f20.xml
+++ b/tests/cli-test-xml/compare/virt-install-ppc64-machdefault-f20.xml
@@ -30,6 +30,8 @@
     <channel type="spicevmc">
       <target type="virtio" name="com.redhat.spice.0"/>
     </channel>
+    <input type="tablet" bus="usb"/>
+    <input type="keyboard" bus="usb"/>
     <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
       <image compression="off"/>
     </graphics>
diff --git a/tests/cli-test-xml/compare/virt-install-ppc64-pseries-f20.xml b/tests/cli-test-xml/compare/virt-install-ppc64-pseries-f20.xml
index c87ac525..358d9ec2 100644
--- a/tests/cli-test-xml/compare/virt-install-ppc64-pseries-f20.xml
+++ b/tests/cli-test-xml/compare/virt-install-ppc64-pseries-f20.xml
@@ -35,6 +35,8 @@
     <channel type="spicevmc">
       <target type="virtio" name="com.redhat.spice.0"/>
     </channel>
+    <input type="tablet" bus="usb"/>
+    <input type="keyboard" bus="usb"/>
     <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
       <image compression="off"/>
     </graphics>
diff --git a/tests/cli-test-xml/compare/virt-install-ppc64le-kvm-import.xml b/tests/cli-test-xml/compare/virt-install-ppc64le-kvm-import.xml
index 37f993f5..012341c6 100644
--- a/tests/cli-test-xml/compare/virt-install-ppc64le-kvm-import.xml
+++ b/tests/cli-test-xml/compare/virt-install-ppc64le-kvm-import.xml
@@ -32,6 +32,8 @@
       <source mode="bind"/>
       <target type="virtio" name="org.qemu.guest_agent.0"/>
     </channel>
+    <input type="tablet" bus="usb"/>
+    <input type="keyboard" bus="usb"/>
     <graphics type="vnc" port="-1"/>
     <video>
       <model type="vga"/>
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 2cca3e8d..483d2df2 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -714,7 +714,7 @@ class Guest(XMLBuilder):
         usb_keyboard = False
         if self.os.is_x86() and not self.os.is_xenpv():
             usb_tablet = self.osinfo.supports_usbtablet()
-        if self.os.is_arm_machvirt():
+        if self.os.is_arm_machvirt() or self.os.is_pseries():
             usb_tablet = True
             usb_keyboard = True
 
-- 
2.20.1




More information about the virt-tools-list mailing list