On 2014年02月03日 23:09, Ján Tomko wrote:
On 12/19/2013 08:50 AM, Li Zhang wrote:
From: Li Zhang <zhlcindy@xxxxxxxxxxxxxxxxxx>
This patch is to format qemu command line and xen driver for USB keyboard
and add test cases for it.
Signed-off-by: Li Zhang <zhlcindy@xxxxxxxxxxxxxxxxxx>
---
src/qemu/qemu_command.c | 41 ++++++++++++++++------
src/xenxs/xen_sxpr.c | 27 +++++++++-----
src/xenxs/xen_xm.c | 30 +++++++++++-----
.../qemuxml2argv-pseries-usb-kbd.args | 9 +++++
.../qemuxml2argv-pseries-usb-kbd.xml | 19 ++++++++++
tests/qemuxml2argvtest.c | 3 ++
6 files changed, 103 insertions(+), 26 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-kbd.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-kbd.xml
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 5e89876..9e19bb7 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -886,14 +886,18 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto cleanup;
if (str &&
(STREQ(str, "tablet") ||
- STREQ(str, "mouse"))) {
+ STREQ(str, "mouse") ||
+ STREQ(str, "kbd"))) {
virDomainInputDefPtr input;
if (VIR_ALLOC(input) < 0)
goto cleanup;
input->bus = VIR_DOMAIN_INPUT_BUS_USB;
- input->type = STREQ(str, "tablet") ?
- VIR_DOMAIN_INPUT_TYPE_TABLET :
- VIR_DOMAIN_INPUT_TYPE_MOUSE;
+ if (STREQ(str, "mouse"))
+ input->type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
+ else if (STREQ(str, "tablet"))
+ input->type = VIR_DOMAIN_INPUT_TYPE_TABLET;
+ else (STREQ(str, "kbd"))
+ input->type = VIR_DOMAIN_INPUT_TYPE_KBD;
if (VIR_ALLOC_N(def->inputs, 1) < 0) {
virDomainInputDefFree(input);
goto cleanup;
@@ -1746,10 +1750,20 @@ virConfPtr xenFormatXM(virConnectPtr conn,
if (def->inputs[i]->bus == VIR_DOMAIN_INPUT_BUS_USB) {
if (xenXMConfigSetInt(conf, "usb", 1) < 0)
goto cleanup;
- if (xenXMConfigSetString(conf, "usbdevice",
- def->inputs[i]->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ?
- "mouse" : "tablet") < 0)
- goto cleanup;
+ switch (def->inputs[i]->type) {
+ case VIR_DOMAIN_INPUT_TYPE_MOUSE:
+ if (xenXMConfigSetString(conf, "usbdevice", "mouse") < 0)
+ goto cleanup;
+ break;
+ case VIR_DOMAIN_INPUT_TYPE_TABLET:
+ if (xenXMConfigSetString(conf, "usbdevice", "tablet") < 0)
+ goto cleanup;
+ break;
+ case VIR_DOMAIN_INPUT_TYPE_KBD:
+ if (xenXMConfigSetString(conf, "usbdevice", "kbd") < 0)
+ goto cleanup;
+ break;
+ }
break;
}
}
I'm not familiar with the xen driver, but I'd feel safer just ignoring the
implicit USB keyboard. I think they should also be in a separate commit.
I'm not familiar with it either. I just added it according to Dan's
comments.
Jan
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list