From 0425d773b3fa0da62be489ae6c76d1805f28f388 Mon Sep 17 00:00:00 2001 From: boringandboring Date: Mon, 27 Nov 2023 15:47:21 +0800 Subject: [PATCH] ui/qmp-cmds: Improve two error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cherry picked from 517b0220efd421acf885eed109571a61e95b192a set_password with "protocol": "vnc" supports only "connected": "keep". Any other value is rejected with Invalid parameter 'connected' Improve this to parameter 'connected' must be 'keep' when 'protocol' is 'vnc' client_migrate_info requires "port" or "tls-port". When both are missing, it fails with Parameter 'port/tls-port' is missing Improve this to parameter 'port' or 'tls-port' is required Signed-off-by: Markus Armbruster Message-ID: <20231031111059.3407803-5-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: boringandboring --- monitor/misc.c | 2 +- monitor/qmp-cmds.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/monitor/misc.c b/monitor/misc.c index a3a6e47844..25a23e2290 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -397,7 +397,7 @@ void qmp_client_migrate_info(const char *protocol, const char *hostname, } if (!has_port && !has_tls_port) { - error_setg(errp, QERR_MISSING_PARAMETER, "port/tls-port"); + error_setg(errp, "parameter 'port' or 'tls-port' is required"); return; } diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index d71beace6a..b44cca8234 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -199,7 +199,8 @@ void qmp_set_password(const char *protocol, const char *password, } else if (strcmp(protocol, "vnc") == 0) { if (fail_if_connected || disconnect_if_connected) { /* vnc supports "connected=keep" only */ - error_setg(errp, QERR_INVALID_PARAMETER, "connected"); + error_setg(errp, "parameter 'connected' must be 'keep'" + " when 'protocol' is 'vnc'"); return; } /* Note that setting an empty password will not disable login through -- 2.27.0