summary refs log tree commit diff stats
path: root/qapi/qmp-dispatch.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2021-03-18 16:55:18 +0100
committerMarkus Armbruster <armbru@redhat.com>2021-03-19 16:05:11 +0100
commitdb29164103e53ae7c112086127e3d1c92b1d4d89 (patch)
tree97d0238e1d19d87ee0ca9dbc09e3dd46a1a93eda /qapi/qmp-dispatch.c
parentd2032598c434fe385145ee6ea58007a19ef7e723 (diff)
downloadfocaccia-qemu-db29164103e53ae7c112086127e3d1c92b1d4d89.tar.gz
focaccia-qemu-db29164103e53ae7c112086127e3d1c92b1d4d89.zip
qapi: Implement deprecated-input=reject for QMP command arguments
This policy rejects deprecated input, and thus permits "testing the
future".  Implement it for QMP command arguments: reject commands with
deprecated ones.  Example: when QEMU is run with -compat
deprecated-input=reject, then

    {"execute": "eject", "arguments": {"device": "cd"}}

fails like this

    {"error": {"class": "GenericError", "desc": "Deprecated parameter 'device' disabled by policy"}}

When the deprecated parameter is removed, the error will change to

    {"error": {"class": "GenericError", "desc": "Parameter 'device' is unexpected"}}

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210318155519.1224118-11-armbru@redhat.com>
Diffstat (limited to 'qapi/qmp-dispatch.c')
-rw-r--r--qapi/qmp-dispatch.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index bcb790d876..797df33be4 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -19,6 +19,7 @@
 #include "qapi/qmp/dispatch.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qjson.h"
+#include "qapi/qobject-input-visitor.h"
 #include "qapi/qobject-output-visitor.h"
 #include "sysemu/runstate.h"
 #include "qapi/qmp/qbool.h"
@@ -27,6 +28,14 @@
 
 CompatPolicy compat_policy;
 
+Visitor *qobject_input_visitor_new_qmp(QObject *obj)
+{
+    Visitor *v = qobject_input_visitor_new(obj);
+
+    qobject_input_visitor_set_policy(v, compat_policy.deprecated_input);
+    return v;
+}
+
 Visitor *qobject_output_visitor_new_qmp(QObject **result)
 {
     Visitor *v = qobject_output_visitor_new(result);