[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 3/3] qmp: add new qmp display-reload
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH v5 3/3] qmp: add new qmp display-reload |
Date: |
Thu, 11 Mar 2021 11:18:15 +0000 |
User-agent: |
Mutt/2.0.5 (2021-01-21) |
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 :|