Blame SOURCES/libvirt-qemu-Allow-creating-ppc64-guests-with-graphics-and-no-USB-mouse.patch

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