qapi: Implement deprecated-output=hide for QMP command results
This policy suppresses deprecated bits in output, and thus permits
"testing the future". Implement it for QMP command results. Example:
when QEMU is run with -compat deprecated-output=hide, then
{"execute": "query-cpus-fast"}
yields
{"return": [{"thread-id": 9805, "props": {"core-id": 0, "thread-id": 0, "socket-id": 0}, "qom-path": "/machine/unattached/device[0]", "cpu-index": 0, "target": "x86_64"}]}
instead of
{"return": [{"arch": "x86", "thread-id": 22436, "props": {"core-id": 0, "thread-id": 0, "socket-id": 0}, "qom-path": "/machine/unattached/device[0]", "cpu-index": 0, "target": "x86_64"}]}
Note the suppression of deprecated member "arch".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210318155519.1224118-4-armbru@redhat.com>
This commit is contained in:
@@ -96,7 +96,7 @@ static void qmp_marshal_output_%(c_name)s(%(c_type)s ret_in,
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
v = qobject_output_visitor_new(ret_out);
|
||||
v = qobject_output_visitor_new_qmp(ret_out);
|
||||
if (visit_type_%(c_name)s(v, "unused", &ret_in, errp)) {
|
||||
visit_complete(v, ret_out);
|
||||
}
|
||||
@@ -251,9 +251,9 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor):
|
||||
visit = self._module_basename('qapi-visit', name)
|
||||
self._genc.add(mcgen('''
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/compat-policy.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qobject-output-visitor.h"
|
||||
#include "qapi/qobject-input-visitor.h"
|
||||
#include "qapi/dealloc-visitor.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
Reference in New Issue
Block a user