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:11 +0100
committerMarkus Armbruster <armbru@redhat.com>2021-03-19 15:43:33 +0100
commit91fa93e516d080d440ead2ad4f88960545bd5b2c (patch)
treee37234fb14c3cd0f5822b5e8355205ed0c3ccbd0 /qapi/qmp-dispatch.c
parent6dd75472d58d3d199eb5003a8d2ec2334c68f18f (diff)
downloadfocaccia-qemu-91fa93e516d080d440ead2ad4f88960545bd5b2c.tar.gz
focaccia-qemu-91fa93e516d080d440ead2ad4f88960545bd5b2c.zip
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>
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 f6a65f502d..f79db89b60 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-output-visitor.h"
 #include "sysemu/runstate.h"
 #include "qapi/qmp/qbool.h"
 #include "qemu/coroutine.h"
@@ -26,6 +27,14 @@
 
 CompatPolicy compat_policy;
 
+Visitor *qobject_output_visitor_new_qmp(QObject **result)
+{
+    Visitor *v = qobject_output_visitor_new(result);
+
+    qobject_output_visitor_set_policy(v, compat_policy.deprecated_output);
+    return v;
+}
+
 static QDict *qmp_dispatch_check_obj(QDict *dict, bool allow_oob,
                                      Error **errp)
 {