From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: mdroth@linux.vnet.ibm.com
Subject: [PATCH v3 27/34] qemu-options: New -compat to set policy for deprecated interfaces
Date: Sun, 15 Mar 2020 15:46:46 +0100 [thread overview]
Message-ID: <20200315144653.22660-28-armbru@redhat.com> (raw)
In-Reply-To: <20200315144653.22660-1-armbru@redhat.com>
Policy is separate for input and output.
Input policy can be "accept" (accept silently), or "reject" (reject
the request with an error).
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.
The option is experimental.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
qapi/compat.json | 51 ++++++++++++++++++++++++++++++++++++
qapi/qapi-schema.json | 1 +
include/qapi/compat-policy.h | 20 ++++++++++++++
qapi/qmp-dispatch.c | 3 +++
softmmu/vl.c | 17 ++++++++++++
qapi/Makefile.objs | 8 +++---
qemu-options.hx | 20 ++++++++++++++
7 files changed, 116 insertions(+), 4 deletions(-)
create mode 100644 qapi/compat.json
create mode 100644 include/qapi/compat-policy.h
diff --git a/qapi/compat.json b/qapi/compat.json
new file mode 100644
index 0000000000..fd6f8e932c
--- /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: 5.0
+##
+{ 'enum': 'CompatPolicyInput',
+ 'data': [ 'accept', 'reject' ] }
+
+##
+# @CompatPolicyOutput:
+#
+# Policy for handling "funny" output.
+#
+# @accept: Pass on unchanged
+# @hide: Filter out
+#
+# Since: 5.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: 5.0
+##
+{ 'struct': 'CompatPolicy',
+ 'data': { '*deprecated-input': 'CompatPolicyInput',
+ '*deprecated-output': 'CompatPolicyOutput' } }
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 43b0ba0dea..f575b76d81 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -75,6 +75,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/include/qapi/compat-policy.h b/include/qapi/compat-policy.h
new file mode 100644
index 0000000000..8efb2c58aa
--- /dev/null
+++ b/include/qapi/compat-policy.h
@@ -0,0 +1,20 @@
+/*
+ * Policy for handling "funny" management interfaces
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * Authors:
+ * Markus Armbruster <armbru@redhat.com>,
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * later. See the COPYING file in the top-level directory.
+ */
+
+#ifndef QAPI_COMPAT_POLICY_H
+#define QAPI_COMPAT_POLICY_H
+
+#include "qapi/qapi-types-compat.h"
+
+extern CompatPolicy compat_policy;
+
+#endif
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index fb53687ce9..80beab517f 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -12,6 +12,7 @@
*/
#include "qemu/osdep.h"
+#include "qapi/compat-policy.h"
#include "qapi/error.h"
#include "qapi/qmp/dispatch.h"
#include "qapi/qmp/qdict.h"
@@ -19,6 +20,8 @@
#include "sysemu/runstate.h"
#include "qapi/qmp/qbool.h"
+CompatPolicy compat_policy;
+
static QDict *qmp_dispatch_check_obj(const QObject *request, bool allow_oob,
QObject **id, Error **errp)
{
diff --git a/softmmu/vl.c b/softmmu/vl.c
index ff2685dff8..74eb43d114 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -27,6 +27,7 @@
#include "qemu/units.h"
#include "hw/boards.h"
#include "hw/qdev-properties.h"
+#include "qapi/compat-policy.h"
#include "qapi/error.h"
#include "qemu-version.h"
#include "qemu/cutils.h"
@@ -105,6 +106,7 @@
#include "sysemu/replay.h"
#include "qapi/qapi-events-run-state.h"
#include "qapi/qapi-visit-block-core.h"
+#include "qapi/qapi-visit-compat.h"
#include "qapi/qapi-visit-ui.h"
#include "qapi/qapi-commands-block-core.h"
#include "qapi/qapi-commands-run-state.h"
@@ -3749,6 +3751,21 @@ void qemu_init(int argc, char **argv, char **envp)
qemu_opt_get_bool(opts, "mem-lock", false);
enable_cpu_pm = qemu_opt_get_bool(opts, "cpu-pm", false);
break;
+ case QEMU_OPTION_compat:
+ {
+ CompatPolicy *opts;
+ Visitor *v;
+
+ v = qobject_input_visitor_new_str(optarg, NULL,
+ &error_fatal);
+
+ visit_type_CompatPolicy(v, NULL, &opts, &error_fatal);
+ QAPI_CLONE_MEMBERS(CompatPolicy, &compat_policy, opts);
+
+ qapi_free_CompatPolicy(opts);
+ visit_free(v);
+ break;
+ }
case QEMU_OPTION_msg:
opts = qemu_opts_parse_noisily(qemu_find_opts("msg"), optarg,
false);
diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
index 4673ab7490..a3de2e2756 100644
--- a/qapi/Makefile.objs
+++ b/qapi/Makefile.objs
@@ -5,10 +5,10 @@ util-obj-y += opts-visitor.o qapi-clone-visitor.o
util-obj-y += qmp-event.o
util-obj-y += qapi-util.o
-QAPI_COMMON_MODULES = audio authz block-core block char common control crypto
-QAPI_COMMON_MODULES += dump error introspect job machine migration misc
-QAPI_COMMON_MODULES += net pragma qdev qom rdma rocker run-state sockets tpm
-QAPI_COMMON_MODULES += trace transaction ui
+QAPI_COMMON_MODULES = audio authz block-core block char common compat
+QAPI_COMMON_MODULES += control crypto dump error introspect job
+QAPI_COMMON_MODULES += machine migration misc net pragma qdev qom rdma
+QAPI_COMMON_MODULES += rocker run-state sockets tpm trace transaction ui
QAPI_TARGET_MODULES = machine-target misc-target
QAPI_MODULES = $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES)
diff --git a/qemu-options.hx b/qemu-options.hx
index 1d8f852d89..5459e6c94c 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3357,6 +3357,26 @@ DEFHEADING()
DEFHEADING(Debug/Expert options:)
+DEF("compat", HAS_ARG, QEMU_OPTION_compat,
+ "-compat [deprecated-input=accept|reject][,deprecated-output=accept|hide]\n"
+ " Policy for handling deprecated management interfaces\n",
+ QEMU_ARCH_ALL)
+SRST
+``-compat [deprecated-input=@var{input-policy}][,deprecated-output=@var{output-policy}]``
+ Set policy for handling deprecated management interfaces (experimental):
+
+ ``deprecated-input=accept`` (default)
+ Accept deprecated commands and arguments
+ ``deprecated-input=reject``
+ Reject deprecated commands and arguments
+ ``deprecated-output=accept`` (default)
+ Emit deprecated command results and events
+ ``deprecated-output=hide``
+ Suppress deprecated command results and events
+
+ Limitation: covers only syntactic aspects of QMP.
+ERST
+
DEF("fw_cfg", HAS_ARG, QEMU_OPTION_fwcfg,
"-fw_cfg [name=]<name>,file=<file>\n"
" add named fw_cfg entry with contents from file\n"
--
2.21.1
next prev parent reply other threads:[~2020-03-15 15:49 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-15 14:46 [PATCH v3 00/34] Configurable policy for handling deprecated interfaces Markus Armbruster
2020-03-15 14:46 ` [PATCH v3 01/34] qemu-doc: Belatedly document QMP command arg & result deprecation Markus Armbruster
2020-03-16 15:10 ` Eric Blake
2020-03-16 18:34 ` Markus Armbruster
2020-03-15 14:46 ` [PATCH v3 02/34] qapi: Belatedly update doc comment for @wait deprecation Markus Armbruster
2020-03-16 14:51 ` Marc-André Lureau
2020-03-16 15:10 ` Eric Blake
2020-03-15 14:46 ` [PATCH v3 03/34] docs/devel/qapi-code-gen: Clarify allow-oob introspection Markus Armbruster
2020-03-16 15:12 ` Eric Blake
2020-03-15 14:46 ` [PATCH v3 04/34] docs/devel/qapi-code-gen: Document 'features' introspection Markus Armbruster
2020-03-16 15:15 ` Eric Blake
2020-03-15 14:46 ` [PATCH v3 05/34] tests/test-qmp-cmds: Factor out qmp_dispatch() test helpers Markus Armbruster
2020-03-16 15:06 ` Marc-André Lureau
2020-03-16 19:46 ` Markus Armbruster
2020-03-16 17:16 ` Eric Blake
2020-03-15 14:46 ` [PATCH v3 06/34] tests/test-qmp-cmds: Check responses more thoroughly Markus Armbruster
2020-03-16 15:08 ` Marc-André Lureau
2020-03-16 17:18 ` Eric Blake
2020-03-15 14:46 ` [PATCH v3 07/34] tests/test-qmp-cmds: Simplify test data setup Markus Armbruster
2020-03-16 15:10 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 08/34] tests/test-qmp-event: " Markus Armbruster
2020-03-16 15:11 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 09/34] tests/test-qmp-event: Use qobject_is_equal() Markus Armbruster
2020-03-16 15:13 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 10/34] tests/test-qmp-event: Check event is actually emitted Markus Armbruster
2020-03-16 15:14 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 11/34] qapi/schema: Clean up around QAPISchemaEntity.connect_doc() Markus Armbruster
2020-03-16 16:47 ` Marc-André Lureau
2020-03-16 17:23 ` Eric Blake
2020-03-15 14:46 ` [PATCH v3 12/34] qapi: Add feature flags to remaining definitions Markus Armbruster
2020-03-16 17:55 ` Eric Blake
2020-03-17 5:46 ` Markus Armbruster
2020-03-17 11:29 ` Eric Blake
2020-03-15 14:46 ` [PATCH v3 13/34] qapi: Consistently put @features parameter right after @ifcond Markus Armbruster
2020-03-16 16:52 ` Marc-André Lureau
2020-03-16 17:57 ` Eric Blake
2020-03-15 14:46 ` [PATCH v3 14/34] qapi/introspect: Rename *qlit* to reduce confusion Markus Armbruster
2020-03-16 16:54 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 15/34] qapi/introspect: Factor out _make_tree() Markus Armbruster
2020-03-16 16:58 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 16/34] qapi/schema: Change _make_features() to a take feature list Markus Armbruster
2020-03-15 14:46 ` [PATCH v3 17/34] qapi/schema: Reorder classes so related ones are together Markus Armbruster
2020-03-16 17:03 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 18/34] qapi/schema: Rename QAPISchemaObjectType{Variant, Variants} Markus Armbruster
2020-03-16 17:06 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 19/34] qapi/schema: Call QAPIDoc.connect_member() in just one place Markus Armbruster
2020-03-16 17:08 ` Marc-André Lureau
2020-03-16 17:08 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 20/34] qapi: Add feature flags to struct members Markus Armbruster
2020-03-16 17:10 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 21/34] qapi: Inline do_qmp_dispatch() into qmp_dispatch() Markus Armbruster
2020-03-16 17:25 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 22/34] qapi: Simplify how qmp_dispatch() deals with QCO_NO_SUCCESS_RESP Markus Armbruster
2020-03-16 17:28 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 23/34] qapi: Simplify how qmp_dispatch() gets the request ID Markus Armbruster
2020-03-16 17:33 ` Marc-André Lureau
2020-03-17 6:39 ` Markus Armbruster
2020-03-17 7:37 ` Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 24/34] qapi: Replace qmp_dispatch()'s TODO comment by an explanation Markus Armbruster
2020-03-16 17:36 ` Marc-André Lureau
2020-03-17 6:52 ` Markus Armbruster
2020-03-15 14:46 ` [PATCH v3 25/34] qapi: New special feature flag "deprecated" Markus Armbruster
2020-03-15 15:49 ` Philippe Mathieu-Daudé
2020-03-15 16:53 ` Markus Armbruster
2020-03-15 14:46 ` [PATCH v3 26/34] qapi: Mark deprecated QMP parts with feature 'deprecated' Markus Armbruster
2020-03-15 14:46 ` Markus Armbruster [this message]
2020-03-16 17:43 ` [PATCH v3 27/34] qemu-options: New -compat to set policy for deprecated interfaces Marc-André Lureau
2020-03-15 14:46 ` [PATCH v3 28/34] qapi: Implement deprecated-output=hide for QMP command results Markus Armbruster
2020-03-16 17:53 ` Marc-André Lureau
2020-03-16 19:46 ` Markus Armbruster
2020-03-15 14:46 ` [PATCH v3 29/34] qapi: Implement deprecated-output=hide for QMP events Markus Armbruster
2020-03-15 14:46 ` [PATCH v3 30/34] qapi: Implement deprecated-output=hide for QMP event data Markus Armbruster
2020-03-16 19:48 ` Markus Armbruster
2020-03-15 14:46 ` [PATCH v3 31/34] qapi: Implement deprecated-output=hide for QMP introspection Markus Armbruster
2020-03-15 14:46 ` [PATCH v3 32/34] qapi: Implement deprecated-input=reject for QMP commands Markus Armbruster
2020-03-15 14:46 ` [PATCH v3 33/34] qapi: Implement deprecated-input=reject for QMP command arguments Markus Armbruster
2020-03-15 14:46 ` [PATCH v3 34/34] qapi: New -compat deprecated-input=crash Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200315144653.22660-28-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).