[PATCH 2/2] Fix implicitly created PS/2 mouse on non-x86 architectures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes the appearance of a PS/2 mouse in the list of
input devices of non-x86 guests.
---
 src/conf/domain_conf.c | 48 ++++++++++++++++++++++++++++--------------------
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4938740..fb088d5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12114,14 +12114,16 @@ virDomainDefParseXML(xmlDocPtr xml,
         /* With QEMU / KVM / Xen graphics, mouse + PS/2 is implicit
          * with graphics, so don't store it.
          * XXX will this be true for other virt types ? */
-        if ((STREQ(def->os.type, "hvm") &&
-             input->bus == VIR_DOMAIN_INPUT_BUS_PS2 &&
-             input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE) ||
-            (STRNEQ(def->os.type, "hvm") &&
-             input->bus == VIR_DOMAIN_INPUT_BUS_XEN &&
-             input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE)) {
-            virDomainInputDefFree(input);
-            continue;
+        if (def->os.arch == VIR_ARCH_I686 || def->os.arch == VIR_ARCH_X86_64) {
+            if ((STREQ(def->os.type, "hvm") &&
+                 input->bus == VIR_DOMAIN_INPUT_BUS_PS2 &&
+                 input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE) ||
+                (STRNEQ(def->os.type, "hvm") &&
+                 input->bus == VIR_DOMAIN_INPUT_BUS_XEN &&
+                 input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE)) {
+                virDomainInputDefFree(input);
+                continue;
+            }
         }
 
         def->inputs[def->ninputs++] = input;
@@ -12145,8 +12147,10 @@ virDomainDefParseXML(xmlDocPtr xml,
     }
     VIR_FREE(nodes);
 
-    /* If graphics are enabled, there's an implicit PS2 mouse */
-    if (def->ngraphics > 0) {
+    /* If graphics are enabled, there's an implicit PS2 mouse
+     * in the x86 architecture */
+    if (def->ngraphics > 0 && (def->os.arch == VIR_ARCH_I686 ||
+                               def->os.arch == VIR_ARCH_X86_64)) {
         virDomainInputDefPtr input;
 
         if (VIR_ALLOC(input) < 0) {
@@ -17056,16 +17060,20 @@ virDomainDefFormatInternal(virDomainDefPtr def,
     }
 
     if (def->ngraphics > 0) {
-        /* If graphics is enabled, add the implicit mouse */
-        virDomainInputDef autoInput = {
-            VIR_DOMAIN_INPUT_TYPE_MOUSE,
-            STREQ(def->os.type, "hvm") ?
-            VIR_DOMAIN_INPUT_BUS_PS2 : VIR_DOMAIN_INPUT_BUS_XEN,
-            { .alias = NULL },
-        };
-
-        if (virDomainInputDefFormat(buf, &autoInput, flags) < 0)
-            goto error;
+        /* If graphics is enabled, add the implicit mouse in the x86
+         * architecture */
+
+        if (def->os.arch == VIR_ARCH_I686 || def->os.arch == VIR_ARCH_X86_64) {
+            virDomainInputDef autoInput = {
+                VIR_DOMAIN_INPUT_TYPE_MOUSE,
+                STREQ(def->os.type, "hvm") ?
+                VIR_DOMAIN_INPUT_BUS_PS2 : VIR_DOMAIN_INPUT_BUS_XEN,
+                { .alias = NULL },
+            };
+
+            if (virDomainInputDefFormat(buf, &autoInput, flags) < 0)
+                goto error;
+        }
 
         for (n = 0; n < def->ngraphics; n++)
             if (virDomainGraphicsDefFormat(buf, def->graphics[n], flags) < 0)
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]