diff mbox series

[v5,4/4] qapi/monitor: only allow 'keep' SetPasswordAction for VNC and deprecate

Message ID 20211019155443.1447372-5-s.reiter@proxmox.com
State New
Headers show
Series VNC-related HMP/QMP fixes | expand

Commit Message

Stefan Reiter Oct. 19, 2021, 3:54 p.m. UTC
VNC only supports 'keep' here, enforce this via a seperate
SetPasswordActionVnc enum and mark the option 'deprecated' (as it is
useless with only one value possible).

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
 monitor/qmp-cmds.c |  5 -----
 qapi/ui.json       | 21 ++++++++++++++++++++-
 2 files changed, 20 insertions(+), 6 deletions(-)

Comments

Markus Armbruster Oct. 20, 2021, 7:32 a.m. UTC | #1
Stefan Reiter <s.reiter@proxmox.com> writes:

> VNC only supports 'keep' here, enforce this via a seperate
> SetPasswordActionVnc enum and mark the option 'deprecated' (as it is
> useless with only one value possible).
>
> Suggested-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
>  monitor/qmp-cmds.c |  5 -----
>  qapi/ui.json       | 21 ++++++++++++++++++++-
>  2 files changed, 20 insertions(+), 6 deletions(-)

Shouldn't we update docs/about/deprecated.rst?
diff mbox series

Patch

diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index b0630d00ab..cb229c01f8 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -182,11 +182,6 @@  void qmp_set_password(SetPasswordOptions *opts, Error **errp)
         rc = qemu_spice.set_passwd(opts->password, fail_if_connected,
                                    disconnect_if_connected);
     } else if (opts->protocol == DISPLAY_PROTOCOL_VNC) {
-        if (opts->u.vnc.connected != SET_PASSWORD_ACTION_KEEP) {
-            /* vnc supports "connected=keep" only */
-            error_setg(errp, QERR_INVALID_PARAMETER, "connected");
-            return;
-        }
         /* Note that setting an empty password will not disable login through
          * this interface. */
         rc = vnc_display_password(
diff --git a/qapi/ui.json b/qapi/ui.json
index 17939d0dda..70410bb633 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -38,6 +38,20 @@ 
 { 'enum': 'SetPasswordAction',
   'data': [ 'fail', 'disconnect', 'keep' ] }
 
+##
+# @SetPasswordActionVnc:
+#
+# See @SetPasswordAction. VNC only supports the keep action. 'connection'
+# should just be omitted for VNC, this is kept for backwards compatibility.
+#
+# @keep: maintain existing clients
+#
+# Since: 6.2
+#
+##
+{ 'enum': 'SetPasswordActionVnc',
+  'data': [ 'keep' ] }
+
 ##
 # @SetPasswordOptions:
 #
@@ -83,12 +97,17 @@ 
 # @connected: How to handle existing clients when changing the
 #             password.
 #
+# Features:
+# @deprecated: For VNC, @connected will always be 'keep', parameter should be
+#              omitted.
+#
 # Since: 6.2
 #
 ##
 { 'struct': 'SetPasswordOptionsVnc',
   'data': { '*display': 'str',
-            '*connected': 'SetPasswordAction' }}
+            '*connected': { 'type': 'SetPasswordActionVnc',
+                            'features': ['deprecated'] } } }
 
 ##
 # @set_password: