diff options
author | Markus Armbruster <armbru@redhat.com> | 2021-03-18 16:55:17 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2021-03-19 16:05:11 +0100 |
commit | d2032598c434fe385145ee6ea58007a19ef7e723 (patch) | |
tree | 7e3d84fc72da52b789ecd41a7c7bd13ebb00d228 /scripts | |
parent | 130d4824222cf062ed8ee3c5ab9fa2bd852b33b6 (diff) | |
download | qemu-d2032598c434fe385145ee6ea58007a19ef7e723.zip qemu-d2032598c434fe385145ee6ea58007a19ef7e723.tar.gz qemu-d2032598c434fe385145ee6ea58007a19ef7e723.tar.bz2 |
qapi: Implement deprecated-input=reject for QMP commands
This policy rejects deprecated input, and thus permits "testing the
future". Implement it for QMP commands: make deprecated ones fail.
Example: when QEMU is run with -compat deprecated-input=reject, then
{"execute": "query-cpus"}
fails like this
{"error": {"class": "CommandNotFound", "desc": "Deprecated command query-cpus disabled by policy"}}
When the deprecated command is removed, the error will change to
{"error": {"class": "CommandNotFound", "desc": "The command query-cpus has not been found"}}
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210318155519.1224118-10-armbru@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/qapi/commands.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index b7e577a..c462851 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -210,12 +210,16 @@ out: def gen_register_command(name: str, + features: List[QAPISchemaFeature], success_response: bool, allow_oob: bool, allow_preconfig: bool, coroutine: bool) -> str: options = [] + if 'deprecated' in [f.name for f in features]: + options += ['QCO_DEPRECATED'] + if not success_response: options += ['QCO_NO_SUCCESS_RESP'] if allow_oob: @@ -326,9 +330,9 @@ void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds) self._genc.add(gen_marshal(name, arg_type, boxed, ret_type)) with self._temp_module('./init'): with ifcontext(ifcond, self._genh, self._genc): - self._genc.add(gen_register_command(name, success_response, - allow_oob, allow_preconfig, - coroutine)) + self._genc.add(gen_register_command( + name, features, success_response, allow_oob, + allow_preconfig, coroutine)) def gen_commands(schema: QAPISchema, |