qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Zihao Chang <changzihao1@huawei.com>
Cc: oscar.zhangbo@huawei.com, qemu-devel@nongnu.org,
	xiexiangyou@huawei.com, armbru@redhat.com,
	yebiaoxiang@huawei.com, kraxel@redhat.com
Subject: Re: [PATCH v5 3/3] qmp: add new qmp display-reload
Date: Thu, 11 Mar 2021 11:18:15 +0000	[thread overview]
Message-ID: <YEn8d+9v52q+2NLF@redhat.com> (raw)
In-Reply-To: <20210311105424.1370-4-changzihao1@huawei.com>

On Thu, Mar 11, 2021 at 06:54:24PM +0800, Zihao Chang wrote:
> This patch provides a new qmp to reload display configuration
> without restart VM, but only reloading the vnc tls certificates
> is implemented.
> Example:
> {"execute": "display-reload", "arguments":{"vnc-tls-certs": true}}
> 
> Signed-off-by: Zihao Chang <changzihao1@huawei.com>
> ---
>  monitor/qmp-cmds.c | 13 +++++++++++++
>  qapi/ui.json       | 19 +++++++++++++++++++
>  2 files changed, 32 insertions(+)
> 
> diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
> index c7df8c0ee268..0f791f974f30 100644
> --- a/monitor/qmp-cmds.c
> +++ b/monitor/qmp-cmds.c
> @@ -334,3 +334,16 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp)
>  
>      return mem_info;
>  }
> +
> +void qmp_display_reload(bool has_vnc_tls_certs, bool vnc_tls_certs,
> +                        Error **errp)
> +{
> +    Error *local_err = NULL;
> +
> +    if (has_vnc_tls_certs && vnc_tls_certs) {
> +        if (!vnc_display_reload_certs(NULL, &local_err)) {
> +            error_propagate(errp, local_err);
> +            return;
> +        }
> +    }
> +}
> diff --git a/qapi/ui.json b/qapi/ui.json
> index d08d72b43923..97b38aa1666e 100644
> --- a/qapi/ui.json
> +++ b/qapi/ui.json
> @@ -1179,3 +1179,22 @@
>  ##
>  { 'command': 'query-display-options',
>    'returns': 'DisplayOptions' }
> +
> +##
> +# @display-reload:
> +#
> +# Reload display configuration
> +#
> +# Returns: Nothing on success
> +#
> +# Since: 6.0
> +#
> +# Example:
> +#
> +# -> { "execute": "display-reload",
> +#      "arguments": { "vnc-tls-certs": true } }
> +# <- { "return": {} }
> +#
> +##
> +{ 'command': 'display-reload',
> +  'data': { '*vnc-tls-certs': 'bool' } }

I think best practice would be to make this a  discriminated union
Something like this:

   { 'enum': 'DisplayReloadType',
     'data': ['vnc'] }

   { 'struct': 'DisplayReloadOptionsVNC',
     'data': { '*tls-certs': 'bool' } }

   { 'union': 'DisplayReloadOptions',
     'base': {'type': 'DisplayReloadType'},
     'discriminator': 'type',
     'data': { 'vnc': 'DisplayReloadOptionsVNC' }}

   { 'command': 'display-reload',
     'data': 'DisplayReloadOptions' }


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



      reply	other threads:[~2021-03-11 11:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 10:54 [PATCH v5 0/3] vnc: support reload x509 certificates Zihao Chang
2021-03-11 10:54 ` [PATCH v5 1/3] crypto: add reload for QCryptoTLSCredsClass Zihao Chang
2021-03-11 11:12   ` Daniel P. Berrangé
2021-03-11 10:54 ` [PATCH v5 2/3] vnc: support reload x509 certificates for vnc Zihao Chang
2021-03-11 11:13   ` Daniel P. Berrangé
2021-03-11 10:54 ` [PATCH v5 3/3] qmp: add new qmp display-reload Zihao Chang
2021-03-11 11:18   ` Daniel P. Berrangé [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YEn8d+9v52q+2NLF@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=changzihao1@huawei.com \
    --cc=kraxel@redhat.com \
    --cc=oscar.zhangbo@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xiexiangyou@huawei.com \
    --cc=yebiaoxiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).