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 <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Li Zhang 2014-02-17 18:17:54 +08:00 committed by Ján Tomko
parent bc18373391
commit b39275954b
3 changed files with 21 additions and 16 deletions

View 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++)

View 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,

View 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'/>