From 6dd75472d58d3d199eb5003a8d2ec2334c68f18f Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 18 Mar 2021 16:55:10 +0100 Subject: qemu-options: New -compat to set policy for deprecated interfaces New option -compat lets you configure what to do when deprecated interfaces get used. This is intended for testing users of the management interfaces. It is experimental. -compat deprecated-input= configures what to do when deprecated input is received. Input policy can be "accept" (accept silently), or "reject" (reject the request with an error). -compat deprecated-output= configures what to do when deprecated output is sent. Output policy can be "accept" (pass on unchanged), or "hide" (filter out the deprecated parts). Default is "accept". Policies other than "accept" are implemented later in this series. For now, -compat covers only syntactic aspects of QMP, i.e. stuff tagged with feature 'deprecated'. We may want to extend it to cover semantic aspects, CLI, and experimental features. Note that there is no good way for management application to detect presence of -compat: it's not visible output of query-qmp-schema or query-command-line-options. Tolerable, because it's meant for testing. If running with -compat fails, skip the test. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <20210318155519.1224118-3-armbru@redhat.com> --- qapi/compat.json | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ qapi/meson.build | 1 + qapi/qapi-schema.json | 1 + qapi/qmp-dispatch.c | 3 +++ 4 files changed, 56 insertions(+) create mode 100644 qapi/compat.json (limited to 'qapi') diff --git a/qapi/compat.json b/qapi/compat.json new file mode 100644 index 0000000..fc24a58 --- /dev/null +++ b/qapi/compat.json @@ -0,0 +1,51 @@ +# -*- Mode: Python -*- + +## +# = Compatibility policy +## + +## +# @CompatPolicyInput: +# +# Policy for handling "funny" input. +# +# @accept: Accept silently +# @reject: Reject with an error +# +# Since: 6.0 +## +{ 'enum': 'CompatPolicyInput', + 'data': [ 'accept', 'reject' ] } + +## +# @CompatPolicyOutput: +# +# Policy for handling "funny" output. +# +# @accept: Pass on unchanged +# @hide: Filter out +# +# Since: 6.0 +## +{ 'enum': 'CompatPolicyOutput', + 'data': [ 'accept', 'hide' ] } + +## +# @CompatPolicy: +# +# Policy for handling deprecated management interfaces. +# +# This is intended for testing users of the management interfaces. +# +# Limitation: covers only syntactic aspects of QMP, i.e. stuff tagged +# with feature 'deprecated'. We may want to extend it to cover +# semantic aspects, CLI, and experimental features. +# +# @deprecated-input: how to handle deprecated input (default 'accept') +# @deprecated-output: how to handle deprecated output (default 'accept') +# +# Since: 6.0 +## +{ 'struct': 'CompatPolicy', + 'data': { '*deprecated-input': 'CompatPolicyInput', + '*deprecated-output': 'CompatPolicyOutput' } } diff --git a/qapi/meson.build b/qapi/meson.build index d4424ae..0d20226 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -25,6 +25,7 @@ qapi_all_modules = [ 'block-export', 'char', 'common', + 'compat', 'control', 'crypto', 'dump', diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index 3441c9a..4912b97 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -79,6 +79,7 @@ { 'include': 'migration.json' } { 'include': 'transaction.json' } { 'include': 'trace.json' } +{ 'include': 'compat.json' } { 'include': 'control.json' } { 'include': 'introspect.json' } { 'include': 'qom.json' } diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 5e597c7..f6a65f5 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -14,6 +14,7 @@ #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" @@ -23,6 +24,8 @@ #include "qemu/coroutine.h" #include "qemu/main-loop.h" +CompatPolicy compat_policy; + static QDict *qmp_dispatch_check_obj(QDict *dict, bool allow_oob, Error **errp) { -- cgit v1.1