mirror of
https://github.com/mii443/qemu.git
synced 2025-08-31 03:19:27 +00:00
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>
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user