[libvirt] [PATCH 2/3] conf: add 'policy' attribute to graphics element for vnc
Ján Tomko
jtomko at redhat.com
Tue May 7 07:51:44 UTC 2013
On 05/06/2013 03:19 PM, Guannan Ren wrote:
> -vnc :5900,share=allow-exclusive
> allows clients to ask for exclusive access which is
> implemented by dropping other connections Connecting
> multiple clients in parallel requires all clients asking
> for a shared session (vncviewer: -shared switch)
>
> -vnc :5900,share=force-shared
> disables exclusive client access. Useful for shared
> desktop sessions, where you don't want someone forgetting
> specify -shared disconnect everybody else.
>
> -vnc :5900,share=ignore
> completely ignores the shared flag and allows everybody
> connect unconditionally
> ---
> src/conf/domain_conf.c | 28 ++++++++++++++++++++++++++++
> src/conf/domain_conf.h | 11 +++++++++++
> src/libvirt_private.syms | 2 ++
> 3 files changed, 41 insertions(+)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index fe97c02..eaa0b0e 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -7574,6 +7582,21 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
> VIR_FREE(autoport);
> }
>
> + if ((policy = virXMLPropString(node, "policy")) != NULL) {
> + int sharingPolicy =
> + virDomainGraphicsVNCDisplaySharingPolicyTypeFromString(policy);
> +
> + if (sharingPolicy < 0) {
> + virReportError(VIR_ERR_INTERNAL_ERROR,
I'd rather use VIR_ERR_CONFIG_UNSUPPORTED.
> + _("unknown vnc display sharing policy '%s'"), policy);
> + VIR_FREE(policy);
> + goto error;
> + } else {
> + def->data.vnc.sharingPolicy = sharingPolicy;
> + }
> + VIR_FREE(policy);
> + }
> +
> def->data.vnc.socket = virXMLPropString(node, "socket");
> def->data.vnc.keymap = virXMLPropString(node, "keymap");
>
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 21f7ce2..05137ca 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -1284,6 +1284,15 @@ struct _virDomainGraphicsAuthDef {
> int connected; /* action if connected */
> };
>
> +enum virDomainGraphicsVNCDisplaySharingPolicy {
> + VIR_DOMAIN_GRAPHICS_VNC_DISPLAY_DEFAULT = 0,
> + VIR_DOMAIN_GRAPHICS_VNC_DISPLAY_ALLOW_EXCLUSIVE,
> + VIR_DOMAIN_GRAPHICS_VNC_DISPLAY_FORCE_SHARED,
> + VIR_DOMAIN_GRAPHICS_VNC_DISPLAY_IGNORE,
> +
> + VIR_DOMAIN_GRAPHICS_VNC_DISPLAY_LAST
> +};
> +
s/DISPLAY/SHARING/
VIR_DOMAIN_GRAPHICS_VNC_SHARING_IGNORE seems less confusing to me than
VIR_DOMAIN_GRAPHICS_VNC_DISPLAY_IGNORE
Jan
More information about the libvir-list
mailing list