From patchwork Tue Mar 16 17:05:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1454049 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UD1KFJLk; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F0Kgq3LdBz9sVm for ; Wed, 17 Mar 2021 04:16:07 +1100 (AEDT) Received: from localhost ([::1]:34296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMDIb-0005hI-EW for incoming@patchwork.ozlabs.org; Tue, 16 Mar 2021 13:16:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMD8t-0002qY-4v for qemu-devel@nongnu.org; Tue, 16 Mar 2021 13:06:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44891) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMD8n-000593-Lf for qemu-devel@nongnu.org; Tue, 16 Mar 2021 13:06:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615914356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PM/JR32ioiF3bRUl3cBtT+rAACkGZEVhxuLKDT7VpsI=; b=UD1KFJLk6vtO4IIY7Hpyj1TLyJ7AxvWiYMNQAFpm5vWfoRgXvno0eg07LFoLvv/EoSBRPy 4sXFQvJOMl2F3tM2U3GAhXQ0zpTj7FLRST7FbfHONRNPflRUta7BABet3+4Dbun6hEqkbp O1GG4l3iNlJlQOc9hwdayDWtiLSm/6I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-495-Hs0qC8XoO3qRdOokOaMViA-1; Tue, 16 Mar 2021 13:05:54 -0400 X-MC-Unique: Hs0qC8XoO3qRdOokOaMViA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F05A5100D11E; Tue, 16 Mar 2021 17:05:52 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-83.phx2.redhat.com [10.3.112.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A3FD6B8DA; Tue, 16 Mar 2021 17:05:52 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1E2221132C14; Tue, 16 Mar 2021 18:05:51 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 02/11] qemu-options: New -compat to set policy for deprecated interfaces Date: Tue, 16 Mar 2021 18:05:42 +0100 Message-Id: <20210316170551.3911643-3-armbru@redhat.com> In-Reply-To: <20210316170551.3911643-1-armbru@redhat.com> References: <20210316170551.3911643-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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: <20210312153210.2810514-2-armbru@redhat.com> [Since: comments in qapi/compat.json fixed up] --- 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/meson.build | 1 + qemu-options.hx | 20 ++++++++++++++ 7 files changed, 113 insertions(+) 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..fc24a58a9e --- /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/qapi-schema.json b/qapi/qapi-schema.json index 3441c9a9ae..4912b9744e 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/include/qapi/compat-policy.h b/include/qapi/compat-policy.h new file mode 100644 index 0000000000..b8c6638156 --- /dev/null +++ b/include/qapi/compat-policy.h @@ -0,0 +1,20 @@ +/* + * Policy for handling "funny" management interfaces + * + * Copyright (C) 2020 Red Hat, Inc. + * + * Authors: + * Markus Armbruster + * + * 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 0a2b20a4e4..45090f881a 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) { diff --git a/softmmu/vl.c b/softmmu/vl.c index b7673b9613..4c53b2940c 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -29,6 +29,7 @@ #include "exec/cpu-common.h" #include "hw/boards.h" #include "hw/qdev-properties.h" +#include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qemu-version.h" @@ -113,6 +114,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-migration.h" @@ -3413,6 +3415,21 @@ void qemu_init(int argc, char **argv, char **envp) enable_mlock = 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/meson.build b/qapi/meson.build index fcb15a78f1..376f4ceafe 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -24,6 +24,7 @@ qapi_all_modules = [ 'block-export', 'char', 'common', + 'compat', 'control', 'crypto', 'dump', diff --git a/qemu-options.hx b/qemu-options.hx index 622d3bfa5a..f34d592eb1 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3470,6 +3470,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=],file=\n" " add named fw_cfg entry with contents from file\n" From patchwork Tue Mar 16 17:05:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1454061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=TYSNZx19; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F0KqL4nyqz9sW5 for ; Wed, 17 Mar 2021 04:22:38 +1100 (AEDT) Received: from localhost ([::1]:51560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMDOu-0004b0-KJ for incoming@patchwork.ozlabs.org; Tue, 16 Mar 2021 13:22:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMD8s-0002ou-Cg for qemu-devel@nongnu.org; Tue, 16 Mar 2021 13:06:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39246) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMD8n-000596-Fy for qemu-devel@nongnu.org; Tue, 16 Mar 2021 13:06:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615914356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EwSIWDxNihDiFFIVaJIk3OgW01Ur0fI65tx4Wp2FJXI=; b=TYSNZx1922ZcMrEdDmIvJsK9Qcrv4CikZydy76lGyFd6pyVL2FU46A7oy5LP8KWV1mHzMz 1hByZO/gzYOU+suqi2663FrYuCaQ6da/ADFC6ijxTae0NmGmXutm6lYrYZ8IwbNGHcgkJc zawtzIUrop4JGWxcpnfZIEF7Uzuag84= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-196-hDqSFHJ3P9qeQHM2P6vN9w-1; Tue, 16 Mar 2021 13:05:53 -0400 X-MC-Unique: hDqSFHJ3P9qeQHM2P6vN9w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB3D7100D11C; Tue, 16 Mar 2021 17:05:52 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-83.phx2.redhat.com [10.3.112.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A5C8610F0; Tue, 16 Mar 2021 17:05:52 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 2504E1141CBD; Tue, 16 Mar 2021 18:05:51 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 04/11] qapi: Implement deprecated-output=hide for QMP events Date: Tue, 16 Mar 2021 18:05:44 +0100 Message-Id: <20210316170551.3911643-5-armbru@redhat.com> In-Reply-To: <20210316170551.3911643-1-armbru@redhat.com> References: <20210316170551.3911643-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This policy suppresses deprecated bits in output, and thus permits "testing the future". Implement it for QMP events: suppress deprecated ones. No QMP event is deprecated right now. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <20210312153210.2810514-4-armbru@redhat.com> --- tests/unit/test-qmp-event.c | 20 ++++++++++++++++++++ scripts/qapi/events.py | 12 +++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/unit/test-qmp-event.c b/tests/unit/test-qmp-event.c index 7dd0053190..ab059fb5c2 100644 --- a/tests/unit/test-qmp-event.c +++ b/tests/unit/test-qmp-event.c @@ -14,6 +14,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qmp/qbool.h" #include "qapi/qmp/qdict.h" @@ -140,6 +141,24 @@ static void test_event_d(TestEventData *data, qobject_unref(data->expect); } +static void test_event_deprecated(TestEventData *data, const void *unused) +{ + data->expect = qdict_from_jsonf_nofail("{ 'event': 'TEST-EVENT-FEATURES1' }"); + + memset(&compat_policy, 0, sizeof(compat_policy)); + + qapi_event_send_test_event_features1(); + g_assert(data->emitted); + + compat_policy.has_deprecated_output = true; + compat_policy.deprecated_output = COMPAT_POLICY_OUTPUT_HIDE; + data->emitted = false; + qapi_event_send_test_event_features1(); + g_assert(!data->emitted); + + qobject_unref(data->expect); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -148,6 +167,7 @@ int main(int argc, char **argv) event_test_add("/event/event_b", test_event_b); event_test_add("/event/event_c", test_event_c); event_test_add("/event/event_d", test_event_d); + event_test_add("/event/deprecated", test_event_deprecated); g_test_run(); return 0; diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py index 90d2f6156d..f6e1e76f64 100644 --- a/scripts/qapi/events.py +++ b/scripts/qapi/events.py @@ -79,6 +79,7 @@ def gen_param_var(typ: QAPISchemaObjectType) -> str: def gen_event_send(name: str, arg_type: Optional[QAPISchemaObjectType], + features: List[QAPISchemaFeature], boxed: bool, event_enum_name: str, event_emit: str) -> str: @@ -107,6 +108,14 @@ def gen_event_send(name: str, if not boxed: ret += gen_param_var(arg_type) + if 'deprecated' in [f.name for f in features]: + ret += mcgen(''' + + if (compat_policy.deprecated_output == COMPAT_POLICY_OUTPUT_HIDE) { + return; + } +''') + ret += mcgen(''' qmp = qmp_event_build_dict("%(name)s"); @@ -176,6 +185,7 @@ def _begin_user_module(self, name: str) -> None: #include "%(prefix)sqapi-emit-events.h" #include "%(events)s.h" #include "%(visit)s.h" +#include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qapi/qobject-output-visitor.h" @@ -220,7 +230,7 @@ def visit_event(self, boxed: bool) -> None: with ifcontext(ifcond, self._genh, self._genc): self._genh.add(gen_event_send_decl(name, arg_type, boxed)) - self._genc.add(gen_event_send(name, arg_type, boxed, + self._genc.add(gen_event_send(name, arg_type, features, boxed, self._event_enum_name, self._event_emit_name)) # Note: we generate the enum member regardless of @ifcond, to From patchwork Tue Mar 16 17:05:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1454064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=U4xDbGnD; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F0KtS21v7z9sVt for ; Wed, 17 Mar 2021 04:25:20 +1100 (AEDT) Received: from localhost ([::1]:58592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMDRV-0007UN-HM for incoming@patchwork.ozlabs.org; Tue, 16 Mar 2021 13:25:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMD8v-0002ux-Da for qemu-devel@nongnu.org; Tue, 16 Mar 2021 13:06:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:47197) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMD8p-00059f-8f for qemu-devel@nongnu.org; Tue, 16 Mar 2021 13:06:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615914358; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y5XcYEvceKIJq91nDYWJRfT+fVy4E6lRNcqyZn+0u2k=; b=U4xDbGnDAeBdUUU+daDAtnHOBWPYOeSewPAv/nYjZsoLuaplj7qdWKVHt4VU0b8mpA3WCG Ich+nuBUCX1t5anztGMXPcKS8K4QdvjjUOuDIzErjTw6cwLkOz6/2dLrw7cxQH9dojorIi f1SDH6xyJNkDcbG78VxYOqouknA1zvc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-382-QuEQunaiPSu71W1anXY3gg-1; Tue, 16 Mar 2021 13:05:55 -0400 X-MC-Unique: QuEQunaiPSu71W1anXY3gg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BA7288042C3; Tue, 16 Mar 2021 17:05:54 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-83.phx2.redhat.com [10.3.112.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66A1A610F0; Tue, 16 Mar 2021 17:05:54 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 2C410114423C; Tue, 16 Mar 2021 18:05:51 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 06/11] monitor: Drop query-qmp-schema 'gen': false hack Date: Tue, 16 Mar 2021 18:05:46 +0100 Message-Id: <20210316170551.3911643-7-armbru@redhat.com> In-Reply-To: <20210316170551.3911643-1-armbru@redhat.com> References: <20210316170551.3911643-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" QMP commands return their response as a generated QAPI type, which the monitor core converts to JSON via QObject. query-qmp-schema's response is the generated introspection data. This is a QLitObject since commit 7d0f982bfb "qapi: generate a literal qobject for introspection", v2.12). Before, it was a string. Instead of converting QLitObject / string -> QObject -> QAPI type SchemaInfoList -> QObject -> JSON, we take a shortcut: the command is 'gen': false, so it can return the QObject instead of the QAPI type. Slightly simpler and more efficient. The next commit will filter the response for output policy, and this is easier in the SchemaInfoList representation. Drop the shortcut. This replaces the manual command registration by a generated one. The manual registration makes the command available before the machine is built by passing flag QCO_ALLOW_PRECONFIG. To keep it available there, we need need to add 'allow-preconfig': true to its definition in the schema. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <20210312153210.2810514-6-armbru@redhat.com> [Commit message typo fixed] --- qapi/introspect.json | 2 +- monitor/monitor-internal.h | 3 --- monitor/misc.c | 2 -- monitor/qmp-cmds-control.c | 29 ++++++++++++++++------------ storage-daemon/qemu-storage-daemon.c | 2 -- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/qapi/introspect.json b/qapi/introspect.json index 944bb87a20..39bd303778 100644 --- a/qapi/introspect.json +++ b/qapi/introspect.json @@ -49,7 +49,7 @@ ## { 'command': 'query-qmp-schema', 'returns': [ 'SchemaInfo' ], - 'gen': false } # just to simplify qmp_query_json() + 'allow-preconfig': true } ## # @SchemaMetaType: diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index 40903d6386..9c3a09cb01 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -183,7 +183,4 @@ void help_cmd(Monitor *mon, const char *name); void handle_hmp_command(MonitorHMP *mon, const char *cmdline); int hmp_compare_cmd(const char *name, const char *list); -void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data, - Error **errp); - #endif diff --git a/monitor/misc.c b/monitor/misc.c index a7650ed747..0b46006e42 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -231,8 +231,6 @@ static void monitor_init_qmp_commands(void) qmp_init_marshal(&qmp_commands); - qmp_register_command(&qmp_commands, "query-qmp-schema", - qmp_query_qmp_schema, QCO_ALLOW_PRECONFIG); qmp_register_command(&qmp_commands, "device_add", qmp_device_add, QCO_NO_OPTIONS); qmp_register_command(&qmp_commands, "object-add", qmp_object_add, diff --git a/monitor/qmp-cmds-control.c b/monitor/qmp-cmds-control.c index 509ae870bd..25afd0867f 100644 --- a/monitor/qmp-cmds-control.c +++ b/monitor/qmp-cmds-control.c @@ -26,10 +26,14 @@ #include "monitor-internal.h" #include "qemu-version.h" +#include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qapi-commands-control.h" +#include "qapi/qapi-commands-introspect.h" #include "qapi/qapi-emit-events.h" #include "qapi/qapi-introspect.h" +#include "qapi/qapi-visit-introspect.h" +#include "qapi/qobject-input-visitor.h" /* * Accept QMP capabilities in @list for @mon. @@ -154,17 +158,18 @@ EventInfoList *qmp_query_events(Error **errp) return ev_list; } -/* - * Minor hack: generated marshalling suppressed for this command - * ('gen': false in the schema) so we can parse the JSON string - * directly into QObject instead of first parsing it with - * visit_type_SchemaInfoList() into a SchemaInfoList, then marshal it - * to QObject with generated output marshallers, every time. Instead, - * we do it in test-qobject-input-visitor.c, just to make sure - * qapi-gen.py's output actually conforms to the schema. - */ -void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data, - Error **errp) +SchemaInfoList *qmp_query_qmp_schema(Error **errp) { - *ret_data = qobject_from_qlit(&qmp_schema_qlit); + QObject *obj = qobject_from_qlit(&qmp_schema_qlit); + Visitor *v = qobject_input_visitor_new(obj); + SchemaInfoList *schema = NULL; + + /* test_visitor_in_qmp_introspect() ensures this can't fail */ + visit_type_SchemaInfoList(v, NULL, &schema, &error_abort); + g_assert(schema); + + qobject_unref(obj); + visit_free(v); + + return schema; } diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c index 23756fc8e5..02afdbeafc 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -146,8 +146,6 @@ static QemuOptsList qemu_object_opts = { static void init_qmp_commands(void) { qmp_init_marshal(&qmp_commands); - qmp_register_command(&qmp_commands, "query-qmp-schema", - qmp_query_qmp_schema, QCO_ALLOW_PRECONFIG); qmp_register_command(&qmp_commands, "object-add", qmp_object_add, QCO_NO_OPTIONS); From patchwork Tue Mar 16 16:52:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1454042 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Wc8uCAJR; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F0KYV6lwMz9sVm for ; Wed, 17 Mar 2021 04:10:38 +1100 (AEDT) Received: from localhost ([::1]:48438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMDDI-0007cc-VB for incoming@patchwork.ozlabs.org; Tue, 16 Mar 2021 13:10:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMCvz-0006CA-1M for qemu-devel@nongnu.org; Tue, 16 Mar 2021 12:52:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMCvw-0008Fs-0e for qemu-devel@nongnu.org; Tue, 16 Mar 2021 12:52:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615913559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wixz/ZlkgWaQe3e9oIX6YCooqd0DTUywAT8TgdI5heU=; b=Wc8uCAJRWiZbek6ZMi9amISolOghWdXbKPVlgLSZ+dtkzD5M0PkQB/Liz4b8A23ovbQ/Da EBE0OkZrQ6awJ8k/nh6wHXbTZz6na7sq8AivF8IG08BaqqTpTjN235VyzXs6RQPiW1R+xp oIDvjEmv0unU3mQ/F9U9Tb57w5qxEFk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-1b2-8nN5PkCq4w-Np1psZw-1; Tue, 16 Mar 2021 12:52:36 -0400 X-MC-Unique: 1b2-8nN5PkCq4w-Np1psZw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2B4391054F90; Tue, 16 Mar 2021 16:52:35 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-83.phx2.redhat.com [10.3.112.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE48A5C1A1; Tue, 16 Mar 2021 16:52:34 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id C444C1126898; Tue, 16 Mar 2021 17:52:31 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 07/11] qapi: Implement deprecated-output=hide for QMP introspection Date: Tue, 16 Mar 2021 17:52:27 +0100 Message-Id: <20210316165231.3910842-8-armbru@redhat.com> In-Reply-To: <20210316165231.3910842-1-armbru@redhat.com> References: <20210316165231.3910842-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This policy suppresses deprecated bits in output, and thus permits "testing the future". Implement it for QMP command query-qmp-schema: suppress information on deprecated commands, events and object type members, i.e. anything that has the special feature flag "deprecated". Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <20210312153210.2810514-7-armbru@redhat.com> --- monitor/qmp-cmds-control.c | 71 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/monitor/qmp-cmds-control.c b/monitor/qmp-cmds-control.c index 25afd0867f..bcfccc4ac4 100644 --- a/monitor/qmp-cmds-control.c +++ b/monitor/qmp-cmds-control.c @@ -158,6 +158,74 @@ EventInfoList *qmp_query_events(Error **errp) return ev_list; } +static void *split_off_generic_list(void *list, + bool (*splitp)(void *elt), + void **part) +{ + GenericList *keep = NULL, **keep_tailp = &keep; + GenericList *split = NULL, **split_tailp = &split; + GenericList *tail; + + for (tail = list; tail; tail = tail->next) { + if (splitp(tail)) { + *split_tailp = tail; + split_tailp = &tail->next; + } else { + *keep_tailp = tail; + keep_tailp = &tail->next; + } + } + + *keep_tailp = *split_tailp = NULL; + *part = split; + return keep; +} + +static bool is_in(const char *s, strList *list) +{ + strList *tail; + + for (tail = list; tail; tail = tail->next) { + if (!strcmp(tail->value, s)) { + return true; + } + } + return false; +} + +static bool is_entity_deprecated(void *link) +{ + return is_in("deprecated", ((SchemaInfoList *)link)->value->features); +} + +static bool is_member_deprecated(void *link) +{ + return is_in("deprecated", + ((SchemaInfoObjectMemberList *)link)->value->features); +} + +static SchemaInfoList *zap_deprecated(SchemaInfoList *schema) +{ + void *to_zap; + SchemaInfoList *tail; + SchemaInfo *ent; + + schema = split_off_generic_list(schema, is_entity_deprecated, &to_zap); + qapi_free_SchemaInfoList(to_zap); + + for (tail = schema; tail; tail = tail->next) { + ent = tail->value; + if (ent->meta_type == SCHEMA_META_TYPE_OBJECT) { + ent->u.object.members + = split_off_generic_list(ent->u.object.members, + is_member_deprecated, &to_zap); + qapi_free_SchemaInfoObjectMemberList(to_zap); + } + } + + return schema; +} + SchemaInfoList *qmp_query_qmp_schema(Error **errp) { QObject *obj = qobject_from_qlit(&qmp_schema_qlit); @@ -171,5 +239,8 @@ SchemaInfoList *qmp_query_qmp_schema(Error **errp) qobject_unref(obj); visit_free(v); + if (compat_policy.deprecated_output == COMPAT_POLICY_OUTPUT_HIDE) { + return zap_deprecated(schema); + } return schema; } From patchwork Tue Mar 16 17:05:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 1454065 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YVLBLNqO; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F0KvW4zXnz9sVb for ; Wed, 17 Mar 2021 04:26:15 +1100 (AEDT) Received: from localhost ([::1]:60492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMDSP-0008KX-Jk for incoming@patchwork.ozlabs.org; Tue, 16 Mar 2021 13:26:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMD8t-0002rs-Le for qemu-devel@nongnu.org; Tue, 16 Mar 2021 13:06:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:25789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMD8p-00059F-2Q for qemu-devel@nongnu.org; Tue, 16 Mar 2021 13:06:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615914357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UCuwNf8otkRHS85fM7uI8URkzZSgsLolBhMdWOSj7Cs=; b=YVLBLNqOe9cX2U5/TFCPiye78clFB/Z+0X5JaKSBurjxb9rF4BneI4NBQab+ufnp7f8sY9 ycAx87WR3C2c4j0puIRd/la8z5qzhqmmm57P3MlaWbLs/bfR8tmnN01/WY1KPTMuJLdTCC TYtuQk8QWsRBm61iJ/WqAxXCnZcXNdE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-516-uZ-DoYZKMqGZOgiTcr-N0w-1; Tue, 16 Mar 2021 13:05:55 -0400 X-MC-Unique: uZ-DoYZKMqGZOgiTcr-N0w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 974FF100D698; Tue, 16 Mar 2021 17:05:54 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-83.phx2.redhat.com [10.3.112.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65C781378D; Tue, 16 Mar 2021 17:05:54 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 32F671126899; Tue, 16 Mar 2021 18:05:51 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 08/11] test-util-sockets: Add stub for monitor_set_cur() Date: Tue, 16 Mar 2021 18:05:48 +0100 Message-Id: <20210316170551.3911643-9-armbru@redhat.com> In-Reply-To: <20210316170551.3911643-1-armbru@redhat.com> References: <20210316170551.3911643-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Without this stub, the next commit fails to link. I suspect the real cause is 947e47448d "monitor: Use getter/setter functions for cur_mon". Cc: Kevin Wolf Signed-off-by: Markus Armbruster Message-Id: <20210312153210.2810514-8-armbru@redhat.com> Reviewed-by: Eric Blake --- tests/unit/test-util-sockets.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c index 67486055ed..72b9246529 100644 --- a/tests/unit/test-util-sockets.c +++ b/tests/unit/test-util-sockets.c @@ -73,6 +73,7 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp) * otherwise we get duplicate syms at link time. */ Monitor *monitor_cur(void) { return cur_mon; } +Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) { abort(); } int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { abort(); } #ifndef _WIN32