]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Remove the implicit PS2 devices for non-X86 platforms
authorLi Zhang <zhlcindy@linux.vnet.ibm.com>
Mon, 17 Feb 2014 10:17:54 +0000 (18:17 +0800)
committerJán Tomko <jtomko@redhat.com>
Wed, 19 Feb 2014 08:16:31 +0000 (09:16 +0100)
PS2 devices only work on X86 platform, other platforms may need
USB devices instead. Athough it doesn't influence the QEMU command line,
it's not right to add PS2 mouse/keyboard for non-X86 platform.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_conf.c
src/util/virarch.h
tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml

index 75b87d11ba2d3af1547f227098f1ec63fed24508..2826847a0cdac014e7e738b47a0cc9f720f29bb8 100644 (file)
@@ -7839,10 +7839,12 @@ virDomainInputDefParseXML(const virDomainDef *dom,
     } else {
         if (STREQ(dom->os.type, "hvm")) {
             if ((def->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
-                def->type == VIR_DOMAIN_INPUT_TYPE_KBD))
+                def->type == VIR_DOMAIN_INPUT_TYPE_KBD) &&
+                (ARCH_IS_X86(dom->os.arch) || dom->os.arch == VIR_ARCH_NONE)) {
                 def->bus = VIR_DOMAIN_INPUT_BUS_PS2;
-            else
+            } else {
                 def->bus = VIR_DOMAIN_INPUT_BUS_USB;
+            }
         } else {
             def->bus = VIR_DOMAIN_INPUT_BUS_XEN;
         }
@@ -12498,7 +12500,8 @@ virDomainDefParseXML(xmlDocPtr xml,
     VIR_FREE(nodes);
 
     /* If graphics are enabled, there's an implicit PS2 mouse */
-    if (def->ngraphics > 0) {
+    if (def->ngraphics > 0 &&
+        (ARCH_IS_X86(def->os.arch) || def->os.arch == VIR_ARCH_NONE)) {
         int input_bus = VIR_DOMAIN_INPUT_BUS_XEN;
 
         if (STREQ(def->os.type, "hvm"))
@@ -17531,20 +17534,22 @@ virDomainDefFormatInternal(virDomainDefPtr def,
 
     if (def->ngraphics > 0) {
         /* If graphics is enabled, add the implicit mouse/keyboard */
-        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 ((ARCH_IS_X86(def->os.arch)) || def->os.arch == VIR_ARCH_NONE) {
+            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 (!(flags & VIR_DOMAIN_XML_MIGRATABLE)) {
-            autoInput.type = VIR_DOMAIN_INPUT_TYPE_KBD;
             if (virDomainInputDefFormat(buf, &autoInput, flags) < 0)
                 goto error;
+
+            if (!(flags & VIR_DOMAIN_XML_MIGRATABLE)) {
+                autoInput.type = VIR_DOMAIN_INPUT_TYPE_KBD;
+                if (virDomainInputDefFormat(buf, &autoInput, flags) < 0)
+                    goto error;
+            }
         }
 
         for (n = 0; n < def->ngraphics; n++)
index b180400de3d4dadfb4c9bcbff5b81c97b5f095a1..c4d67cee326ad16744c7185cca16641287e6909b 100644 (file)
@@ -70,6 +70,8 @@ typedef enum {
     VIR_ARCH_LAST,
 } virArch;
 
+# define ARCH_IS_X86(arch)  ((arch) == VIR_ARCH_X86_64 ||\
+                             (arch) == VIR_ARCH_I686)
 
 typedef enum {
     VIR_ARCH_LITTLE_ENDIAN,
index 05e0f63968539ccf34332e2295abe543d7ff1d3c..8dde776a087972f34a225e6b5349c6c8219906a4 100644 (file)
@@ -30,8 +30,6 @@
     <controller type='usb' index='0'/>
     <controller type='scsi' index='0'/>
     <controller type='pci' index='0' model='pci-root'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
     <graphics type='sdl'/>
     <video>
       <model type='cirrus' vram='9216' heads='1'/>