Re: [libvirt PATCH 1/3] conf: add support for VNC power control setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 16, 2021 at 14:08:50 +0000, Daniel Berrange wrote:
> The <graphics type="vnc" .... powerControl="on"/> option instructs the
> VNC server to enable an extension that lets the client perform a
> graceful shutdown, reboot and hard reset.
> 
> This is enabled by default since it cannot be assumed that the VNC
> client user has administrator rights over the guest OS. In the case
> where the VNC user is a guest administrator though, it is reasonable
> to allow direct power control host side too.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> ---
>  docs/formatdomain.rst         |  5 +++++
>  docs/schemas/domaincommon.rng |  5 +++++
>  src/conf/domain_conf.c        | 12 ++++++++++++
>  src/conf/domain_conf.h        |  1 +
>  4 files changed, 23 insertions(+)

[...]

A XML2XML test case would show that 'no' is useless in this impl, see
below.

> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 930eed60de..544ec1b2fa 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -1712,6 +1712,7 @@ struct _virDomainGraphicsDef {
>              char *keymap;
>              virDomainGraphicsAuthDef auth;
>              int sharePolicy;
> +            bool powerControl;

This is declared as bool.

>          } vnc;
>          struct {
>              char *display;



> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b731744f04..91933bf292 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c

[...]

> @@ -13206,6 +13207,13 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDefPtr def,
>          }
>      }
>  
> +    if (powerControl &&
> +        virStringParseYesNo(powerControl, &def->data.vnc.powerControl) < 0) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("cannot parse vnc power control '%s'"), powerControl);
> +        return -1;
> +    }
> +
>      def->data.vnc.keymap = virXMLPropString(node, "keymap");
>  
>      if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth,
> @@ -27148,6 +27156,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
>                                virDomainGraphicsVNCSharePolicyTypeToString(
>                                def->data.vnc.sharePolicy));
>  
> +        if (def->data.vnc.powerControl)
> +            virBufferAsprintf(buf, " powerControl='%s'",
> +                              def->data.vnc.powerControl ? "yes" : "no");

So this doesn't make much sense. You can't use 'no' since it will vanish
from the XML.

Did you want to use a Tristate?

> +
>          virDomainGraphicsAuthDefFormatAttr(buf, &def->data.vnc.auth, flags);
>          break;
>  
> -- 
> 2.29.2
> 




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux