render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Pablo Greco 40546a
From 1c58390619bfdd6174b1d24bc5b64caae45487b0 Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <1c58390619bfdd6174b1d24bc5b64caae45487b0@dist-git>
Pablo Greco 40546a
From: Andrea Bolognani <abologna@redhat.com>
Pablo Greco 40546a
Date: Wed, 17 Apr 2019 11:21:25 +0200
Pablo Greco 40546a
Subject: [PATCH] qemu: Allow creating ppc64 guests with graphics and no USB
Pablo Greco 40546a
 mouse
Pablo Greco 40546a
Pablo Greco 40546a
The existing behavior for ppc64 guests is to always add a USB
Pablo Greco 40546a
keyboard and mouse combo if graphics are present; unfortunately,
Pablo Greco 40546a
this means any attempt to use a USB tablet will cause both pointing
Pablo Greco 40546a
devices to show up in the guest, which in turn will result in poor
Pablo Greco 40546a
user experience.
Pablo Greco 40546a
Pablo Greco 40546a
We can't just stop adding the USB mouse or start adding a USB tablet
Pablo Greco 40546a
instead, because existing applications and users might rely on the
Pablo Greco 40546a
current behavior; however, we can avoid adding the USB mouse if a USB
Pablo Greco 40546a
tablet is already present, thus allowing users and applications to
Pablo Greco 40546a
create guests that contain a single pointing device.
Pablo Greco 40546a
Pablo Greco 40546a
https://bugzilla.redhat.com/show_bug.cgi?id=1683681
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Pablo Greco 40546a
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Pablo Greco 40546a
Pablo Greco 40546a
(cherry picked from commit 186bb479d0f409dc75175bea48a760838c479a6c)
Pablo Greco 40546a
Pablo Greco 40546a
Conflicts:
Pablo Greco 40546a
  * src/qemu/qemu_domain.c
Pablo Greco 40546a
    + context in qemuDomainDefAddDefaultDevices()
Pablo Greco 40546a
      - missing 6427bfc8b3bb
Pablo Greco 40546a
Pablo Greco 40546a
Deleted:
Pablo Greco 40546a
  * tests/qemuxml2argvdata/ppc64-pseries-graphics.ppc64-latest.args
Pablo Greco 40546a
    + doesn't exist downstream
Pablo Greco 40546a
      - missing 4d7ea75e1e73
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Pablo Greco 40546a
Message-Id: <20190417092125.10277-2-abologna@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/qemu/qemu_domain.c | 20 ++++++++++++++++++++
Pablo Greco 40546a
 1 file changed, 20 insertions(+)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
Pablo Greco 40546a
index be3477bf8a..cc2a896a07 100644
Pablo Greco 40546a
--- a/src/qemu/qemu_domain.c
Pablo Greco 40546a
+++ b/src/qemu/qemu_domain.c
Pablo Greco 40546a
@@ -3323,6 +3323,26 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
Pablo Greco 40546a
         def->memballoon = memballoon;
Pablo Greco 40546a
     }
Pablo Greco 40546a
 
Pablo Greco 40546a
+    if (addDefaultUSBMouse) {
Pablo Greco 40546a
+        bool hasUSBTablet = false;
Pablo Greco 40546a
+        size_t j;
Pablo Greco 40546a
+
Pablo Greco 40546a
+        for (j = 0; j < def->ninputs; j++) {
Pablo Greco 40546a
+            if (def->inputs[j]->type == VIR_DOMAIN_INPUT_TYPE_TABLET &&
Pablo Greco 40546a
+                def->inputs[j]->bus == VIR_DOMAIN_INPUT_BUS_USB) {
Pablo Greco 40546a
+                hasUSBTablet = true;
Pablo Greco 40546a
+                break;
Pablo Greco 40546a
+            }
Pablo Greco 40546a
+        }
Pablo Greco 40546a
+
Pablo Greco 40546a
+        /* Historically, we have automatically added USB keyboard and
Pablo Greco 40546a
+         * mouse to some guests. While the former device is generally
Pablo Greco 40546a
+         * safe to have, adding the latter is undesiderable if a USB
Pablo Greco 40546a
+         * tablet is already present in the guest */
Pablo Greco 40546a
+        if (hasUSBTablet)
Pablo Greco 40546a
+            addDefaultUSBMouse = false;
Pablo Greco 40546a
+    }
Pablo Greco 40546a
+
Pablo Greco 40546a
     if (addDefaultUSBKBD &&
Pablo Greco 40546a
         def->ngraphics > 0 &&
Pablo Greco 40546a
         virDomainDefMaybeAddInput(def,
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.21.0
Pablo Greco 40546a