From: Li Zhang Date: Mon, 17 Feb 2014 10:17:54 +0000 (+0800) Subject: conf: Remove the implicit PS2 devices for non-X86 platforms X-Git-Tag: v1.2.2-rc1~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b39275954b5dd8e660ecd457481480f4b6bfae56;p=thirdparty%2Flibvirt.git conf: Remove the implicit PS2 devices for non-X86 platforms 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 Signed-off-by: Ján Tomko --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 75b87d11ba..2826847a0c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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++) diff --git a/src/util/virarch.h b/src/util/virarch.h index b180400de3..c4d67cee32 100644 --- a/src/util/virarch.h +++ b/src/util/virarch.h @@ -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, diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml index 05e0f63968..8dde776a08 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml @@ -30,8 +30,6 @@ - -