From bebdfafb2b5a0f70713ec94b61f3c6d0200db6cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 13 Nov 2015 11:37:12 +0100 Subject: [PATCH] conf: parse and format virtio input bus in domain XML To be used by the family of virtio input devices: https://bugzilla.redhat.com/show_bug.cgi?id=1231114 --- docs/formatdomain.html.in | 6 ++++- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 6 +++-- src/conf/domain_conf.h | 1 + .../qemuxml2argv-virtio-input.xml | 26 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-input.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 0e0490e8f6..df54ad3d02 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4801,6 +4801,9 @@ qemu-kvm -net nic,model=? /dev/null <devices> <input type='mouse' bus='usb'/> <input type='keyboard' bus='usb'/> + <input type='mouse' bus='virtio'/> + <input type='keyboard' bus='virtio'/> + <input type='tablet' bus='virtio'/> </devices> ... @@ -4812,7 +4815,8 @@ qemu-kvm -net nic,model=? /dev/null The tablet provides absolute cursor movement, while the mouse uses relative movement. The optional bus attribute can be used to refine the exact device type. - It takes values "xen" (paravirtualized), "ps2" and "usb". + It takes values "xen" (paravirtualized), "ps2" and "usb" or + (since 1.3.0) "virtio".

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 284a7e4d6e..6d71199b17 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3592,6 +3592,7 @@ ps2 usb xen + virtio diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index cbfc41e5ff..12b3769ce9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -550,7 +550,8 @@ VIR_ENUM_IMPL(virDomainInputBus, VIR_DOMAIN_INPUT_BUS_LAST, "ps2", "usb", "xen", - "parallels") + "parallels", + "virtio") VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST, "sdl", @@ -22399,7 +22400,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, goto error; for (n = 0; n < def->ninputs; n++) - if (def->inputs[n]->bus == VIR_DOMAIN_INPUT_BUS_USB && + if ((def->inputs[n]->bus == VIR_DOMAIN_INPUT_BUS_USB || + def->inputs[n]->bus == VIR_DOMAIN_INPUT_BUS_VIRTIO) && virDomainInputDefFormat(buf, def->inputs[n], flags) < 0) goto error; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c2b7602ac8..6d2ca55b85 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1297,6 +1297,7 @@ typedef enum { VIR_DOMAIN_INPUT_BUS_USB, VIR_DOMAIN_INPUT_BUS_XEN, VIR_DOMAIN_INPUT_BUS_PARALLELS, /* pseudo device for VNC in containers */ + VIR_DOMAIN_INPUT_BUS_VIRTIO, VIR_DOMAIN_INPUT_BUS_LAST } virDomainInputBus; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-input.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-input.xml new file mode 100644 index 0000000000..11fb5666ee --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-input.xml @@ -0,0 +1,26 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + +

+ + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index cabec61478..4b2cff7aaf 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -632,6 +632,7 @@ mymain(void) DO_TEST("video-virtio-gpu-device"); DO_TEST("video-virtio-gpu-virgl"); + DO_TEST("virtio-input"); qemuTestDriverFree(&driver); -- GitLab