render / rpms / libvirt

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