[libvirt] [PATCH v6 3/6] conf: Remove the implicit PS2 mouse for non-X86 platforms and add an implicit PS2 keyboard device for X86 platforms.

Ján Tomko jtomko at redhat.com
Thu Feb 13 12:37:07 UTC 2014


On 02/13/2014 09:48 AM, Li Zhang wrote:
> From: Li Zhang <zhlcindy at linux.vnet.ibm.com>
> 
> PS2 device only works for X86 platform, other platforms may need
> USB mouse. Athough it doesn't influence the QEMU command line, but
> it's not right to add one PS2 mouse for non-X86 platform.
> 
> What's more, PS2 keyboard can be supported for X86.
> 
> So, this patch is to remove PS2 mouse for non-x86 platforms and also add
> an implicit PS2 keyboard device for X86.
> 
> Signed-off-by: Li Zhang <zhlcindy at linux.vnet.ibm.com>
> ---
>  src/conf/domain_conf.c                             | 70 +++++++++++-----------
>  src/util/virarch.h                                 |  2 +
>  .../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml |  1 -
>  3 files changed, 37 insertions(+), 36 deletions(-)

> @@ -17525,16 +17524,17 @@ virDomainDefFormatInternal(virDomainDefPtr def,
>      }
>  
>      if (def->ngraphics > 0) {
> -        /* If graphics is enabled, add the implicit mouse */
> -        virDomainInputDef autoInput = {
> -            VIR_DOMAIN_INPUT_TYPE_MOUSE,
> -            STREQ(def->os.type, "hvm") ?
> -            VIR_DOMAIN_INPUT_BUS_PS2 : VIR_DOMAIN_INPUT_BUS_XEN,
> -            { .alias = NULL },
> -        };
> -
> -        if (virDomainInputDefFormat(buf, &autoInput, flags) < 0)
> -            goto error;
> +        /* If graphics is enabled, add the implicit mouse/keyboard */

Just mouse.

> +        if (ARCH_IS_X86(def->os.arch)) {

This fails 'make check' in 'sexpr2xmltest'. It seems arch is set to 'NONE'
when we convert xen s-expression to our XML.

I think we should add these for VIR_ARCH_NONE as well.

> +            virDomainInputDef autoInput = {
> +                VIR_DOMAIN_INPUT_TYPE_MOUSE,
> +                STREQ(def->os.type, "hvm") ?
> +                VIR_DOMAIN_INPUT_BUS_PS2 : VIR_DOMAIN_INPUT_BUS_XEN,
> +                { .alias = NULL },
> +            };
> +            if (virDomainInputDefFormat(buf, &autoInput, flags) < 0)
> +                goto error;
> +        }
>  
>          for (n = 0; n < def->ngraphics; n++)
>              if (virDomainGraphicsDefFormat(buf, def->graphics[n], flags) < 0)
> diff --git a/src/util/virarch.h b/src/util/virarch.h
> index b180400..9b66e43 100644
> --- a/src/util/virarch.h
> +++ b/src/util/virarch.h
> @@ -70,6 +70,8 @@ typedef enum {
>      VIR_ARCH_LAST,
>  } virArch;
>  
> +#define ARCH_IS_X86(arch)  ((arch) == VIR_ARCH_X86_64 ||\
> +                            (arch) == VIR_ARCH_I686)

This fails 'make syntax-check':
cppi: src/util/virarch.h: line 73: not properly indented

There should be a space between # and define, see:
http://libvirt.org/hacking.html#preprocessor

Other than that, this patch looks okay to me.

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140213/0586b939/attachment-0001.sig>


More information about the libvir-list mailing list