aboutsummaryrefslogtreecommitdiff
path: root/scripts
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 /scripts
parentd2032598c434fe385145ee6ea58007a19ef7e723 (diff)
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 'scripts')
-rw-r--r--scripts/qapi/commands.py3
-rw-r--r--scripts/qapi/visit.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
index c4628517ee..0e13d51054 100644
--- a/scripts/qapi/commands.py
+++ b/scripts/qapi/commands.py
@@ -154,7 +154,7 @@ def gen_marshal(name: str,
ret += mcgen('''
- v = qobject_input_visitor_new(QOBJECT(args));
+ v = qobject_input_visitor_new_qmp(QOBJECT(args));
if (!visit_start_struct(v, NULL, NULL, 0, errp)) {
goto out;
}
@@ -258,7 +258,6 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor):
#include "qapi/compat-policy.h"
#include "qapi/visitor.h"
#include "qapi/qmp/qdict.h"
-#include "qapi/qobject-input-visitor.h"
#include "qapi/dealloc-visitor.h"
#include "qapi/error.h"
#include "%(visit)s.h"
diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py
index 9d83bf650f..9e96f3c566 100644
--- a/scripts/qapi/visit.py
+++ b/scripts/qapi/visit.py
@@ -87,6 +87,9 @@ bool visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp)
indent.increase()
if deprecated:
ret += mcgen('''
+ if (!visit_deprecated_accept(v, "%(name)s", errp)) {
+ return false;
+ }
if (visit_deprecated(v, "%(name)s")) {
''',
name=memb.name)