From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
There is no keyboard working on PPC64 and PS2 mouse is only for PPC64
when graphics are enabled. It needs to add a USB keyboard and USB mouse for it.
This patch is to add a USB keyboard and USB mouse when graphics are enabled.
Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
---
src/qemu/qemu_domain.c | 23 +++++++++++++++++++++-
.../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 2 ++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a665061..7f4ff0e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -691,6 +691,8 @@ qemuDomainDefPostParse(virDomainDefPtr def,
bool addPCIRoot = false;
bool addPCIeRoot = false;
bool addDefaultMemballoon = true;
+ bool addDefaultUSBKBD = false;
+ bool addDefaultUSBMouse = false;
/* check for emulator and create a default one if needed */
if (!def->emulator &&
@@ -732,9 +734,14 @@ qemuDomainDefPostParse(virDomainDefPtr def,
addDefaultMemballoon = false;
break;
+ case VIR_ARCH_PPC64:
+ addPCIRoot = true;
+ addDefaultUSBKBD = true;
+ addDefaultUSBMouse = true;
+ break;
+
case VIR_ARCH_ALPHA:
case VIR_ARCH_PPC:
- case VIR_ARCH_PPC64:
case VIR_ARCH_PPCEMB:
case VIR_ARCH_SH4:
case VIR_ARCH_SH4EB:
@@ -787,6 +794,20 @@ qemuDomainDefPostParse(virDomainDefPtr def,
def->memballoon = memballoon;
}
+ if (addDefaultUSBKBD &&
+ def->ngraphics > 0 &&
+ virDomainDefMaybeAddInput(def,
+ VIR_DOMAIN_INPUT_TYPE_KBD,
+ VIR_DOMAIN_INPUT_BUS_USB) < 0)
+ return -1;
+
+ if (addDefaultUSBMouse &&
+ def->ngraphics > 0 &&
+ virDomainDefMaybeAddInput(def,
+ VIR_DOMAIN_INPUT_TYPE_MOUSE,
+ VIR_DOMAIN_INPUT_BUS_USB) < 0)
+ return -1;
+
return 0;
}
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml
b/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml
index 8dde776..64b70f3 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml
@@ -30,6 +30,8 @@
<controller type='usb' index='0'/>
<controller type='scsi' index='0'/>
<controller type='pci' index='0' model='pci-root'/>
+ <input type='keyboard' bus='usb'/>
+ <input type='mouse' bus='usb'/>
<graphics type='sdl'/>
<video>
<model type='cirrus' vram='9216' heads='1'/>
--
1.8.2.1