diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2021-03-19 16:40:00 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2021-03-19 16:40:00 +0000 |
| commit | 2e1293cbaac75e84f541f9acfa8e26749f4c3562 (patch) | |
| tree | 0d59e90331072297512f782638e511a5dd25611d /qapi/qmp-dispatch.c | |
| parent | 8631a430e65ef73b3d8a297128be2ef3c7317b90 (diff) | |
| parent | dbb675c19aa6ca328f4449ccd1ff605f9cb744e9 (diff) | |
| download | focaccia-qemu-2e1293cbaac75e84f541f9acfa8e26749f4c3562.tar.gz focaccia-qemu-2e1293cbaac75e84f541f9acfa8e26749f4c3562.zip | |
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-03-16-v4' into staging
QAPI patches patches for 2021-03-16 # gpg: Signature made Fri 19 Mar 2021 15:06:52 GMT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2021-03-16-v4: qapi: New -compat deprecated-input=crash qapi: Implement deprecated-input=reject for QMP command arguments qapi: Implement deprecated-input=reject for QMP commands test-util-sockets: Add stub for monitor_set_cur() qapi: Implement deprecated-output=hide for QMP introspection monitor: Drop query-qmp-schema 'gen': false hack qapi: Implement deprecated-output=hide for QMP event data qapi: Implement deprecated-output=hide for QMP events qapi: Implement deprecated-output=hide for QMP command results qemu-options: New -compat to set policy for deprecated interfaces qemuutil: remove qemu_set_fd_handler duplicate symbol Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qapi/qmp-dispatch.c')
| -rw-r--r-- | qapi/qmp-dispatch.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 5e597c76f7..59600210ce 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -14,15 +14,36 @@ #include "qemu/osdep.h" #include "block/aio.h" +#include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qmp/dispatch.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qjson.h" +#include "qapi/qobject-input-visitor.h" +#include "qapi/qobject-output-visitor.h" #include "sysemu/runstate.h" #include "qapi/qmp/qbool.h" #include "qemu/coroutine.h" #include "qemu/main-loop.h" +CompatPolicy compat_policy; + +Visitor *qobject_input_visitor_new_qmp(QObject *obj) +{ + Visitor *v = qobject_input_visitor_new(obj); + + qobject_input_visitor_set_policy(v, compat_policy.deprecated_input); + return v; +} + +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) { @@ -155,6 +176,20 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request, "The command %s has not been found", command); goto out; } + if (cmd->options & QCO_DEPRECATED) { + switch (compat_policy.deprecated_input) { + case COMPAT_POLICY_INPUT_ACCEPT: + break; + case COMPAT_POLICY_INPUT_REJECT: + error_set(&err, ERROR_CLASS_COMMAND_NOT_FOUND, + "Deprecated command %s disabled by policy", + command); + goto out; + case COMPAT_POLICY_INPUT_CRASH: + default: + abort(); + } + } if (!cmd->enabled) { error_set(&err, ERROR_CLASS_COMMAND_NOT_FOUND, "Command %s has been disabled%s%s", |