[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 3/3] qmp: add new qmp display-reload
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v6 3/3] qmp: add new qmp display-reload |
Date: |
Fri, 12 Mar 2021 17:21:33 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Zihao Chang <changzihao1@huawei.com> writes:
> 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":{"type": "vnc", "tls-certs": true}}
>
> Signed-off-by: Zihao Chang <changzihao1@huawei.com>
> ---
> monitor/qmp-cmds.c | 15 +++++++++++
> qapi/ui.json | 62 ++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 77 insertions(+)
>
> diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
> index c7df8c0ee268..cd5bc477345e 100644
> --- a/monitor/qmp-cmds.c
> +++ b/monitor/qmp-cmds.c
> @@ -334,3 +334,18 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp)
>
> return mem_info;
> }
> +
> +void qmp_display_reload(DisplayReloadOptions *arg, Error **errp)
> +{
> + switch (arg->type) {
> + case DISPLAY_RELOAD_TYPE_VNC:
> + if (arg->u.vnc.has_tls_certs && arg->u.vnc.tls_certs) {
> + vnc_display_reload_certs(NULL, errp);
> + }
> + break;
> +
> + default:
> + error_setg(errp, "unsupported DisplayReloadType");
> +
Misuse of error_setg() for a programming error. Use abort().
> + }
> +}
> diff --git a/qapi/ui.json b/qapi/ui.json
> index d08d72b43923..298267bf96d2 100644
> --- a/qapi/ui.json
> +++ b/qapi/ui.json
> @@ -1179,3 +1179,65 @@
> ##
> { 'command': 'query-display-options',
> 'returns': 'DisplayOptions' }
> +
> +##
> +# @DisplayReloadType:
> +#
> +# Available DisplayReload types.
> +#
> +# @vnc: VNC display
> +#
> +# Since: 6.0
> +#
> +##
> +{ 'enum': 'DisplayReloadType',
> + 'data': ['vnc'] }
> +
> +##
> +# @DisplayReloadOptionsVNC:
> +#
> +# Specify the VNC reload options.
> +#
> +# @tls-certs: reload tls certs or not.
> +#
> +# Since: 6.0
> +#
> +##
> +{ 'struct': 'DisplayReloadOptionsVNC',
> + 'data': { '*tls-certs': 'bool' } }
> +
> +##
> +# @DisplayReloadOptions:
> +#
> +# Options of the display configuration reload.
> +#
> +# @type: Specify the display type.
> +#
> +# Since: 6.0
> +#
> +##
> +{ 'union': 'DisplayReloadOptions',
> + 'base': {'type': 'DisplayReloadType'},
> + 'discriminator': 'type',
> + 'data': { 'vnc': 'DisplayReloadOptionsVNC' }}
> +
> +##
> +# @display-reload:
> +#
> +# Reload display configuration.
> +#
> +# Returns: Nothing on success.
> +#
> +# Since: 6.0
> +#
> +# Example:
> +#
> +# -> { "execute": "display-reload",
> +# "arguments": { "type": "vnc", "tls-certs": true } }
> +# <- { "return": {} }
> +#
> +##
> +{ 'command': 'display-reload',
> + 'data': 'DisplayReloadOptions',
> + 'boxed' : true }
> +
Trim the blank line at the end of the file, please.
With these tidied up:
Acked-by: Markus Armbruster <armbru@redhat.com>