[libvirt] [PATCH 1/3] qemu: new vnc display sharing policy caps flag

Ján Tomko jtomko at redhat.com
Tue May 7 07:51:40 UTC 2013


On 05/06/2013 03:19 PM, Guannan Ren wrote:
> QEMU_CAPS_VNC_DISPLAY_POLICY (qemu >= v1.10)
> ---
>  docs/formatdomain.html.in     | 13 +++++++++++--
>  docs/schemas/domaincommon.rng |  9 +++++++++
>  src/qemu/qemu_capabilities.c  | 12 ++++++++----
>  src/qemu/qemu_capabilities.h  |  1 +
>  tests/qemuhelptest.c          |  9 ++++++---
>  5 files changed, 35 insertions(+), 9 deletions(-)
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 572d7ee..50aa2db 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -3493,7 +3493,7 @@ qemu-kvm -net nic,model=? /dev/null
>    ...
>    <devices>
>      <graphics type='sdl' display=':0.0'/>
> -    <graphics type='vnc' port='5904'>
> +    <graphics type='vnc' port='5904' policy='allow-exclusive'>
>        <listen type='address' address='1.2.3.4'/>
>      </graphics>
>      <graphics type='rdp' autoport='yes' multiUser='yes' />
> @@ -3536,7 +3536,16 @@ qemu-kvm -net nic,model=? /dev/null
>              allows control of connected client during password changes.
>              VNC accepts <code>keep</code> value only.
>              <span class="since">since 0.9.3</span>
> -            NB, this may not be supported by all hypervisors.<br/>  <br/>
> +            NB, this may not be supported by all hypervisors.<br/>
> +            The optional <code>policy</code> attribute specifies vnc server
> +            display sharing policy. "allow-exclusive" allows clients to ask
> +            for exclusive access by dropping other connections. Connecting
> +            multiple clients in parallel requires all clients asking for a
> +            shared session (vncviewer: -Shared switch). This is the default
> +            value. "force-shared" disables exclusive client access, every
> +            connection has to specify -Shared switch for vncviewer. "ignore"
> +            welcomes every connection unconditionally
> +            <span class="since">since 1.0.6</span>. <br/> <br/>
>              Rather than using listen/port, QEMU supports a
>              <code>socket</code> attribute for listening on a unix
>              domain socket path.<span class="since">Since 0.8.8</span>
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 10596dc..c3a7fbd 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -2075,6 +2075,15 @@
>                    <ref name="addrIPorName"/>
>                  </attribute>
>                </optional>
> +              <optional>
> +                <attribute name='policy'>
> +                  <choice>
> +                    <value>allow-exclusive</value>
> +                    <value>force-shared</value>
> +                    <value>ignore</value>
> +                  </choice>
> +                </attribute>
> +              </optional>
>              </group>
>              <group>
>                <optional>

These two hunks seem like they would fit better in the later patches.
And naming the attribute 'sharingPolicy' or just 'sharing' might be more clear.

> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index a3a8d1f..d758691 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -221,9 +221,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
>                "tpm-tis",
>  
>                "nvram",  /* 140 */
> -              "pci-bridge", /* 141 */
> -              "vfio-pci", /* 142 */
> -              "vfio-pci.bootindex", /* 143 */
> +              "pci-bridge",
> +              "vfio-pci",
> +              "vfio-pci.bootindex",
> +              "vnc-display-policy",
>      );
>  

Oops, I seem to have started a trend when I forgot to delete that comment
after rebase :)

>  struct _virQEMUCaps {
> @@ -1181,8 +1182,10 @@ virQEMUCapsComputeCmdFlags(const char *help,
>      if (version >= 11000)
>          virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST);
>  
> -    if (version >= 1001000)
> +    if (version >= 1001000) {
>          virQEMUCapsSet(qemuCaps, QEMU_CAPS_IPV6_MIGRATION);
> +        virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_DISPLAY_POLICY);
> +    }
>  
>      if (version >= 1002000)
>          virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);

Is there a help string we could look for instead of setting it based on version?

> diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
> index 213f63c..ec39325 100644
> --- a/src/qemu/qemu_capabilities.h
> +++ b/src/qemu/qemu_capabilities.h
> @@ -182,6 +182,7 @@ enum virQEMUCapsFlags {
>      QEMU_CAPS_DEVICE_PCI_BRIDGE  = 141, /* -device pci-bridge */
>      QEMU_CAPS_DEVICE_VFIO_PCI    = 142, /* -device vfio-pci */
>      QEMU_CAPS_VFIO_PCI_BOOTINDEX = 143, /* bootindex param for vfio-pci device */
> +    QEMU_CAPS_VNC_DISPLAY_POLICY = 144, /* set display sharing policy */
>  
>      QEMU_CAPS_LAST,                   /* this must always be the last item */
>  };

IMHO VNC_SHARING_POLICY would be more fitting.

Jan




More information about the libvir-list mailing list