[libvirt] [PATCH v6 1/6] conf: Add a keyboard input device type

Daniel P. Berrange berrange at redhat.com
Thu Feb 13 16:39:56 UTC 2014


On Thu, Feb 13, 2014 at 04:48:21PM +0800, Li Zhang wrote:

> @@ -12422,10 +12426,12 @@ virDomainDefParseXML(xmlDocPtr xml,
>           * XXX will this be true for other virt types ? */
>          if ((STREQ(def->os.type, "hvm") &&
>               input->bus == VIR_DOMAIN_INPUT_BUS_PS2 &&
> -             input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE) ||
> +             (input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
> +              input->type == VIR_DOMAIN_INPUT_TYPE_KBD)) ||
>              (STRNEQ(def->os.type, "hvm") &&
>               input->bus == VIR_DOMAIN_INPUT_BUS_XEN &&
> -             input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE)) {
> +             (input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
> +              input->type == VIR_DOMAIN_INPUT_TYPE_KBD))) {
>              virDomainInputDefFree(input);
>              continue;

Later on in this function there is

    /* If graphics are enabled, there's an implicit PS2 mouse */
    if (def->ngraphics > 0) {
        virDomainInputDefPtr input;

        if (VIR_ALLOC(input) < 0) {
            goto error;
        }
        if (STREQ(def->os.type, "hvm")) {
            input->type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
            input->bus = VIR_DOMAIN_INPUT_BUS_PS2;
        } else {
            input->type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
            input->bus = VIR_DOMAIN_INPUT_BUS_XEN;
        }

        if (VIR_REALLOC_N(def->inputs, def->ninputs + 1) < 0) {
            virDomainInputDefFree(input);
            goto error;
        }
        def->inputs[def->ninputs] = input;
        def->ninputs++;
    }


which needs to take care of keyboards too now.

And some more similar logic in virDomainDefFormatInternal
which needs updating

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list