提交 b3927595 编写于 作者: L Li Zhang 提交者: Ján Tomko

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: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 bc183733
...@@ -7839,10 +7839,12 @@ virDomainInputDefParseXML(const virDomainDef *dom, ...@@ -7839,10 +7839,12 @@ virDomainInputDefParseXML(const virDomainDef *dom,
} else { } else {
if (STREQ(dom->os.type, "hvm")) { if (STREQ(dom->os.type, "hvm")) {
if ((def->type == VIR_DOMAIN_INPUT_TYPE_MOUSE || 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; def->bus = VIR_DOMAIN_INPUT_BUS_PS2;
else } else {
def->bus = VIR_DOMAIN_INPUT_BUS_USB; def->bus = VIR_DOMAIN_INPUT_BUS_USB;
}
} else { } else {
def->bus = VIR_DOMAIN_INPUT_BUS_XEN; def->bus = VIR_DOMAIN_INPUT_BUS_XEN;
} }
...@@ -12498,7 +12500,8 @@ virDomainDefParseXML(xmlDocPtr xml, ...@@ -12498,7 +12500,8 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(nodes); VIR_FREE(nodes);
/* If graphics are enabled, there's an implicit PS2 mouse */ /* 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; int input_bus = VIR_DOMAIN_INPUT_BUS_XEN;
if (STREQ(def->os.type, "hvm")) if (STREQ(def->os.type, "hvm"))
...@@ -17531,20 +17534,22 @@ virDomainDefFormatInternal(virDomainDefPtr def, ...@@ -17531,20 +17534,22 @@ virDomainDefFormatInternal(virDomainDefPtr def,
if (def->ngraphics > 0) { if (def->ngraphics > 0) {
/* If graphics is enabled, add the implicit mouse/keyboard */ /* If graphics is enabled, add the implicit mouse/keyboard */
virDomainInputDef autoInput = { if ((ARCH_IS_X86(def->os.arch)) || def->os.arch == VIR_ARCH_NONE) {
VIR_DOMAIN_INPUT_TYPE_MOUSE, virDomainInputDef autoInput = {
STREQ(def->os.type, "hvm") ? VIR_DOMAIN_INPUT_TYPE_MOUSE,
VIR_DOMAIN_INPUT_BUS_PS2 : VIR_DOMAIN_INPUT_BUS_XEN, STREQ(def->os.type, "hvm") ?
{ .alias = NULL }, 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) if (virDomainInputDefFormat(buf, &autoInput, flags) < 0)
goto error; 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++) for (n = 0; n < def->ngraphics; n++)
......
...@@ -70,6 +70,8 @@ typedef enum { ...@@ -70,6 +70,8 @@ typedef enum {
VIR_ARCH_LAST, VIR_ARCH_LAST,
} virArch; } virArch;
# define ARCH_IS_X86(arch) ((arch) == VIR_ARCH_X86_64 ||\
(arch) == VIR_ARCH_I686)
typedef enum { typedef enum {
VIR_ARCH_LITTLE_ENDIAN, VIR_ARCH_LITTLE_ENDIAN,
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
<controller type='usb' index='0'/> <controller type='usb' index='0'/>
<controller type='scsi' index='0'/> <controller type='scsi' index='0'/>
<controller type='pci' index='0' model='pci-root'/> <controller type='pci' index='0' model='pci-root'/>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='sdl'/> <graphics type='sdl'/>
<video> <video>
<model type='cirrus' vram='9216' heads='1'/> <model type='cirrus' vram='9216' heads='1'/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册