From nobody Sun Apr 28 06:04:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635139623; cv=none; d=zohomail.com; s=zohoarc; b=Ej7vITCIzEg3udf7dNmLYaZh9qTATCH4Tj3enHHFvm5ftzMwAYUXkr0smx6suhCSpMrAq12Dw2fOV4DSKUuw3/ITSP93KbnBYTeC//34ykokq/xgxyX8DjRqbu7eLkgPGp/ZBX3XRiE23bEJOgDWwhNoBA6sQrJDBmxEkAHRgC0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635139623; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FwLwGEujYpzYkui5eea/xnzhjYxetuw28fQTiE0qHhs=; b=WQBhkO88vUHkHv5vI6pImKAwndY1xKTrYb31k3+0YdDcCUseDkENtRkiS4jlBhDX0eIUzM8z1VgkcPr7LDY7/onL3sp42xmVkXh3zOrz3krsw/WwGi0xdcBaWCh78DNP8vuFRPMGR99jgaCF9sa9K8F6++oTwrsgSZ6dC1aeTYk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1635139623648384.4023235478578; Sun, 24 Oct 2021 22:27:03 -0700 (PDT) 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-434-6PhZb-zJOBCsUsG2-v690w-1; Mon, 25 Oct 2021 01:26:14 -0400 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 D62B610B3942; Mon, 25 Oct 2021 05:26:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6EAB5FC25; Mon, 25 Oct 2021 05:26:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 84FE34EA3C; Mon, 25 Oct 2021 05:26:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19P5Q0Oa020020 for ; Mon, 25 Oct 2021 01:26:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5816916A36; Mon, 25 Oct 2021 05:26:00 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 484D219D9D; Mon, 25 Oct 2021 05:25:34 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D185411380AA; Mon, 25 Oct 2021 07:25:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635139622; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FwLwGEujYpzYkui5eea/xnzhjYxetuw28fQTiE0qHhs=; b=WYis7cPMLHgwMUo7ZXnNKuWnq9+IrfpHqC6ughygdWBK7Ji05FVgkBI+8ckhTNl6owALJL 14ZQk5fi5mIw39VxG9mxcAj6SAwOnyflgDnKGu3EuB+vmOwfJZqPZtVvI+YnXY/QxT/krb FkGPX1iRAkErBMPDe5G8STJGWNo+q/U= X-MC-Unique: 6PhZb-zJOBCsUsG2-v690w-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 1/9] qapi: New special feature flag "unstable" Date: Mon, 25 Oct 2021 07:25:24 +0200 Message-Id: <20211025052532.3859634-2-armbru@redhat.com> In-Reply-To: <20211025052532.3859634-1-armbru@redhat.com> References: <20211025052532.3859634-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, libvir-list@redhat.com, eblake@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, jsnow@redhat.com, libguestfs@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635139624312100001 Content-Type: text/plain; charset="utf-8" By convention, names starting with "x-" are experimental. The parts of external interfaces so named may be withdrawn or changed incompatibly in future releases. Drawback: promoting something from experimental to stable involves a name change. Client code needs to be updated. Moreover, the convention is not universally observed: * QOM type "input-barrier" has properties "x-origin", "y-origin". Looks accidental, but it's ABI since 4.2. * QOM types "memory-backend-file", "memory-backend-memfd", "memory-backend-ram", and "memory-backend-epc" have a property "x-use-canonical-path-for-ramblock-id" that is documented to be stable despite its name. We could document these exceptions, but documentation helps only humans. We want to recognize "unstable" in code, like "deprecated". Replace the convention by a new special feature flag "unstable". It will be recognized by the QAPI generator, like the existing feature flag "deprecated", and unlike regular feature flags. This commit updates documentation and prepares tests. The next commit updates the QAPI schema. The remaining patches update the QAPI generator and wire up -compat policy checking. Signed-off-by: Markus Armbruster Reviewed-by: John Snow Reviewed-by: Juan Quintela Reviewed-by: Kashyap Chamarthy =20 --- docs/devel/qapi-code-gen.rst | 9 ++++++--- tests/qapi-schema/qapi-schema-test.json | 7 +++++-- tests/qapi-schema/qapi-schema-test.out | 5 +++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst index 4071c9074a..38f2d7aad3 100644 --- a/docs/devel/qapi-code-gen.rst +++ b/docs/devel/qapi-code-gen.rst @@ -713,6 +713,10 @@ member as deprecated. It is not supported elsewhere s= o far. Interfaces so marked may be withdrawn in future releases in accordance with QEMU's deprecation policy. =20 +Feature "unstable" marks a command, event, enum value, or struct +member as unstable. It is not supported elsewhere so far. Interfaces +so marked may be withdrawn or changed incompatibly in future releases. + =20 Naming rules and reserved names ------------------------------- @@ -746,9 +750,8 @@ Member name ``u`` and names starting with ``has-`` or `= `has_`` are reserved for the generator, which uses them for unions and for tracking optional members. =20 -Any name (command, event, type, member, or enum value) beginning with -``x-`` is marked experimental, and may be withdrawn or changed -incompatibly in a future release. +Names beginning with ``x-`` used to signify "experimental". This +convention has been replaced by special feature "unstable". =20 Pragmas ``command-name-exceptions`` and ``member-name-exceptions`` let you violate naming rules. Use for new code is strongly discouraged. See diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qa= pi-schema-test.json index b677ab861d..43b8697002 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -273,7 +273,7 @@ 'data': { 'foo': { 'type': 'int', 'features': [ 'deprecated' ] } }, 'features': [ 'feature1' ] } { 'struct': 'FeatureStruct2', - 'data': { 'foo': 'int' }, + 'data': { 'foo': { 'type': 'int', 'features': [ 'unstable' ] } }, 'features': [ { 'name': 'feature1' } ] } { 'struct': 'FeatureStruct3', 'data': { 'foo': 'int' }, @@ -331,7 +331,7 @@ { 'command': 'test-command-features1', 'features': [ 'deprecated' ] } { 'command': 'test-command-features3', - 'features': [ 'feature1', 'feature2' ] } + 'features': [ 'unstable', 'feature1', 'feature2' ] } =20 { 'command': 'test-command-cond-features1', 'features': [ { 'name': 'feature1', 'if': 'TEST_IF_FEATURE_1'} ] } @@ -348,3 +348,6 @@ =20 { 'event': 'TEST_EVENT_FEATURES1', 'features': [ 'deprecated' ] } + +{ 'event': 'TEST_EVENT_FEATURES2', + 'features': [ 'unstable' ] } diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qap= i-schema-test.out index 16846dbeb8..1f9585fa9b 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -308,6 +308,7 @@ object FeatureStruct1 feature feature1 object FeatureStruct2 member foo: int optional=3DFalse + feature unstable feature feature1 object FeatureStruct3 member foo: int optional=3DFalse @@ -373,6 +374,7 @@ command test-command-features1 None -> None feature deprecated command test-command-features3 None -> None gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse + feature unstable feature feature1 feature feature2 command test-command-cond-features1 None -> None @@ -394,6 +396,9 @@ event TEST_EVENT_FEATURES0 FeatureStruct1 event TEST_EVENT_FEATURES1 None boxed=3DFalse feature deprecated +event TEST_EVENT_FEATURES2 None + boxed=3DFalse + feature unstable module include/sub-module.json include sub-sub-module.json object SecondArrayRef --=20 2.31.1 From nobody Sun Apr 28 06:04:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635139582; cv=none; d=zohomail.com; s=zohoarc; b=QQgSqZgKA3j4104LOdOARtmERQ8haSvwSZ/Fl6WzenUi8b3UEUC9fBkPZqAiPwkLVyDTQmUxIJuT+W2IYWwn+tHhe6O+q2f1VKJ8r+Oz/M3QexwnpQ9E8H/yF1RDOSflkBOLvHes+IfaaWIBZe+FnB9x5d6YT4a7Y785IKRIXUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635139582; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=29XoXnpqWdpFuGD0pVGHE5Fo5MHCLhoAAemcCQqnHMA=; b=eEj3z+chcwhOPrsIuFOilvJ9231tRe7n7qntc++hNiQcRRnMSoQlkdjz/n4aWpR7A3unKpL4F7TNiZb9mijbg3AQypFffuZw3khH6DBtts1nmaY7pPRo+oMy1HMP4H90zYZoGVz9pnqcxMVKJgz9+ZuRTITr+D2FNq7y66urtdM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 16351395822041018.9981037302151; Sun, 24 Oct 2021 22:26:22 -0700 (PDT) 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-31-hFx7vClDP6yEpyL6jlkQZQ-1; Mon, 25 Oct 2021 01:26:17 -0400 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 B8F3A806700; Mon, 25 Oct 2021 05:26:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9816F60BF4; Mon, 25 Oct 2021 05:26:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 610F21832DD8; Mon, 25 Oct 2021 05:26:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19P5PlGP019891 for ; Mon, 25 Oct 2021 01:25:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3B9002C6ED; Mon, 25 Oct 2021 05:25:47 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4939C5C1CF; Mon, 25 Oct 2021 05:25:34 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D4BE911380B8; Mon, 25 Oct 2021 07:25:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635139581; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=29XoXnpqWdpFuGD0pVGHE5Fo5MHCLhoAAemcCQqnHMA=; b=XD4o9EEYS2Aggk75wnXQxpee8xJdqcDRjQvDBU3KRKlz9xdX+ROxvKJ8NLQHuj8tpKfB5h mq0MHBEJ529TvhAJ2DH7VCPrwNao6e6mr2cMCVxZpPeP8KM/DZy/4URK8I1jmmwJeUeZAK GmV5j4yxUtMJ0DQeYA0Yg4zV1fzi7VA= X-MC-Unique: hFx7vClDP6yEpyL6jlkQZQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 2/9] qapi: Mark unstable QMP parts with feature 'unstable' Date: Mon, 25 Oct 2021 07:25:25 +0200 Message-Id: <20211025052532.3859634-3-armbru@redhat.com> In-Reply-To: <20211025052532.3859634-1-armbru@redhat.com> References: <20211025052532.3859634-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, libvir-list@redhat.com, eblake@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, jsnow@redhat.com, libguestfs@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635139583898100003 Content-Type: text/plain; charset="utf-8" Add special feature 'unstable' everywhere the name starts with 'x-', except for InputBarrierProperties member x-origin and MemoryBackendProperties member x-use-canonical-path-for-ramblock-id, because these two are actually stable. Signed-off-by: Markus Armbruster Acked-by: John Snow Reviewed-by: Juan Quintela --- qapi/block-core.json | 123 +++++++++++++++++++++++++++++++------------ qapi/migration.json | 35 +++++++++--- qapi/misc.json | 6 ++- qapi/qom.json | 11 ++-- 4 files changed, 130 insertions(+), 45 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 6d3217abb6..ce2c1352cb 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1438,6 +1438,9 @@ # # @x-perf: Performance options. (Since 6.0) # +# Features: +# @unstable: Member @x-perf is experimental. +# # Note: @on-source-error and @on-target-error only affect background # I/O. If an error occurs during a guest write request, the device's # rerror/werror actions will be used. @@ -1452,7 +1455,9 @@ '*on-source-error': 'BlockdevOnError', '*on-target-error': 'BlockdevOnError', '*auto-finalize': 'bool', '*auto-dismiss': 'bool', - '*filter-node-name': 'str', '*x-perf': 'BackupPerf' } } + '*filter-node-name': 'str', + '*x-perf': { 'type': 'BackupPerf', + 'features': [ 'unstable' ] } } } =20 ## # @DriveBackup: @@ -1916,9 +1921,13 @@ # # Get the block graph. # +# Features: +# @unstable: This command is meant for debugging. +# # Since: 4.0 ## -{ 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' } +{ 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph', + 'features': [ 'unstable' ] } =20 ## # @drive-mirror: @@ -2257,6 +2266,9 @@ # # Get bitmap SHA256. # +# Features: +# @unstable: This command is meant for debugging. +# # Returns: - BlockDirtyBitmapSha256 on success # - If @node is not a valid block device, DeviceNotFound # - If @name is not found or if hashing has failed, GenericError = with an @@ -2265,7 +2277,8 @@ # Since: 2.10 ## { 'command': 'x-debug-block-dirty-bitmap-sha256', - 'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' } + 'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256', + 'features': [ 'unstable' ] } =20 ## # @blockdev-mirror: @@ -2495,27 +2508,57 @@ # # Properties for throttle-group objects. # -# The options starting with x- are aliases for the same key without x- in -# the @limits object. As indicated by the x- prefix, this is not a stable -# interface and may be removed or changed incompatibly in the future. Use -# @limits for a supported stable interface. -# # @limits: limits to apply for this throttle group # +# Features: +# @unstable: All members starting with x- are aliases for the same key +# without x- in the @limits object. This is not a stable +# interface and may be removed or changed incompatibly in +# the future. Use @limits for a supported stable +# interface. +# # Since: 2.11 ## { 'struct': 'ThrottleGroupProperties', 'data': { '*limits': 'ThrottleLimits', - '*x-iops-total' : 'int', '*x-iops-total-max' : 'int', - '*x-iops-total-max-length' : 'int', '*x-iops-read' : 'int', - '*x-iops-read-max' : 'int', '*x-iops-read-max-length' : 'int', - '*x-iops-write' : 'int', '*x-iops-write-max' : 'int', - '*x-iops-write-max-length' : 'int', '*x-bps-total' : 'int', - '*x-bps-total-max' : 'int', '*x-bps-total-max-length' : 'int', - '*x-bps-read' : 'int', '*x-bps-read-max' : 'int', - '*x-bps-read-max-length' : 'int', '*x-bps-write' : 'int', - '*x-bps-write-max' : 'int', '*x-bps-write-max-length' : 'int', - '*x-iops-size' : 'int' } } + '*x-iops-total': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-iops-total-max': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-iops-total-max-length': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-iops-read': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-iops-read-max': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-iops-read-max-length': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-iops-write': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-iops-write-max': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-iops-write-max-length': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-bps-total': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-bps-total-max': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-bps-total-max-length': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-bps-read': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-bps-read-max': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-bps-read-max-length': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-bps-write': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-bps-write-max': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-bps-write-max-length': { 'type': 'int', + 'features': [ 'unstable' ] }, + '*x-iops-size': { 'type': 'int', + 'features': [ 'unstable' ] } } } =20 ## # @block-stream: @@ -2916,6 +2959,7 @@ # read-only when the last writer is detached. This # allows giving QEMU write permissions only on de= mand # when an operation actually needs write access. +# @unstable: Member x-check-cache-dropped is meant for debugging. # # Since: 2.9 ## @@ -2926,7 +2970,8 @@ '*aio': 'BlockdevAioOptions', '*drop-cache': {'type': 'bool', 'if': 'CONFIG_LINUX'}, - '*x-check-cache-dropped': 'bool' }, + '*x-check-cache-dropped': { 'type': 'bool', + 'features': [ 'unstable' ] } }, 'features': [ { 'name': 'dynamic-auto-read-only', 'if': 'CONFIG_POSIX' } ] } =20 @@ -4041,13 +4086,16 @@ # future requests before a successful reconnect will # immediately fail. Default 0 (Since 4.2) # +# Features: +# @unstable: Member @x-dirty-bitmap is experimental. +# # Since: 2.9 ## { 'struct': 'BlockdevOptionsNbd', 'data': { 'server': 'SocketAddress', '*export': 'str', '*tls-creds': 'str', - '*x-dirty-bitmap': 'str', + '*x-dirty-bitmap': { 'type': 'str', 'features': [ 'unstable' ]= }, '*reconnect-delay': 'uint32' } } =20 ## @@ -4865,13 +4913,17 @@ # and replacement of an active keyslot # (possible loss of data if IO error happens) # +# Features: +# @unstable: This command is experimental. +# # Since: 5.1 ## { 'command': 'x-blockdev-amend', 'data': { 'job-id': 'str', 'node-name': 'str', 'options': 'BlockdevAmendOptions', - '*force': 'bool' } } + '*force': 'bool' }, + 'features': [ 'unstable' ] } =20 ## # @BlockErrorAction: @@ -5242,16 +5294,18 @@ # # @node: the name of the node that will be added. # -# Note: this command is experimental, and its API is not stable. It -# does not support all kinds of operations, all kinds of children, n= or -# all block drivers. +# Features: +# @unstable: This command is experimental, and its API is not stable. It +# does not support all kinds of operations, all kinds of +# children, nor all block drivers. # -# FIXME Removing children from a quorum node means introducing gaps = in the -# child indices. This cannot be represented in the 'children' list of -# BlockdevOptionsQuorum, as returned by .bdrv_refresh_filename(). +# FIXME Removing children from a quorum node means introducing +# gaps in the child indices. This cannot be represented in the +# 'children' list of BlockdevOptionsQuorum, as returned by +# .bdrv_refresh_filename(). # -# Warning: The data in a new quorum child MUST be consistent with th= at of -# the rest of the array. +# Warning: The data in a new quorum child MUST be consistent +# with that of the rest of the array. # # Since: 2.7 # @@ -5280,7 +5334,8 @@ { 'command': 'x-blockdev-change', 'data' : { 'parent': 'str', '*child': 'str', - '*node': 'str' } } + '*node': 'str' }, + 'features': [ 'unstable' ] } =20 ## # @x-blockdev-set-iothread: @@ -5297,8 +5352,9 @@ # @force: true if the node and its children should be moved when a BlockBa= ckend # is already attached # -# Note: this command is experimental and intended for test cases that need -# control over IOThreads only. +# Features: +# @unstable: This command is experimental and intended for test cases that +# need control over IOThreads only. # # Since: 2.12 # @@ -5320,7 +5376,8 @@ { 'command': 'x-blockdev-set-iothread', 'data' : { 'node-name': 'str', 'iothread': 'StrOrNull', - '*force': 'bool' } } + '*force': 'bool' }, + 'features': [ 'unstable' ] } =20 ## # @QuorumOpType: diff --git a/qapi/migration.json b/qapi/migration.json index 88f07baedd..9aa8bc5759 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -452,14 +452,20 @@ # procedure starts. The VM RAM is saved with running= VM. # (since 6.0) # +# Features: +# @unstable: Members @x-colo and @x-ignore-shared are experimental. +# # Since: 1.2 ## { 'enum': 'MigrationCapability', 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', - 'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram', + 'compress', 'events', 'postcopy-ram', + { 'name': 'x-colo', 'features': [ 'unstable' ] }, + 'release-ram', 'block', 'return-path', 'pause-before-switchover', 'multifd', 'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate', - 'x-ignore-shared', 'validate-uuid', 'background-snapshot'] } + { 'name': 'x-ignore-shared', 'features': [ 'unstable' ] }, + 'validate-uuid', 'background-snapshot'] } =20 ## # @MigrationCapabilityStatus: @@ -743,6 +749,9 @@ # block device name if there is one, and to their n= ode name # otherwise. (Since 5.2) # +# Features: +# @unstable: Member @x-checkpoint-delay is experimental. +# # Since: 2.4 ## { 'enum': 'MigrationParameter', @@ -753,7 +762,9 @@ 'cpu-throttle-initial', 'cpu-throttle-increment', 'cpu-throttle-tailslow', 'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth', - 'downtime-limit', 'x-checkpoint-delay', 'block-incremental', + 'downtime-limit', + { 'name': 'x-checkpoint-delay', 'features': [ 'unstable' ] }, + 'block-incremental', 'multifd-channels', 'xbzrle-cache-size', 'max-postcopy-bandwidth', 'max-cpu-throttle', 'multifd-compression', @@ -903,6 +914,9 @@ # block device name if there is one, and to their n= ode name # otherwise. (Since 5.2) # +# Features: +# @unstable: Member @x-checkpoint-delay is experimental. +# # Since: 2.4 ## # TODO either fuse back into MigrationParameters, or make @@ -925,7 +939,8 @@ '*tls-authz': 'StrOrNull', '*max-bandwidth': 'size', '*downtime-limit': 'uint64', - '*x-checkpoint-delay': 'uint32', + '*x-checkpoint-delay': { 'type': 'uint32', + 'features': [ 'unstable' ] }, '*block-incremental': 'bool', '*multifd-channels': 'uint8', '*xbzrle-cache-size': 'size', @@ -1099,6 +1114,9 @@ # block device name if there is one, and to their n= ode name # otherwise. (Since 5.2) # +# Features: +# @unstable: Member @x-checkpoint-delay is experimental. +# # Since: 2.4 ## { 'struct': 'MigrationParameters', @@ -1119,7 +1137,8 @@ '*tls-authz': 'str', '*max-bandwidth': 'size', '*downtime-limit': 'uint64', - '*x-checkpoint-delay': 'uint32', + '*x-checkpoint-delay': { 'type': 'uint32', + 'features': [ 'unstable' ] }, '*block-incremental': 'bool', '*multifd-channels': 'uint8', '*xbzrle-cache-size': 'size', @@ -1351,6 +1370,9 @@ # If sent to the Secondary, the Secondary side will run failover work, # then takes over server operation to become the service VM. # +# Features: +# @unstable: This command is experimental. +# # Since: 2.8 # # Example: @@ -1359,7 +1381,8 @@ # <- { "return": {} } # ## -{ 'command': 'x-colo-lost-heartbeat' } +{ 'command': 'x-colo-lost-heartbeat', + 'features': [ 'unstable' ] } =20 ## # @migrate_cancel: diff --git a/qapi/misc.json b/qapi/misc.json index 5c2ca3b556..358548abe1 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -185,6 +185,9 @@ # available during the preconfig state (i.e. when the --preconfig command # line option was in use). # +# Features: +# @unstable: This command is experimental. +# # Since 3.0 # # Returns: nothing @@ -195,7 +198,8 @@ # <- { "return": {} } # ## -{ 'command': 'x-exit-preconfig', 'allow-preconfig': true } +{ 'command': 'x-exit-preconfig', 'allow-preconfig': true, + 'features': [ 'unstable' ] } =20 ## # @human-monitor-command: diff --git a/qapi/qom.json b/qapi/qom.json index 7231ac3f34..ccd1167808 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -559,10 +559,8 @@ # for ramblock-id. Disable this for= 4.0 # machine types or older to allow # migration with newer QEMU version= s. -# This option is considered stable -# despite the x- prefix. (default: -# false generally, but true for mac= hine -# types <=3D 4.0) +# (default: false generally, +# but true for machine types <=3D 4= .0) # # Note: prealloc=3Dtrue and reserve=3Dfalse cannot be set at the same time= . With # reserve=3Dtrue, the behavior depends on the operating system: for = example, @@ -785,6 +783,9 @@ ## # @ObjectType: # +# Features: +# @unstable: Member @x-remote-object is experimental. +# # Since: 6.0 ## { 'enum': 'ObjectType', @@ -836,7 +837,7 @@ 'tls-creds-psk', 'tls-creds-x509', 'tls-cipher-suites', - 'x-remote-object' + { 'name': 'x-remote-object', 'features': [ 'unstable' ] } ] } =20 ## --=20 2.31.1 From nobody Sun Apr 28 06:04:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635139563; cv=none; d=zohomail.com; s=zohoarc; b=kkJ4ItaEFdrgXdxyfiKF84ZDk5kNlkPnmOA0J7/jjBRQWM8z7+LJudASxX2Q/6Zppxh/Wy1epQ8GK1MTFZEy7HHqzKu2YVjmptF4+igIvzVRQoDdxdoHoH7TccJxQl9SHHxyi2uw4p/4qJtsTn0+v+mNbwzSnLGeZ7P4sOfNZlc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635139563; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HfkvYTXckKlIyjskAjoVWTuQ1jsWsPt9FpT5FqL7JSw=; b=bUtox27w6CMKh9PGfzNm3RfqlgFw77wF9zNhHpR/4B+jw349N53Z8M5d0cUEGZIw5eDHLfGCj5DbqRkDj11F91Q5kynS3NjEeGBlwj4MNnqIA3r7H0zxf4IoGsHKyHrh6wCk4VphQe3x4njZid+xdf6s/E+wDhi4EkWcs+VgEyI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1635139563232237.69264827080508; Sun, 24 Oct 2021 22:26:03 -0700 (PDT) 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-484-rUTEwJbGNsOi1Pp4eLSTEg-1; Mon, 25 Oct 2021 01:25:58 -0400 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 B45709126F; Mon, 25 Oct 2021 05:25:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C392B5C1CF; Mon, 25 Oct 2021 05:25:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 843031806D03; Mon, 25 Oct 2021 05:25:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19P5PiMi019862 for ; Mon, 25 Oct 2021 01:25:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id CF5C31037F41; Mon, 25 Oct 2021 05:25:44 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 483EC1037F38; Mon, 25 Oct 2021 05:25:34 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D82E711380BA; Mon, 25 Oct 2021 07:25:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635139562; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=HfkvYTXckKlIyjskAjoVWTuQ1jsWsPt9FpT5FqL7JSw=; b=gWY6XFJ8Wx8CPsWJ/3KTtkH8+8BpvmnO9JVc6m8VRfzVXVeca3slbmPPbmW//1I/i6TDi1 C+vtjUWqvUMljpq/lV25mof5PPlmy01nwPjg0EOO9G3Qbd4qx0PmmvkjyJuf3ojozK99cS SEODDnug1IEKC5pWeIE002Qv6Il8qwI= X-MC-Unique: rUTEwJbGNsOi1Pp4eLSTEg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 3/9] qapi: Eliminate QCO_NO_OPTIONS for a slight simplification Date: Mon, 25 Oct 2021 07:25:26 +0200 Message-Id: <20211025052532.3859634-4-armbru@redhat.com> In-Reply-To: <20211025052532.3859634-1-armbru@redhat.com> References: <20211025052532.3859634-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, libvir-list@redhat.com, eblake@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, jsnow@redhat.com, libguestfs@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635139564814100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Reviewed-by: John Snow Reviewed-by: Juan Quintela --- include/qapi/qmp/dispatch.h | 1 - monitor/misc.c | 3 +-- scripts/qapi/commands.py | 5 +---- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index 075203dc67..0ce88200b9 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -21,7 +21,6 @@ typedef void (QmpCommandFunc)(QDict *, QObject **, Error = **); =20 typedef enum QmpCommandOptions { - QCO_NO_OPTIONS =3D 0x0, QCO_NO_SUCCESS_RESP =3D (1U << 0), QCO_ALLOW_OOB =3D (1U << 1), QCO_ALLOW_PRECONFIG =3D (1U << 2), diff --git a/monitor/misc.c b/monitor/misc.c index ffe7966870..3556b177f6 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -230,8 +230,7 @@ static void monitor_init_qmp_commands(void) =20 qmp_init_marshal(&qmp_commands); =20 - qmp_register_command(&qmp_commands, "device_add", qmp_device_add, - QCO_NO_OPTIONS); + qmp_register_command(&qmp_commands, "device_add", qmp_device_add, 0); =20 QTAILQ_INIT(&qmp_cap_negotiation_commands); qmp_register_command(&qmp_cap_negotiation_commands, "qmp_capabilities", diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 3654825968..c8a975528f 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -229,15 +229,12 @@ def gen_register_command(name: str, if coroutine: options +=3D ['QCO_COROUTINE'] =20 - if not options: - options =3D ['QCO_NO_OPTIONS'] - ret =3D mcgen(''' qmp_register_command(cmds, "%(name)s", qmp_marshal_%(c_name)s, %(opts)s); ''', name=3Dname, c_name=3Dc_name(name), - opts=3D" | ".join(options)) + opts=3D' | '.join(options) or 0) return ret =20 =20 --=20 2.31.1 From nobody Sun Apr 28 06:04:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635139626; cv=none; d=zohomail.com; s=zohoarc; b=AxeRr85BmDw3SiLmWMqgbAXUXEHHafIixhGfvZqI3P+dFvBndF37ISXpML3VBIplYlE2Xvk8LtIOTpwbYSgfxDj7R2cVXiHDRYsoIM/hgYbN+hEtJSlaxhbIVs2LhaCchmgqMpdYf9ZnuMvIrxFtn+dj8Qv8d5F1wlPsuyRhy+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635139626; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QaSqOtQSZ3U6D/KP50cN1j58gfn+YZlEzo2vi3miaOk=; b=cGjMDSthgD1YEMbhLflhhehcpP3s0h7i3cj7x+Mm6vfDijNWYcWCrCZKg09FR7kee00vJIT+UG6yYB5nbwpD7Nop30A0ENFXRgydsYugxaUR1gdTLdIlgrDkWlCt+RPQWcRkDM+V/onf4ObXmshE3/BOAvAlTMY2zAfiAm8Msu8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1635139626366597.4903266534682; Sun, 24 Oct 2021 22:27:06 -0700 (PDT) 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-28-yjPAKZ6_NA6vJgQUVqEGsA-1; Mon, 25 Oct 2021 01:26:20 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B16828026AD; Mon, 25 Oct 2021 05:26:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8FC5C19D9D; Mon, 25 Oct 2021 05:26:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5427C4EA42; Mon, 25 Oct 2021 05:26:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19P5PmZ9019903 for ; Mon, 25 Oct 2021 01:25:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7264D5BAE6; Mon, 25 Oct 2021 05:25:48 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 498E160862; Mon, 25 Oct 2021 05:25:34 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id DB7B911380C3; Mon, 25 Oct 2021 07:25:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635139625; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=QaSqOtQSZ3U6D/KP50cN1j58gfn+YZlEzo2vi3miaOk=; b=d7BIqKDBAPjulupKGvo+kpwHGh4XygpDG21KI6j6Wo4T6eg3n6eeLdsRdEv4ghFBNc/5DZ zl5La3RAYUjtpeYmdMh7e6wGwhxWtil0gjl4zN7xKhY7qnxjmEiFjWqMNFdnla1/UHpsn8 PV+rPpxQGGXxLUhjmvaHEt4acYF1Pts= X-MC-Unique: yjPAKZ6_NA6vJgQUVqEGsA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 4/9] qapi: Tools for sets of special feature flags in generated code Date: Mon, 25 Oct 2021 07:25:27 +0200 Message-Id: <20211025052532.3859634-5-armbru@redhat.com> In-Reply-To: <20211025052532.3859634-1-armbru@redhat.com> References: <20211025052532.3859634-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, libvir-list@redhat.com, eblake@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, jsnow@redhat.com, libguestfs@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635139628338100005 Content-Type: text/plain; charset="utf-8" New enum QapiSpecialFeature enumerates the special feature flags. New helper gen_special_features() returns code to represent a collection of special feature flags as a bitset. The next few commits will put them to use. Signed-off-by: Markus Armbruster Reviewed-by: John Snow --- include/qapi/util.h | 4 ++++ scripts/qapi/gen.py | 13 +++++++++++++ scripts/qapi/schema.py | 3 +++ 3 files changed, 20 insertions(+) diff --git a/include/qapi/util.h b/include/qapi/util.h index 257c600f99..7a8d5c7d72 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -11,6 +11,10 @@ #ifndef QAPI_UTIL_H #define QAPI_UTIL_H =20 +typedef enum { + QAPI_DEPRECATED, +} QapiSpecialFeature; + /* QEnumLookup flags */ #define QAPI_ENUM_DEPRECATED 1 =20 diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 2ec1e7b3b6..9d07b88cf6 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -29,6 +29,7 @@ mcgen, ) from .schema import ( + QAPISchemaFeature, QAPISchemaIfCond, QAPISchemaModule, QAPISchemaObjectType, @@ -37,6 +38,18 @@ from .source import QAPISourceInfo =20 =20 +def gen_special_features(features: QAPISchemaFeature): + ret =3D '' + sep =3D '' + + for feat in features: + if feat.is_special(): + ret +=3D ('%s1u << QAPI_%s' % (sep, feat.name.upper())) + sep =3D ' | ' + + return ret or '0' + + class QAPIGen: def __init__(self, fname: str): self.fname =3D fname diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 6d5f46509a..55f82d7389 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -725,6 +725,9 @@ def connect_doc(self, doc): class QAPISchemaFeature(QAPISchemaMember): role =3D 'feature' =20 + def is_special(self): + return self.name in ('deprecated') + =20 class QAPISchemaObjectTypeMember(QAPISchemaMember): def __init__(self, name, info, typ, optional, ifcond=3DNone, features= =3DNone): --=20 2.31.1 From nobody Sun Apr 28 06:04:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635139579; cv=none; d=zohomail.com; s=zohoarc; b=CPCgSrazhjXC81tFMuH6iJlk9u0FMM/DSSdJ8XnxXbMrgEMmCOPttYG8NX4iWcwwPlbvE/BTIsyby2hAGaistobhsbmadV9AZgWNjhzyqtcTikwJhg2IqY6d62v6D3F9wDI9N899TNTVLcCQJ2Dgi/g4vkYQ2nNMNyq1wlgiX6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635139579; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0Pae19ZvE+tk/uq7rnhHFYh50rzZEaPr3MYzebwKmFw=; b=g8jnjCDB42oauMJ9GUSowXZbKqxe0yjzZZ92ABz0GHqLIQXA8C5M0fkXhB9mxhwy2Dc03A2i2BjIjU5+RDKYGZvTbWVATOh0T1U3qrp/dzThn2R5lblrBEP0cxDUlzUImVGKhVeN9URXJF2vQiulvQCwKwWMRXMlpLVGqkAhNOQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1635139579824788.732981838921; Sun, 24 Oct 2021 22:26:19 -0700 (PDT) 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-557-vyyJuiJ0PB2iUtfG7ImJzw-1; Mon, 25 Oct 2021 01:26:15 -0400 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 CF82B8066F5; Mon, 25 Oct 2021 05:26:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B09C460CA1; Mon, 25 Oct 2021 05:26:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7E6861832DD2; Mon, 25 Oct 2021 05:26:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19P5PlBS019880 for ; Mon, 25 Oct 2021 01:25:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 175AA5C3DF; Mon, 25 Oct 2021 05:25:47 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D32B5C25D; Mon, 25 Oct 2021 05:25:46 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id DEF2011380CA; Mon, 25 Oct 2021 07:25:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635139578; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0Pae19ZvE+tk/uq7rnhHFYh50rzZEaPr3MYzebwKmFw=; b=hw5K33S8/DTLTeRzHjaT9ssg1zXMcYGnXypxBNtVL8lZA2V5arZWAnGLoOpeIuBSJQj5uG 4Nc86XzCBzyvd0LlTngeFbVQNcD//uYmGnWTKunedLFsh45d92oBdsaezJQrYzalJkNI7d y0xmfY4mKM8XMInVNYL3yXJmtF5lBeQ= X-MC-Unique: vyyJuiJ0PB2iUtfG7ImJzw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 5/9] qapi: Generalize struct member policy checking Date: Mon, 25 Oct 2021 07:25:28 +0200 Message-Id: <20211025052532.3859634-6-armbru@redhat.com> In-Reply-To: <20211025052532.3859634-1-armbru@redhat.com> References: <20211025052532.3859634-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, libvir-list@redhat.com, eblake@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, jsnow@redhat.com, libguestfs@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635139581949100001 Content-Type: text/plain; charset="utf-8" The generated visitor functions call visit_deprecated_accept() and visit_deprecated() when visiting a struct member with special feature flag 'deprecated'. This makes the feature flag visible to the actual visitors. I want to make feature flag 'unstable' visible there as well, so I can add policy for it. To let me make it visible, replace these functions by visit_policy_reject() and visit_policy_skip(), which take the member's special features as an argument. Note that the new functions have the opposite sense, i.e. the return value flips. Signed-off-by: Markus Armbruster --- include/qapi/visitor-impl.h | 6 ++++-- include/qapi/visitor.h | 17 +++++++++++++---- qapi/qapi-forward-visitor.c | 16 +++++++++------- qapi/qapi-visit-core.c | 22 ++++++++++++---------- qapi/qobject-input-visitor.c | 15 ++++++++++----- qapi/qobject-output-visitor.c | 9 ++++++--- qapi/trace-events | 4 ++-- scripts/qapi/visit.py | 14 +++++++------- 8 files changed, 63 insertions(+), 40 deletions(-) diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h index 72b6537bef..2badec5ba4 100644 --- a/include/qapi/visitor-impl.h +++ b/include/qapi/visitor-impl.h @@ -114,10 +114,12 @@ struct Visitor void (*optional)(Visitor *v, const char *name, bool *present); =20 /* Optional */ - bool (*deprecated_accept)(Visitor *v, const char *name, Error **errp); + bool (*policy_reject)(Visitor *v, const char *name, + unsigned special_features, Error **errp); =20 /* Optional */ - bool (*deprecated)(Visitor *v, const char *name); + bool (*policy_skip)(Visitor *v, const char *name, + unsigned special_features); =20 /* Must be set */ VisitorType type; diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h index dcb96018a9..d53a84c9ba 100644 --- a/include/qapi/visitor.h +++ b/include/qapi/visitor.h @@ -461,22 +461,31 @@ void visit_end_alternate(Visitor *v, void **obj); bool visit_optional(Visitor *v, const char *name, bool *present); =20 /* - * Should we reject deprecated member @name? + * Should we reject member @name due to policy? + * + * @special_features is the member's special features encoded as a + * bitset of QapiSpecialFeature. * * @name must not be NULL. This function is only useful between * visit_start_struct() and visit_end_struct(), since only objects * have deprecated members. */ -bool visit_deprecated_accept(Visitor *v, const char *name, Error **errp); +bool visit_policy_reject(Visitor *v, const char *name, + unsigned special_features, Error **errp); =20 /* - * Should we visit deprecated member @name? + * + * Should we skip member @name due to policy? + * + * @special_features is the member's special features encoded as a + * bitset of QapiSpecialFeature. * * @name must not be NULL. This function is only useful between * visit_start_struct() and visit_end_struct(), since only objects * have deprecated members. */ -bool visit_deprecated(Visitor *v, const char *name); +bool visit_policy_skip(Visitor *v, const char *name, + unsigned special_features); =20 /* * Set policy for handling deprecated management interfaces. diff --git a/qapi/qapi-forward-visitor.c b/qapi/qapi-forward-visitor.c index a4b111e22a..25d098aa8a 100644 --- a/qapi/qapi-forward-visitor.c +++ b/qapi/qapi-forward-visitor.c @@ -246,25 +246,27 @@ static void forward_field_optional(Visitor *v, const = char *name, bool *present) visit_optional(ffv->target, name, present); } =20 -static bool forward_field_deprecated_accept(Visitor *v, const char *name, - Error **errp) +static bool forward_field_policy_reject(Visitor *v, const char *name, + unsigned special_features, + Error **errp) { ForwardFieldVisitor *ffv =3D to_ffv(v); =20 if (!forward_field_translate_name(ffv, &name, errp)) { return false; } - return visit_deprecated_accept(ffv->target, name, errp); + return visit_policy_reject(ffv->target, name, special_features, errp); } =20 -static bool forward_field_deprecated(Visitor *v, const char *name) +static bool forward_field_policy_skip(Visitor *v, const char *name, + unsigned special_features) { ForwardFieldVisitor *ffv =3D to_ffv(v); =20 if (!forward_field_translate_name(ffv, &name, NULL)) { return false; } - return visit_deprecated(ffv->target, name); + return visit_policy_skip(ffv->target, name, special_features); } =20 static void forward_field_complete(Visitor *v, void *opaque) @@ -313,8 +315,8 @@ Visitor *visitor_forward_field(Visitor *target, const c= har *from, const char *to v->visitor.type_any =3D forward_field_type_any; v->visitor.type_null =3D forward_field_type_null; v->visitor.optional =3D forward_field_optional; - v->visitor.deprecated_accept =3D forward_field_deprecated_accept; - v->visitor.deprecated =3D forward_field_deprecated; + v->visitor.policy_reject =3D forward_field_policy_reject; + v->visitor.policy_skip =3D forward_field_policy_skip; v->visitor.complete =3D forward_field_complete; v->visitor.free =3D forward_field_free; =20 diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 49136ae88e..b4a81f1757 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -139,22 +139,24 @@ bool visit_optional(Visitor *v, const char *name, boo= l *present) return *present; } =20 -bool visit_deprecated_accept(Visitor *v, const char *name, Error **errp) +bool visit_policy_reject(Visitor *v, const char *name, + unsigned special_features, Error **errp) { - trace_visit_deprecated_accept(v, name); - if (v->deprecated_accept) { - return v->deprecated_accept(v, name, errp); + trace_visit_policy_reject(v, name); + if (v->policy_reject) { + return v->policy_reject(v, name, special_features, errp); } - return true; + return false; } =20 -bool visit_deprecated(Visitor *v, const char *name) +bool visit_policy_skip(Visitor *v, const char *name, + unsigned special_features) { - trace_visit_deprecated(v, name); - if (v->deprecated) { - return v->deprecated(v, name); + trace_visit_policy_skip(v, name); + if (v->policy_skip) { + return v->policy_skip(v, name, special_features); } - return true; + return false; } =20 void visit_set_policy(Visitor *v, CompatPolicy *policy) diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c index 71b24a4429..fda485614b 100644 --- a/qapi/qobject-input-visitor.c +++ b/qapi/qobject-input-visitor.c @@ -662,16 +662,21 @@ static void qobject_input_optional(Visitor *v, const = char *name, bool *present) *present =3D true; } =20 -static bool qobject_input_deprecated_accept(Visitor *v, const char *name, - Error **errp) +static bool qobject_input_policy_reject(Visitor *v, const char *name, + unsigned special_features, + Error **errp) { + if (!(special_features && 1u << QAPI_DEPRECATED)) { + return false; + } + switch (v->compat_policy.deprecated_input) { case COMPAT_POLICY_INPUT_ACCEPT: - return true; + return false; case COMPAT_POLICY_INPUT_REJECT: error_setg(errp, "Deprecated parameter '%s' disabled by policy", name); - return false; + return true; case COMPAT_POLICY_INPUT_CRASH: default: abort(); @@ -712,7 +717,7 @@ static QObjectInputVisitor *qobject_input_visitor_base_= new(QObject *obj) v->visitor.end_list =3D qobject_input_end_list; v->visitor.start_alternate =3D qobject_input_start_alternate; v->visitor.optional =3D qobject_input_optional; - v->visitor.deprecated_accept =3D qobject_input_deprecated_accept; + v->visitor.policy_reject =3D qobject_input_policy_reject; v->visitor.free =3D qobject_input_free; =20 v->root =3D qobject_ref(obj); diff --git a/qapi/qobject-output-visitor.c b/qapi/qobject-output-visitor.c index 9b7f510036..b5c6564cbb 100644 --- a/qapi/qobject-output-visitor.c +++ b/qapi/qobject-output-visitor.c @@ -13,6 +13,7 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/compat-policy.h" #include "qapi/qobject-output-visitor.h" #include "qapi/visitor-impl.h" #include "qemu/queue.h" @@ -208,9 +209,11 @@ static bool qobject_output_type_null(Visitor *v, const= char *name, return true; } =20 -static bool qobject_output_deprecated(Visitor *v, const char *name) +static bool qobject_output_policy_skip(Visitor *v, const char *name, + unsigned special_features) { - return v->compat_policy.deprecated_output !=3D COMPAT_POLICY_OUTPUT_HI= DE; + return !(special_features && 1u << QAPI_DEPRECATED) + || v->compat_policy.deprecated_output =3D=3D COMPAT_POLICY_OUTPUT_= HIDE; } =20 /* Finish building, and return the root object. @@ -262,7 +265,7 @@ Visitor *qobject_output_visitor_new(QObject **result) v->visitor.type_number =3D qobject_output_type_number; v->visitor.type_any =3D qobject_output_type_any; v->visitor.type_null =3D qobject_output_type_null; - v->visitor.deprecated =3D qobject_output_deprecated; + v->visitor.policy_skip =3D qobject_output_policy_skip; v->visitor.complete =3D qobject_output_complete; v->visitor.free =3D qobject_output_free; =20 diff --git a/qapi/trace-events b/qapi/trace-events index cccafc07e5..ab108c4f0e 100644 --- a/qapi/trace-events +++ b/qapi/trace-events @@ -17,8 +17,8 @@ visit_start_alternate(void *v, const char *name, void *ob= j, size_t size) "v=3D%p n visit_end_alternate(void *v, void *obj) "v=3D%p obj=3D%p" =20 visit_optional(void *v, const char *name, bool *present) "v=3D%p name=3D%s= present=3D%p" -visit_deprecated_accept(void *v, const char *name) "v=3D%p name=3D%s" -visit_deprecated(void *v, const char *name) "v=3D%p name=3D%s" +visit_policy_reject(void *v, const char *name) "v=3D%p name=3D%s" +visit_policy_skip(void *v, const char *name) "v=3D%p name=3D%s" =20 visit_type_enum(void *v, const char *name, int *obj) "v=3D%p name=3D%s obj= =3D%p" visit_type_int(void *v, const char *name, int64_t *obj) "v=3D%p name=3D%s = obj=3D%p" diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 9d9196a143..e13bbe4292 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -21,7 +21,7 @@ indent, mcgen, ) -from .gen import QAPISchemaModularCVisitor, ifcontext +from .gen import QAPISchemaModularCVisitor, gen_special_features, ifcontext from .schema import ( QAPISchema, QAPISchemaEnumMember, @@ -76,7 +76,6 @@ def gen_visit_object_members(name: str, c_type=3Dbase.c_name()) =20 for memb in members: - deprecated =3D 'deprecated' in [f.name for f in memb.features] ret +=3D memb.ifcond.gen_if() if memb.optional: ret +=3D mcgen(''' @@ -84,14 +83,15 @@ def gen_visit_object_members(name: str, ''', name=3Dmemb.name, c_name=3Dc_name(memb.name)) indent.increase() - if deprecated: + special_features =3D gen_special_features(memb.features) + if special_features !=3D '0': ret +=3D mcgen(''' - if (!visit_deprecated_accept(v, "%(name)s", errp)) { + if (visit_policy_reject(v, "%(name)s", %(special_features)s, errp)) { return false; } - if (visit_deprecated(v, "%(name)s")) { + if (!visit_policy_skip(v, "%(name)s", %(special_features)s)) { ''', - name=3Dmemb.name) + name=3Dmemb.name, special_features=3Dspecial_feat= ures) indent.increase() ret +=3D mcgen(''' if (!visit_type_%(c_type)s(v, "%(name)s", &obj->%(c_name)s, errp)) { @@ -100,7 +100,7 @@ def gen_visit_object_members(name: str, ''', c_type=3Dmemb.type.c_name(), name=3Dmemb.name, c_name=3Dc_name(memb.name)) - if deprecated: + if special_features !=3D '0': indent.decrease() ret +=3D mcgen(''' } --=20 2.31.1 From nobody Sun Apr 28 06:04:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635139569; cv=none; d=zohomail.com; s=zohoarc; b=cuKJ//VdW/t1n5mG8u8pvAovN7zy3HZrp/O9wHnVjM122+iwQAr6PVNYjX3XGzJuPIum3fgRTFmMltGkZeS0SxtgPxApz+RuA2NgqDxj2ym+VVlHGqpA82RRahH2NERBAiS3H4dhYQzafzvb16c2freipmrvWOYmJIFFdOdLQYQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635139569; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Bjp40QDMjzLp4z/JRZN/dq3S4AhYW7hNmIAirog1dOg=; b=gaSBRgEkGu89S2dFsMWmY+RsE8cmS6WmKXgtqnlXjhO6fbKj6T2huYegfbxWwyF9L8m7z4U3ZgCM1mg89NcIFrISsJW67Idk9gKZFFoV4q9l2yWzR7iClz8s1d2L/3fg8M4ZI+tTBKV/bPo3cPA3JzHwTWM4lZx00cNx678rGVE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1635139569894252.82266255343552; Sun, 24 Oct 2021 22:26:09 -0700 (PDT) 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-187-ArdxBVjFOMmZKzqs0qnElQ-1; Mon, 25 Oct 2021 01:26:07 -0400 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 32B8B8066FB; Mon, 25 Oct 2021 05:26:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 151195C1CF; Mon, 25 Oct 2021 05:26:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 39E844EA2A; Mon, 25 Oct 2021 05:26:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19P5Ps0L019948 for ; Mon, 25 Oct 2021 01:25:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1C1F360CC9; Mon, 25 Oct 2021 05:25:54 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D6D060BF4; Mon, 25 Oct 2021 05:25:46 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id E25B011380CD; Mon, 25 Oct 2021 07:25:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635139568; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Bjp40QDMjzLp4z/JRZN/dq3S4AhYW7hNmIAirog1dOg=; b=G1GIewBKvBXBGhBvWvSE5QDRu4qmw563aiSR8FkDEhDU9RUDSw9FgJ7QxeMc/1probIyQj qXwZo0US509SObpCzl/ed3zyX6Rk0IMUrjv4vlizPAU4c+9gHScDh3XyHrAhKN6FA6xnE3 4+V2LRmpe/OZq8zmZ7YO+rCjxkRYkNY= X-MC-Unique: ArdxBVjFOMmZKzqs0qnElQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 6/9] qapi: Generalize command policy checking Date: Mon, 25 Oct 2021 07:25:29 +0200 Message-Id: <20211025052532.3859634-7-armbru@redhat.com> In-Reply-To: <20211025052532.3859634-1-armbru@redhat.com> References: <20211025052532.3859634-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, libvir-list@redhat.com, eblake@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, jsnow@redhat.com, libguestfs@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635139571185100002 Content-Type: text/plain; charset="utf-8" The code to check command policy can see special feature flag 'deprecated' as command flag QCO_DEPRECATED. I want to make feature flag 'unstable' visible there as well, so I can add policy for it. To let me make it visible, add member @special_features (a bitset of QapiSpecialFeature) to QmpCommand, and adjust the generator to pass it through qmp_register_command(). Then replace "QCO_DEPRECATED in @flags" by QAPI_DEPRECATED in @special_features", and drop QCO_DEPRECATED. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/qapi/qmp/dispatch.h | 5 +++-- monitor/misc.c | 6 ++++-- qapi/qmp-dispatch.c | 2 +- qapi/qmp-registry.c | 4 +++- storage-daemon/qemu-storage-daemon.c | 3 ++- scripts/qapi/commands.py | 9 ++++----- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index 0ce88200b9..1e4240fd0d 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -25,7 +25,6 @@ typedef enum QmpCommandOptions QCO_ALLOW_OOB =3D (1U << 1), QCO_ALLOW_PRECONFIG =3D (1U << 2), QCO_COROUTINE =3D (1U << 3), - QCO_DEPRECATED =3D (1U << 4), } QmpCommandOptions; =20 typedef struct QmpCommand @@ -34,6 +33,7 @@ typedef struct QmpCommand /* Runs in coroutine context if QCO_COROUTINE is set */ QmpCommandFunc *fn; QmpCommandOptions options; + unsigned special_features; QTAILQ_ENTRY(QmpCommand) node; bool enabled; const char *disable_reason; @@ -42,7 +42,8 @@ typedef struct QmpCommand typedef QTAILQ_HEAD(QmpCommandList, QmpCommand) QmpCommandList; =20 void qmp_register_command(QmpCommandList *cmds, const char *name, - QmpCommandFunc *fn, QmpCommandOptions options); + QmpCommandFunc *fn, QmpCommandOptions options, + unsigned special_features); const QmpCommand *qmp_find_command(const QmpCommandList *cmds, const char *name); void qmp_disable_command(QmpCommandList *cmds, const char *name, diff --git a/monitor/misc.c b/monitor/misc.c index 3556b177f6..c2d227a07c 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -230,11 +230,13 @@ static void monitor_init_qmp_commands(void) =20 qmp_init_marshal(&qmp_commands); =20 - qmp_register_command(&qmp_commands, "device_add", qmp_device_add, 0); + qmp_register_command(&qmp_commands, "device_add", + qmp_device_add, 0, 0); =20 QTAILQ_INIT(&qmp_cap_negotiation_commands); qmp_register_command(&qmp_cap_negotiation_commands, "qmp_capabilities", - qmp_marshal_qmp_capabilities, QCO_ALLOW_PRECONFIG= ); + qmp_marshal_qmp_capabilities, + QCO_ALLOW_PRECONFIG, 0); } =20 /* Set the current CPU defined by the user. Callers must hold BQL. */ diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 7e943a0af5..8cca18c891 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -176,7 +176,7 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject= *request, "The command %s has not been found", command); goto out; } - if (cmd->options & QCO_DEPRECATED) { + if (cmd->special_features & 1u << QAPI_DEPRECATED) { switch (compat_policy.deprecated_input) { case COMPAT_POLICY_INPUT_ACCEPT: break; diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c index f78c064aae..485bc5e6fc 100644 --- a/qapi/qmp-registry.c +++ b/qapi/qmp-registry.c @@ -16,7 +16,8 @@ #include "qapi/qmp/dispatch.h" =20 void qmp_register_command(QmpCommandList *cmds, const char *name, - QmpCommandFunc *fn, QmpCommandOptions options) + QmpCommandFunc *fn, QmpCommandOptions options, + unsigned special_features) { QmpCommand *cmd =3D g_malloc0(sizeof(*cmd)); =20 @@ -27,6 +28,7 @@ void qmp_register_command(QmpCommandList *cmds, const cha= r *name, cmd->fn =3D fn; cmd->enabled =3D true; cmd->options =3D options; + cmd->special_features =3D special_features; QTAILQ_INSERT_TAIL(cmds, cmd, node); } =20 diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-sto= rage-daemon.c index 10a1a33761..52cf17e8ac 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -146,7 +146,8 @@ static void init_qmp_commands(void) =20 QTAILQ_INIT(&qmp_cap_negotiation_commands); qmp_register_command(&qmp_cap_negotiation_commands, "qmp_capabilities", - qmp_marshal_qmp_capabilities, QCO_ALLOW_PRECONFIG= ); + qmp_marshal_qmp_capabilities, + QCO_ALLOW_PRECONFIG, 0); } =20 static int getopt_set_loc(int argc, char **argv, const char *optstring, diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index c8a975528f..21001bbd6b 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -26,6 +26,7 @@ QAPISchemaModularCVisitor, build_params, ifcontext, + gen_special_features, ) from .schema import ( QAPISchema, @@ -217,9 +218,6 @@ def gen_register_command(name: str, coroutine: bool) -> str: options =3D [] =20 - if 'deprecated' in [f.name for f in features]: - options +=3D ['QCO_DEPRECATED'] - if not success_response: options +=3D ['QCO_NO_SUCCESS_RESP'] if allow_oob: @@ -231,10 +229,11 @@ def gen_register_command(name: str, =20 ret =3D mcgen(''' qmp_register_command(cmds, "%(name)s", - qmp_marshal_%(c_name)s, %(opts)s); + qmp_marshal_%(c_name)s, %(opts)s, %(feats)s); ''', name=3Dname, c_name=3Dc_name(name), - opts=3D' | '.join(options) or 0) + opts=3D' | '.join(options) or 0, + feats=3Dgen_special_features(features)) return ret =20 =20 --=20 2.31.1 From nobody Sun Apr 28 06:04:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635139591; cv=none; d=zohomail.com; s=zohoarc; b=breQNxYKavwNDGOGrhBuPBVSxh0jFks6Sp8/eDpANx9U487e4gMFjiFgyccVlzYF1gaROZqS5xe/fZQ/hvshzgeOZY8Mi1vyA06ZQwqwjb002AeU3cZ79bz5Ur9YZvP6U1PhuqAvZu0+PVGjUhiL3gSTqaOzNG9t0Pp/W/nxG+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635139591; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Io7pCakK7oxbs6TfwoCw9fOsoLesVQPLShOHgc7y95c=; b=FI1zdD95cdNN2NL0eGWZyKDVG8D0mmTefbPcKIaX0tHigaUi9BX3E2xQljJDZo0Jlmy5XUwV0VjskcJeIEMC5HSelE0xhppJr4pKJpQvkN+/BO5gznIZ7cyKVLyPfZx0BiVG15b6t9M2tWnhXuM4f/pGiIplbysEiQGhWiJFWT0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1635139591580274.2593597682985; Sun, 24 Oct 2021 22:26:31 -0700 (PDT) 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-225-w6ZpZAT3OCCq62ynxyz-nQ-1; Mon, 25 Oct 2021 01:26:27 -0400 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 27A1218125C0; Mon, 25 Oct 2021 05:26:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DEF7A5C1CF; Mon, 25 Oct 2021 05:26:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 873504EA47; Mon, 25 Oct 2021 05:26:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19P5Pumh019979 for ; Mon, 25 Oct 2021 01:25:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 856815E27A; Mon, 25 Oct 2021 05:25:56 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 511155DD68; Mon, 25 Oct 2021 05:25:48 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id E5C3411380CF; Mon, 25 Oct 2021 07:25:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635139590; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Io7pCakK7oxbs6TfwoCw9fOsoLesVQPLShOHgc7y95c=; b=duYDpvWJrgcFA3LWpGic+gQ75GeRSu+mhnPzOK2bpmzm+XIoE/ngOZH1Jw8YT+RspLnqlE fzN5OEtDrP9yZNBjwnGylUu72KhcjuSfpN+AH/SY5c88lRr9SzJXUGBRO4cI48pKatIddw s53oziZJN9cp9wVTmi4J1374BkTDzgY= X-MC-Unique: w6ZpZAT3OCCq62ynxyz-nQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 7/9] qapi: Generalize enum member policy checking Date: Mon, 25 Oct 2021 07:25:30 +0200 Message-Id: <20211025052532.3859634-8-armbru@redhat.com> In-Reply-To: <20211025052532.3859634-1-armbru@redhat.com> References: <20211025052532.3859634-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, libvir-list@redhat.com, eblake@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, jsnow@redhat.com, libguestfs@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635139592429100003 Content-Type: text/plain; charset="utf-8" The code to check enumeration value policy can see special feature flag 'deprecated' in QEnumLookup member flags[value]. I want to make feature flag 'unstable' visible there as well, so I can add policy for it. Instead of extending flags[], replace it by @special_features (a bitset of QapiSpecialFeature), because that's how special features get passed around elsewhere. Signed-off-by: Markus Armbruster --- include/qapi/util.h | 5 +---- qapi/qapi-visit-core.c | 3 ++- scripts/qapi/types.py | 22 ++++++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/qapi/util.h b/include/qapi/util.h index 7a8d5c7d72..0cc98db9f9 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -15,12 +15,9 @@ typedef enum { QAPI_DEPRECATED, } QapiSpecialFeature; =20 -/* QEnumLookup flags */ -#define QAPI_ENUM_DEPRECATED 1 - typedef struct QEnumLookup { const char *const *array; - const unsigned char *const flags; + const unsigned char *const special_features; const int size; } QEnumLookup; =20 diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index b4a81f1757..5572d90efb 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -407,7 +407,8 @@ static bool input_type_enum(Visitor *v, const char *nam= e, int *obj, return false; } =20 - if (lookup->flags && (lookup->flags[value] & QAPI_ENUM_DEPRECATED)) { + if (lookup->special_features + && (lookup->special_features[value] & QAPI_DEPRECATED)) { switch (v->compat_policy.deprecated_input) { case COMPAT_POLICY_INPUT_ACCEPT: break; diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index ab2441adc9..3013329c24 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -16,7 +16,7 @@ from typing import List, Optional =20 from .common import c_enum_const, c_name, mcgen -from .gen import QAPISchemaModularCVisitor, ifcontext +from .gen import QAPISchemaModularCVisitor, gen_special_features, ifcontext from .schema import ( QAPISchema, QAPISchemaEnumMember, @@ -39,7 +39,7 @@ def gen_enum_lookup(name: str, members: List[QAPISchemaEnumMember], prefix: Optional[str] =3D None) -> str: max_index =3D c_enum_const(name, '_MAX', prefix) - flags =3D '' + feats =3D '' ret =3D mcgen(''' =20 const QEnumLookup %(c_name)s_lookup =3D { @@ -54,19 +54,21 @@ def gen_enum_lookup(name: str, ''', index=3Dindex, name=3Dmemb.name) ret +=3D memb.ifcond.gen_endif() - if 'deprecated' in (f.name for f in memb.features): - flags +=3D mcgen(''' - [%(index)s] =3D QAPI_ENUM_DEPRECATED, -''', - index=3Dindex) =20 - if flags: + special_features =3D gen_special_features(memb.features) + if special_features !=3D '0': + feats +=3D mcgen(''' + [%(index)s] =3D %(special_features)s, +''', + index=3Dindex, special_features=3Dspecial_featu= res) + + if feats: ret +=3D mcgen(''' }, - .flags =3D (const unsigned char[%(max_index)s]) { + .special_features =3D (const unsigned char[%(max_index)s]) { ''', max_index=3Dmax_index) - ret +=3D flags + ret +=3D feats =20 ret +=3D mcgen(''' }, --=20 2.31.1 From nobody Sun Apr 28 06:04:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635139588; cv=none; d=zohomail.com; s=zohoarc; b=oApM21C7f9MUf+ShnjytmntyQz45pIi80Gv8O+PwYYs5iUXay7YvOFYPX+/P+Hv0CrJuzY5MddqDUJEt0o5Pj7Wi24tPLB9Nb9EgvBLH4GhvisoLM7bQAmanck/n7IOoKv4zmr6QeuNgdVCsHw9UxeKz3sbt265AmCRfC1uPvFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635139588; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oF/u+7yzNgoR0V/qcbv1ULm/WjtSZsUmTuuPt552BGs=; b=WXlxf5CpCT0qUtH2QK8SuFbzv2iqc9wpdBjEAcruyi0w/70wTnMnWRnk6YVinwPpXxv61Bl5BLGtqncmx/6R1v/ERHQVhiHSn4BKQOiXcaPsVLuOTx7/knL93EumpR2rD2i5bmqjO9ZTrEmZ6xyxhoP/wnktUacuthyA3ozN6mU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1635139588383819.0938635484864; Sun, 24 Oct 2021 22:26:28 -0700 (PDT) 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-554-jRK35j0VOVCboM4ReXxIkQ-1; Mon, 25 Oct 2021 01:26:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 276F410B3940; Mon, 25 Oct 2021 05:26:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06C9D641AB; Mon, 25 Oct 2021 05:26:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C38661832DF0; Mon, 25 Oct 2021 05:26:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19P5Ps6u019950 for ; Mon, 25 Oct 2021 01:25:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 24172610DF; Mon, 25 Oct 2021 05:25:54 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 54AA060CC4; Mon, 25 Oct 2021 05:25:48 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id E937B11380D7; Mon, 25 Oct 2021 07:25:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635139587; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=oF/u+7yzNgoR0V/qcbv1ULm/WjtSZsUmTuuPt552BGs=; b=UAGR8llDwhe0k3txYUzsqGc89SZzmlJbZn+5mLLc6Uk+rfBpe31NtjciYbW2CRjeO791k7 bPJRfLmSzwmnrlP+A6U3bG121eMyNt6Ftj3IhcX3Qkr+p/++egN78iYeGEpH4px1DdLyCt 3Cq/hzvAlupTzNGxiIzKBEV5WEN3obc= X-MC-Unique: jRK35j0VOVCboM4ReXxIkQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 8/9] qapi: Factor out compat_policy_input_ok() Date: Mon, 25 Oct 2021 07:25:31 +0200 Message-Id: <20211025052532.3859634-9-armbru@redhat.com> In-Reply-To: <20211025052532.3859634-1-armbru@redhat.com> References: <20211025052532.3859634-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, libvir-list@redhat.com, eblake@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, jsnow@redhat.com, libguestfs@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635139590216100001 Content-Type: text/plain; charset="utf-8" The code to check policy for handling deprecated input is triplicated. Factor it out into compat_policy_input_ok() before I mess with it in the next commit. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/qapi/compat-policy.h | 7 +++++ qapi/qapi-visit-core.c | 18 +++++-------- qapi/qmp-dispatch.c | 51 +++++++++++++++++++++++++++--------- qapi/qobject-input-visitor.c | 19 +++----------- 4 files changed, 55 insertions(+), 40 deletions(-) diff --git a/include/qapi/compat-policy.h b/include/qapi/compat-policy.h index 1083f95122..8b7b25c0b5 100644 --- a/include/qapi/compat-policy.h +++ b/include/qapi/compat-policy.h @@ -13,10 +13,17 @@ #ifndef QAPI_COMPAT_POLICY_H #define QAPI_COMPAT_POLICY_H =20 +#include "qapi/error.h" #include "qapi/qapi-types-compat.h" =20 extern CompatPolicy compat_policy; =20 +bool compat_policy_input_ok(unsigned special_features, + const CompatPolicy *policy, + ErrorClass error_class, + const char *kind, const char *name, + Error **errp); + /* * Create a QObject input visitor for @obj for use with QMP * diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 5572d90efb..a1ddfe8831 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -13,6 +13,7 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qapi/visitor.h" @@ -408,18 +409,11 @@ static bool input_type_enum(Visitor *v, const char *n= ame, int *obj, } =20 if (lookup->special_features - && (lookup->special_features[value] & QAPI_DEPRECATED)) { - switch (v->compat_policy.deprecated_input) { - case COMPAT_POLICY_INPUT_ACCEPT: - break; - case COMPAT_POLICY_INPUT_REJECT: - error_setg(errp, "Deprecated value '%s' disabled by policy", - enum_str); - return false; - case COMPAT_POLICY_INPUT_CRASH: - default: - abort(); - } + && !compat_policy_input_ok(lookup->special_features[value], + &v->compat_policy, + ERROR_CLASS_GENERIC_ERROR, + "value", enum_str, errp)) { + return false; } =20 *obj =3D value; diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 8cca18c891..e29ade134c 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -28,6 +28,40 @@ =20 CompatPolicy compat_policy; =20 +static bool compat_policy_input_ok1(const char *adjective, + CompatPolicyInput policy, + ErrorClass error_class, + const char *kind, const char *name, + Error **errp) +{ + switch (policy) { + case COMPAT_POLICY_INPUT_ACCEPT: + return true; + case COMPAT_POLICY_INPUT_REJECT: + error_set(errp, error_class, "%s %s %s disabled by policy", + adjective, kind, name); + return false; + case COMPAT_POLICY_INPUT_CRASH: + default: + abort(); + } +} + +bool compat_policy_input_ok(unsigned special_features, + const CompatPolicy *policy, + ErrorClass error_class, + const char *kind, const char *name, + Error **errp) +{ + if ((special_features & 1u << QAPI_DEPRECATED) + && !compat_policy_input_ok1("Deprecated", + policy->deprecated_input, + error_class, kind, name, errp)) { + return false; + } + return true; +} + Visitor *qobject_input_visitor_new_qmp(QObject *obj) { Visitor *v =3D qobject_input_visitor_new(obj); @@ -176,19 +210,10 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObje= ct *request, "The command %s has not been found", command); goto out; } - if (cmd->special_features & 1u << QAPI_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 (!compat_policy_input_ok(cmd->special_features, &compat_policy, + ERROR_CLASS_COMMAND_NOT_FOUND, + "command", command, &err)) { + goto out; } if (!cmd->enabled) { error_set(&err, ERROR_CLASS_COMMAND_NOT_FOUND, diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c index fda485614b..f0b4c7ca9d 100644 --- a/qapi/qobject-input-visitor.c +++ b/qapi/qobject-input-visitor.c @@ -14,6 +14,7 @@ =20 #include "qemu/osdep.h" #include +#include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qobject-input-visitor.h" #include "qapi/visitor-impl.h" @@ -666,21 +667,9 @@ static bool qobject_input_policy_reject(Visitor *v, co= nst char *name, unsigned special_features, Error **errp) { - if (!(special_features && 1u << QAPI_DEPRECATED)) { - return false; - } - - switch (v->compat_policy.deprecated_input) { - case COMPAT_POLICY_INPUT_ACCEPT: - return false; - case COMPAT_POLICY_INPUT_REJECT: - error_setg(errp, "Deprecated parameter '%s' disabled by policy", - name); - return true; - case COMPAT_POLICY_INPUT_CRASH: - default: - abort(); - } + return !compat_policy_input_ok(special_features, &v->compat_policy, + ERROR_CLASS_GENERIC_ERROR, + "parameter", name, errp); } =20 static void qobject_input_free(Visitor *v) --=20 2.31.1 From nobody Sun Apr 28 06:04:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635139625; cv=none; d=zohomail.com; s=zohoarc; b=ISiTaEU4qNLHoTnfQ5cskbdyC3+P6GDsopwedNCPkXALPCPLGdhM+HuBJ5UCYYVSEc7UOeg9MgJ6yQbImAjZ056CVG0pQaJZ/ZhB4WWUl8gkANnFFnR1U4W46nq5kZKCWbjCLAbMS5LDE8ZQsMDvOyU/zFwiEKufIEzKI+h2kw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635139625; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/m+AypTWJYVTQCgIyqvbrAEciwDG3N/8VGi7fimUx0E=; b=dOihQX0I64NgEgHTKI/ESVjGkOc+ADJBIpa0nNzfJpK7kRNbZ8ERBw8FxfFd0zhqsxbKtqlxXW5xgkjx54mOfOD0ZUfpC1uQ/6yd3hFcmnCOxrH1nRPueBYu8bJISL9wVoDItP5eFrM+6opdfYVHlIQ8BRk8oqC8KP2g/A4rEro= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1635139625950132.98590674400168; Sun, 24 Oct 2021 22:27:05 -0700 (PDT) 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-63-29o7XtVyPHKDSeP0ZFTS9A-1; Mon, 25 Oct 2021 01:26:35 -0400 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 CBBE88066F4; Mon, 25 Oct 2021 05:26:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF59613ABD; Mon, 25 Oct 2021 05:26:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7CB291832DF9; Mon, 25 Oct 2021 05:26:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19P5QS7g020333 for ; Mon, 25 Oct 2021 01:26:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id C415D69FBB; Mon, 25 Oct 2021 05:26:28 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7354069CBE; Mon, 25 Oct 2021 05:25:48 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id EC99B11380DF; Mon, 25 Oct 2021 07:25:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635139625; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/m+AypTWJYVTQCgIyqvbrAEciwDG3N/8VGi7fimUx0E=; b=FPShQ9qLl45Os9OINgrWtLfnR7EvbdzBVJz7p8j3QPy/3iXB92l15GUWYoUExrg8DRo3aT e84Vssu1vUTTPjG60BHVFD3TrzD7K43XbqI2cOUGqtfvvnRamEqoMocb069PvR62xAJrnH pj/fl1dECYbJxZgAKzH8xHWET906wOg= X-MC-Unique: 29o7XtVyPHKDSeP0ZFTS9A-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 9/9] qapi: Extend -compat to set policy for unstable interfaces Date: Mon, 25 Oct 2021 07:25:32 +0200 Message-Id: <20211025052532.3859634-10-armbru@redhat.com> In-Reply-To: <20211025052532.3859634-1-armbru@redhat.com> References: <20211025052532.3859634-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, libvir-list@redhat.com, eblake@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, jsnow@redhat.com, libguestfs@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635139626378100003 Content-Type: text/plain; charset="utf-8" New option parameters unstable-input and unstable-output set policy for unstable interfaces just like deprecated-input and deprecated-output set policy for deprecated interfaces (see commit 6dd75472d5 "qemu-options: New -compat to set policy for deprecated interfaces"). This is intended for testing users of the management interfaces. It is experimental. For now, this covers only syntactic aspects of QMP, i.e. stuff tagged with feature 'unstable'. We may want to extend it to cover semantic aspects, or the command line. Note that there is no good way for management application to detect presence of these new option parameters: they are 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 --- qapi/compat.json | 6 +++++- include/qapi/util.h | 1 + qapi/qmp-dispatch.c | 6 ++++++ qapi/qobject-output-visitor.c | 8 ++++++-- qemu-options.hx | 20 +++++++++++++++++++- scripts/qapi/events.py | 10 ++++++---- scripts/qapi/schema.py | 10 ++++++---- 7 files changed, 49 insertions(+), 12 deletions(-) diff --git a/qapi/compat.json b/qapi/compat.json index 74a8493d3d..9bc9804abb 100644 --- a/qapi/compat.json +++ b/qapi/compat.json @@ -47,9 +47,13 @@ # # @deprecated-input: how to handle deprecated input (default 'accept') # @deprecated-output: how to handle deprecated output (default 'accept') +# @unstable-input: how to handle unstable input (default 'accept') +# @unstable-output: how to handle unstable output (default 'accept') # # Since: 6.0 ## { 'struct': 'CompatPolicy', 'data': { '*deprecated-input': 'CompatPolicyInput', - '*deprecated-output': 'CompatPolicyOutput' } } + '*deprecated-output': 'CompatPolicyOutput', + '*unstable-input': 'CompatPolicyInput', + '*unstable-output': 'CompatPolicyOutput' } } diff --git a/include/qapi/util.h b/include/qapi/util.h index 0cc98db9f9..81a2b13a33 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -13,6 +13,7 @@ =20 typedef enum { QAPI_DEPRECATED, + QAPI_UNSTABLE, } QapiSpecialFeature; =20 typedef struct QEnumLookup { diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index e29ade134c..c5c6e521a2 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -59,6 +59,12 @@ bool compat_policy_input_ok(unsigned special_features, error_class, kind, name, errp)) { return false; } + if ((special_features & (1u << QAPI_UNSTABLE)) + && !compat_policy_input_ok1("Unstable", + policy->unstable_input, + error_class, kind, name, errp)) { + return false; + } return true; } =20 diff --git a/qapi/qobject-output-visitor.c b/qapi/qobject-output-visitor.c index b5c6564cbb..74770edd73 100644 --- a/qapi/qobject-output-visitor.c +++ b/qapi/qobject-output-visitor.c @@ -212,8 +212,12 @@ static bool qobject_output_type_null(Visitor *v, const= char *name, static bool qobject_output_policy_skip(Visitor *v, const char *name, unsigned special_features) { - return !(special_features && 1u << QAPI_DEPRECATED) - || v->compat_policy.deprecated_output =3D=3D COMPAT_POLICY_OUTPUT_= HIDE; + CompatPolicy *pol =3D &v->compat_policy; + + return ((special_features & 1u << QAPI_DEPRECATED) + && pol->deprecated_output =3D=3D COMPAT_POLICY_OUTPUT_HIDE) + || ((special_features & 1u << QAPI_UNSTABLE) + && pol->unstable_output =3D=3D COMPAT_POLICY_OUTPUT_HIDE); } =20 /* Finish building, and return the root object. diff --git a/qemu-options.hx b/qemu-options.hx index 5f375bbfa6..f051536b63 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3641,7 +3641,9 @@ DEFHEADING(Debug/Expert options:) =20 DEF("compat", HAS_ARG, QEMU_OPTION_compat, "-compat [deprecated-input=3Daccept|reject|crash][,deprecated-output= =3Daccept|hide]\n" - " Policy for handling deprecated management interfaces\= n", + " Policy for handling deprecated management interfaces\= n" + "-compat [unstable-input=3Daccept|reject|crash][,unstable-output=3Dacc= ept|hide]\n" + " Policy for handling unstable management interfaces\n", QEMU_ARCH_ALL) SRST ``-compat [deprecated-input=3D@var{input-policy}][,deprecated-output=3D@va= r{output-policy}]`` @@ -3659,6 +3661,22 @@ SRST Suppress deprecated command results and events =20 Limitation: covers only syntactic aspects of QMP. + +``-compat [unstable-input=3D@var{input-policy}][,unstable-output=3D@var{ou= tput-policy}]`` + Set policy for handling unstable management interfaces (experimental): + + ``unstable-input=3Daccept`` (default) + Accept unstable commands and arguments + ``unstable-input=3Dreject`` + Reject unstable commands and arguments + ``unstable-input=3Dcrash`` + Crash on unstable commands and arguments + ``unstable-output=3Daccept`` (default) + Emit unstable command results and events + ``unstable-output=3Dhide`` + Suppress unstable command results and events + + Limitation: covers only syntactic aspects of QMP. ERST =20 DEF("fw_cfg", HAS_ARG, QEMU_OPTION_fwcfg, diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py index 82475e84ec..27b44c49f5 100644 --- a/scripts/qapi/events.py +++ b/scripts/qapi/events.py @@ -109,13 +109,15 @@ def gen_event_send(name: str, if not boxed: ret +=3D gen_param_var(arg_type) =20 - if 'deprecated' in [f.name for f in features]: - ret +=3D mcgen(''' + for f in features: + if f.is_special(): + ret +=3D mcgen(''' =20 - if (compat_policy.deprecated_output =3D=3D COMPAT_POLICY_OUTPUT_HIDE) { + if (compat_policy.%(feat)s_output =3D=3D COMPAT_POLICY_OUTPUT_HIDE) { return; } -''') +''', + feat=3Df.name) =20 ret +=3D mcgen(''' =20 diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 55f82d7389..b7b3fc0ce4 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -254,9 +254,11 @@ def doc_type(self): =20 def check(self, schema): QAPISchemaEntity.check(self, schema) - if 'deprecated' in [f.name for f in self.features]: - raise QAPISemError( - self.info, "feature 'deprecated' is not supported for type= s") + for feat in self.features: + if feat.is_special(): + raise QAPISemError( + self.info, + f"feature '{feat.name}' is not supported for types") =20 def describe(self): assert self.meta @@ -726,7 +728,7 @@ class QAPISchemaFeature(QAPISchemaMember): role =3D 'feature' =20 def is_special(self): - return self.name in ('deprecated') + return self.name in ('deprecated', 'unstable') =20 =20 class QAPISchemaObjectTypeMember(QAPISchemaMember): --=20 2.31.1