From nobody Sun May 19 02:38:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614177863; cv=none; d=zohomail.com; s=zohoarc; b=AwE5X+KGoaF8rPndNQ9h3j51HcoVfJlETMCpSbIejeTAj5s0H6p66zj2hLRiqVWDsSYMmbim/CotkwnU/GWkkEowkIFj56jBSY0SHyVZhq/BYRHgiuUhPrV6ULHd2fzRfFT4y79HiVvJ5AKoNZeAAQSiDym7qnJleHnqiMsBYns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177863; 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=G7sLfO+leMlmwt6dRcBKxlJxDf89q77s5XtvQoS1Bto=; b=ICUr5F6HsH6zFCRnc8UNx+Qv8N8jgfsAC22j3OibPWpuT/Y3qQJYRrEyKELhceW2E2f0SNfw45KcExsnjigt5bq8lRkP1L9K/3DIsxF6AMfCgaWG+FsX3W1iyHbK3L5F+1vt1kJHlrM9ucR2Br/+5IaG/THHOa8GcCMP2TcRVEA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 16141778633061014.044194463449; Wed, 24 Feb 2021 06:44:23 -0800 (PST) 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-264-hRQ8TkQNOyWMqA0O0rhlww-1; Wed, 24 Feb 2021 09:44:19 -0500 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 7836C10C4760; Wed, 24 Feb 2021 13:53:17 +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 4C80B60CDE; Wed, 24 Feb 2021 13:53:17 +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 F05F557DFA; Wed, 24 Feb 2021 13:53:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODrFk0016647 for ; Wed, 24 Feb 2021 08:53:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id F256761F2B; Wed, 24 Feb 2021 13:53:14 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6AC25D6D3; Wed, 24 Feb 2021 13:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177862; 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=G7sLfO+leMlmwt6dRcBKxlJxDf89q77s5XtvQoS1Bto=; b=gfB/6Y/uZWWq5DU1Qoc1/cAyOQAJFr12mzWwpZpDLTB/oE8nR1Z8PdXvhBY8bJV2nEe2GD 1IplvW7c/rH98GoY7CKahV7VRi0McvgJrxbLuoETfrGmdMZwBrhgziMmv9D1rWkNLVDOOj NC294psdeREf1zXo4qcVTgL0BjIuhlQ= X-MC-Unique: hRQ8TkQNOyWMqA0O0rhlww-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 01/31] tests: Drop 'props' from object-add calls Date: Wed, 24 Feb 2021 14:52:25 +0100 Message-Id: <20210224135255.253837-2-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" The 'props' option has been deprecated in 5.0 in favour of a flattened object-add command. Time to change our test cases to drop the deprecated option. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qtest/qmp-cmd-test.c | 16 +++++------ tests/qtest/test-netfilter.c | 54 ++++++++++++++++-------------------- tests/qemu-iotests/087 | 8 ++---- tests/qemu-iotests/184 | 18 ++++-------- tests/qemu-iotests/218 | 2 +- tests/qemu-iotests/235 | 2 +- tests/qemu-iotests/245 | 4 +-- tests/qemu-iotests/258 | 6 ++-- tests/qemu-iotests/258.out | 4 +-- tests/qemu-iotests/295 | 2 +- tests/qemu-iotests/296 | 2 +- 11 files changed, 51 insertions(+), 67 deletions(-) diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c index 1c7186e53c..c98b78d033 100644 --- a/tests/qtest/qmp-cmd-test.c +++ b/tests/qtest/qmp-cmd-test.c @@ -230,14 +230,14 @@ static void test_object_add_failure_modes(void) /* attempt to create 2 objects with duplicate id */ resp =3D qtest_qmp(qts, "{'execute': 'object-add', 'arguments':" " {'qom-type': 'memory-backend-ram', 'id': 'ram1'," - " 'props': {'size': 1048576 } } }"); + " 'size': 1048576 } }"); g_assert_nonnull(resp); g_assert(qdict_haskey(resp, "return")); qobject_unref(resp); =20 resp =3D qtest_qmp(qts, "{'execute': 'object-add', 'arguments':" " {'qom-type': 'memory-backend-ram', 'id': 'ram1'," - " 'props': {'size': 1048576 } } }"); + " 'size': 1048576 } }"); g_assert_nonnull(resp); qmp_expect_error_and_unref(resp, "GenericError"); =20 @@ -251,14 +251,14 @@ static void test_object_add_failure_modes(void) /* attempt to create an object with a property of a wrong type */ resp =3D qtest_qmp(qts, "{'execute': 'object-add', 'arguments':" " {'qom-type': 'memory-backend-ram', 'id': 'ram1'," - " 'props': {'size': '1048576' } } }"); + " 'size': '1048576' } }"); g_assert_nonnull(resp); /* now do it right */ qmp_expect_error_and_unref(resp, "GenericError"); =20 resp =3D qtest_qmp(qts, "{'execute': 'object-add', 'arguments':" " {'qom-type': 'memory-backend-ram', 'id': 'ram1'," - " 'props': {'size': 1048576 } } }"); + " 'size': 1048576 } }"); g_assert_nonnull(resp); g_assert(qdict_haskey(resp, "return")); qobject_unref(resp); @@ -273,14 +273,14 @@ static void test_object_add_failure_modes(void) /* attempt to create an object without the id */ resp =3D qtest_qmp(qts, "{'execute': 'object-add', 'arguments':" " {'qom-type': 'memory-backend-ram'," - " 'props': {'size': 1048576 } } }"); + " 'size': 1048576 } }"); g_assert_nonnull(resp); qmp_expect_error_and_unref(resp, "GenericError"); =20 /* now do it right */ resp =3D qtest_qmp(qts, "{'execute': 'object-add', 'arguments':" " {'qom-type': 'memory-backend-ram', 'id': 'ram1'," - " 'props': {'size': 1048576 } } }"); + " 'size': 1048576 } }"); g_assert_nonnull(resp); g_assert(qdict_haskey(resp, "return")); qobject_unref(resp); @@ -295,14 +295,14 @@ static void test_object_add_failure_modes(void) /* attempt to set a non existing property */ resp =3D qtest_qmp(qts, "{'execute': 'object-add', 'arguments':" " {'qom-type': 'memory-backend-ram', 'id': 'ram1'," - " 'props': {'sized': 1048576 } } }"); + " 'sized': 1048576 } }"); g_assert_nonnull(resp); qmp_expect_error_and_unref(resp, "GenericError"); =20 /* now do it right */ resp =3D qtest_qmp(qts, "{'execute': 'object-add', 'arguments':" " {'qom-type': 'memory-backend-ram', 'id': 'ram1'," - " 'props': {'size': 1048576 } } }"); + " 'size': 1048576 } }"); g_assert_nonnull(resp); g_assert(qdict_haskey(resp, "return")); qobject_unref(resp); diff --git a/tests/qtest/test-netfilter.c b/tests/qtest/test-netfilter.c index 22927ee6ab..785b6f3226 100644 --- a/tests/qtest/test-netfilter.c +++ b/tests/qtest/test-netfilter.c @@ -21,11 +21,10 @@ static void add_one_netfilter(void) " 'arguments': {" " 'qom-type': 'filter-buffer'," " 'id': 'qtest-f0'," - " 'props': {" - " 'netdev': 'qtest-bn0'," - " 'queue': 'rx'," - " 'interval': 1000" - "}}}"); + " 'netdev': 'qtest-bn0'," + " 'queue': 'rx'," + " 'interval': 1000" + "}}"); =20 g_assert(response); g_assert(!qdict_haskey(response, "error")); @@ -49,11 +48,10 @@ static void remove_netdev_with_one_netfilter(void) " 'arguments': {" " 'qom-type': 'filter-buffer'," " 'id': 'qtest-f0'," - " 'props': {" - " 'netdev': 'qtest-bn0'," - " 'queue': 'rx'," - " 'interval': 1000" - "}}}"); + " 'netdev': 'qtest-bn0'," + " 'queue': 'rx'," + " 'interval': 1000" + "}}"); =20 g_assert(response); g_assert(!qdict_haskey(response, "error")); @@ -87,11 +85,10 @@ static void add_multi_netfilter(void) " 'arguments': {" " 'qom-type': 'filter-buffer'," " 'id': 'qtest-f0'," - " 'props': {" - " 'netdev': 'qtest-bn0'," - " 'queue': 'rx'," - " 'interval': 1000" - "}}}"); + " 'netdev': 'qtest-bn0'," + " 'queue': 'rx'," + " 'interval': 1000" + "}}"); =20 g_assert(response); g_assert(!qdict_haskey(response, "error")); @@ -101,11 +98,10 @@ static void add_multi_netfilter(void) " 'arguments': {" " 'qom-type': 'filter-buffer'," " 'id': 'qtest-f1'," - " 'props': {" - " 'netdev': 'qtest-bn0'," - " 'queue': 'rx'," - " 'interval': 1000" - "}}}"); + " 'netdev': 'qtest-bn0'," + " 'queue': 'rx'," + " 'interval': 1000" + "}}"); =20 g_assert(response); g_assert(!qdict_haskey(response, "error")); @@ -137,11 +133,10 @@ static void remove_netdev_with_multi_netfilter(void) " 'arguments': {" " 'qom-type': 'filter-buffer'," " 'id': 'qtest-f0'," - " 'props': {" - " 'netdev': 'qtest-bn0'," - " 'queue': 'rx'," - " 'interval': 1000" - "}}}"); + " 'netdev': 'qtest-bn0'," + " 'queue': 'rx'," + " 'interval': 1000" + "}}"); =20 g_assert(response); g_assert(!qdict_haskey(response, "error")); @@ -151,11 +146,10 @@ static void remove_netdev_with_multi_netfilter(void) " 'arguments': {" " 'qom-type': 'filter-buffer'," " 'id': 'qtest-f1'," - " 'props': {" - " 'netdev': 'qtest-bn0'," - " 'queue': 'rx'," - " 'interval': 1000" - "}}}"); + " 'netdev': 'qtest-bn0'," + " 'queue': 'rx'," + " 'interval': 1000" + "}}"); =20 g_assert(response); g_assert(!qdict_haskey(response, "error")); diff --git a/tests/qemu-iotests/087 b/tests/qemu-iotests/087 index edd43f1a28..d8e0e384cd 100755 --- a/tests/qemu-iotests/087 +++ b/tests/qemu-iotests/087 @@ -143,9 +143,7 @@ run_qemu < (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614177862955510.4257233172601; Wed, 24 Feb 2021 06:44:22 -0800 (PST) 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-374-FF7iHukWMIiAQuG0eq57gw-1; Wed, 24 Feb 2021 09:44:19 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F5F010C4778; Wed, 24 Feb 2021 13:53:20 +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 167A45D9D7; Wed, 24 Feb 2021 13:53:20 +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 B621A18095CE; Wed, 24 Feb 2021 13:53:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODrIMI016661 for ; Wed, 24 Feb 2021 08:53:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 371F562460; Wed, 24 Feb 2021 13:53:18 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AEBF5D6D3; Wed, 24 Feb 2021 13:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177862; 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=w4dLXj0hcDhnHvdT/b4y/pp5BwKfLXszzXdhOiXAvm0=; b=IMlHZW0OyPPFeIfHbMSOLvlIc24fjqQ72FpGiMHmu4KgLpwmo+j6eXs0iFkI1m09Xz/S+J PVwWu+UYTgAVu13W/WIlqaxwf4HtmkaVSIO5LRTEfCLfzerZ60jQMwGVgtVt0wzKIM6WEq CStXITczXn9X3nNS688jYszV+2A/DSA= X-MC-Unique: FF7iHukWMIiAQuG0eq57gw-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 02/31] qapi/qom: Drop deprecated 'props' from object-add Date: Wed, 24 Feb 2021 14:52:26 +0100 Message-Id: <20210224135255.253837-3-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.14 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) Content-Type: text/plain; charset="utf-8" The option has been deprecated in QEMU 5.0, remove it. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/qom.json | 6 +----- docs/system/deprecated.rst | 5 ----- docs/system/removed-features.rst | 5 +++++ qom/qom-qmp-cmds.c | 21 --------------------- 4 files changed, 6 insertions(+), 31 deletions(-) diff --git a/qapi/qom.json b/qapi/qom.json index 0b0b92944b..96c91c1faf 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -211,10 +211,6 @@ # # @id: the name of the new object # -# @props: a dictionary of properties to be passed to the backend. Deprecat= ed -# since 5.0, specify the properties on the top level instead. It i= s an -# error to specify the same option both on the top level and in @p= rops. -# # Additional arguments depend on qom-type and are passed to the backend # unchanged. # @@ -232,7 +228,7 @@ # ## { 'command': 'object-add', - 'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'}, + 'data': {'qom-type': 'str', 'id': 'str'}, 'gen': false } # so we can get the additional arguments =20 ## diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index 2fcac7861e..00b694e053 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -199,11 +199,6 @@ Use ``migrate-set-parameters`` and ``query-migrate-par= ameters`` instead. =20 Use arguments ``base-node`` and ``top-node`` instead. =20 -``object-add`` option ``props`` (since 5.0) -''''''''''''''''''''''''''''''''''''''''''' - -Specify the properties for the object as top-level arguments instead. - ``query-named-block-nodes`` and ``query-block`` result dirty-bitmaps[i].st= atus (since 4.0) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''= '''''''''''''''' =20 diff --git a/docs/system/removed-features.rst b/docs/system/removed-feature= s.rst index c8481cafbd..95f3fb2912 100644 --- a/docs/system/removed-features.rst +++ b/docs/system/removed-features.rst @@ -58,6 +58,11 @@ documentation of ``query-hotpluggable-cpus`` for additio= nal details. =20 Use ``blockdev-change-medium`` or ``change-vnc-password`` instead. =20 +``object-add`` option ``props`` (removed in 6.0) +'''''''''''''''''''''''''''''''''''''''''''''''' + +Specify the properties for the object as top-level arguments instead. + Human Monitor Protocol (HMP) commands ------------------------------------- =20 diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index b40ac39f30..19fd5e117f 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -225,27 +225,6 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const = char *typename, =20 void qmp_object_add(QDict *qdict, QObject **ret_data, Error **errp) { - QObject *props; - QDict *pdict; - - props =3D qdict_get(qdict, "props"); - if (props) { - pdict =3D qobject_to(QDict, props); - if (!pdict) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict"); - return; - } - qobject_ref(pdict); - qdict_del(qdict, "props"); - qdict_join(qdict, pdict, false); - if (qdict_size(pdict) !=3D 0) { - error_setg(errp, "Option in 'props' conflicts with top level"); - qobject_unref(pdict); - return; - } - qobject_unref(pdict); - } - user_creatable_add_dict(qdict, false, errp); } =20 --=20 2.29.2 From nobody Sun May 19 02:38:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614177930; cv=none; d=zohomail.com; s=zohoarc; b=Jgwq/n+KVzeoxgqnTxkjcf8Tb/kkNKct9Ibwas4dI6UfLM/puRnlnhXJL5AVbC1vNij5exsi9Z5DeUKaSrjoTozQk4kFvAgSUlYdkUrD8dmcri/1OkXOeWBZ8ppmg6sgoYcRlnbVOnSZ2QRwJxZPCNuVqwpUZWg51hMsd/P7kP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177930; 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=teIP6UK7tb3CgBR43k6ucAI+H8cZsuyVHJp2kTC8T0U=; b=CHadGzNgs2cPIJkHwSYq/BtMHN6XfzW4B1yV5M+kwoHEex0yX8z7sCA8UIX46h/2oJN3eChHH6536hGnrgRVvlXbvmNeXTKOMV7d2Zi4NjDyZev6QOyhghIXUT7gl6okd69Hx8SwWTzHXhjkrG1eBVd5ZvMCENA2bR4HVcWTojo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614177930133905.1789684143517; Wed, 24 Feb 2021 06:45:30 -0800 (PST) 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-494-AJkO2YnBPES-8lNXYljvsQ-1; Wed, 24 Feb 2021 09:45:26 -0500 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 D7F4790C166; Wed, 24 Feb 2021 13:53: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 A247C19D9F; Wed, 24 Feb 2021 13:53:22 +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 57CD957DFE; Wed, 24 Feb 2021 13:53:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODrLR2016673 for ; Wed, 24 Feb 2021 08:53:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6CE5262460; Wed, 24 Feb 2021 13:53:21 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82D2A5D6D3; Wed, 24 Feb 2021 13:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177928; 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=teIP6UK7tb3CgBR43k6ucAI+H8cZsuyVHJp2kTC8T0U=; b=WWod2MIuTI+o3kdRYPpHSNo5zIz3nSPNlIUo3mSnyCylmMaxAtEA7HXSMV1yF7JHjj9hA5 i8EWIdMS/yT8PB8mmoauZ4H4MQBlStPdUhQiKzJJ9c3lYTRnzjEhXiEQU/KvwDBoZVAm2c 39b5TEnrVU8SYqy8nPPhMo/K2L121Ko= X-MC-Unique: AJkO2YnBPES-8lNXYljvsQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 03/31] qapi/qom: Add ObjectOptions for iothread Date: Wed, 24 Feb 2021 14:52:27 +0100 Message-Id: <20210224135255.253837-4-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" Add an ObjectOptions union that will eventually describe the options of all user creatable object types. As unions can't exist without any branches, also add the first object type. This adds a QAPI schema for the properties of the iothread object. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/qom.json | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/qapi/qom.json b/qapi/qom.json index 96c91c1faf..bf2ecb34be 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -202,6 +202,59 @@ 'returns': [ 'ObjectPropertyInfo' ], 'allow-preconfig': true } =20 +## +# @IothreadProperties: +# +# Properties for iothread objects. +# +# @poll-max-ns: the maximum number of nanoseconds to busy wait for events. +# 0 means polling is disabled (default: 32768 on POSIX hosts, +# 0 otherwise) +# +# @poll-grow: the multiplier used to increase the polling time when the +# algorithm detects it is missing events due to not polling lo= ng +# enough. 0 selects a default behaviour (default: 0) +# +# @poll-shrink: the divisor used to decrease the polling time when the +# algorithm detects it is spending too long polling without +# encountering events. 0 selects a default behaviour (defaul= t: 0) +# +# Since: 2.0 +## +{ 'struct': 'IothreadProperties', + 'data': { '*poll-max-ns': 'int', + '*poll-grow': 'int', + '*poll-shrink': 'int' } } + +## +# @ObjectType: +# +# Since: 6.0 +## +{ 'enum': 'ObjectType', + 'data': [ + 'iothread' + ] } + +## +# @ObjectOptions: +# +# Describes the options of a user creatable QOM object. +# +# @qom-type: the class name for the object to be created +# +# @id: the name of the new object +# +# Since: 6.0 +## +{ 'union': 'ObjectOptions', + 'base': { 'qom-type': 'ObjectType', + 'id': 'str' }, + 'discriminator': 'qom-type', + 'data': { + 'iothread': 'IothreadProperties' + } } + ## # @object-add: # --=20 2.29.2 From nobody Sun May 19 02:38:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614177936; cv=none; d=zohomail.com; s=zohoarc; b=cCBuXkN2j0oStq1eWJzDfsWgYs7xuyHc+YIl/yLKAO7LjSjeoIJ1sVuPjJTZRGiIgvsW92pI2u2VXPcJ7Z+2M1BaiVUBI3h5uhJOzOQUgAJ1LE0Ogsb8ZAsjprR0RUyoFwyJjsSNu4TSiISWEChon7rdbAEFzC3tpqSGQsRnazs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177936; 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=OQ0hQfVXRh/zZy/IvT6Jo23KOroe0Xl5Gi7Nbj/e8Hc=; b=YUAaXPvilzkWFyWsRo4VILmZJKSTlKI0J/LSUNaSvUBvff7S3njoim7E16WCnaZF0OGiZC5Uf9+XSx9ATt4QdX5PjWr6h3azCkU7PZZAYmq66zd7k74AeD59CjlxDaSUE5RhY4bHm2EO1v1vWRDl16SiHxVygAGviDHmmAhme6s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614177936694569.2683587531419; Wed, 24 Feb 2021 06:45:36 -0800 (PST) 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-530-AcF3zBWDOwemcy-pllduyw-1; Wed, 24 Feb 2021 09:45:33 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 22E8219558CC; Wed, 24 Feb 2021 13:54:04 +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 E0D275D9DC; Wed, 24 Feb 2021 13:54:03 +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 6C1B957DFC; Wed, 24 Feb 2021 13:54:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODrVK9016688 for ; Wed, 24 Feb 2021 08:53:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 58A411865D; Wed, 24 Feb 2021 13:53:31 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7DAF5D6D3; Wed, 24 Feb 2021 13:53:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177935; 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=OQ0hQfVXRh/zZy/IvT6Jo23KOroe0Xl5Gi7Nbj/e8Hc=; b=F1JT+VMxxK5WeP22QNVaVkLRWuO+QGeMNnsfoaaxYoS82bLZCYwD2f68a/+meQb33dq3H2 YfTR5RWmwkNUGJ0Uk0hQTri9hAZrN4D4p9v/VFQqJMVdsAGb/u2Tv2W6xKg1AMB3aMu0jk 89W9Mq8F5xBacJ5W32swJM1Y1ySbEd0= X-MC-Unique: AcF3zBWDOwemcy-pllduyw-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 04/31] qapi/qom: Add ObjectOptions for authz-* Date: Wed, 24 Feb 2021 14:52:28 +0100 Message-Id: <20210224135255.253837-5-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.14 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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the authz-* objects. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/authz.json | 62 ++++++++++++++++++++++++++++ qapi/qom.json | 10 +++++ storage-daemon/qapi/qapi-schema.json | 1 + 3 files changed, 73 insertions(+) diff --git a/qapi/authz.json b/qapi/authz.json index 42afe752d1..99d49aa563 100644 --- a/qapi/authz.json +++ b/qapi/authz.json @@ -59,3 +59,65 @@ ## { 'struct': 'QAuthZListRuleListHack', 'data': { 'unused': ['QAuthZListRule'] } } + +## +# @AuthZListProperties: +# +# Properties for authz-list objects. +# +# @policy: Default policy to apply when no rule matches (default: deny) +# +# @rules: Authorization rules based on matching user +# +# Since: 4.0 +## +{ 'struct': 'AuthZListProperties', + 'data': { '*policy': 'QAuthZListPolicy', + '*rules': ['QAuthZListRule'] } } + +## +# @AuthZListFileProperties: +# +# Properties for authz-listfile objects. +# +# @filename: File name to load the configuration from. The file must +# contain valid JSON for AuthZListProperties. +# +# @refresh: If true, inotify is used to monitor the file, automatically +# reloading changes. If an error occurs during reloading, all +# authorizations will fail until the file is next successfully +# loaded. (default: true if the binary was built with +# CONFIG_INOTIFY1, false otherwise) +# +# Since: 4.0 +## +{ 'struct': 'AuthZListFileProperties', + 'data': { 'filename': 'str', + '*refresh': 'bool' } } + +## +# @AuthZPAMProperties: +# +# Properties for authz-pam objects. +# +# @service: PAM service name to use for authorization +# +# Since: 4.0 +## +{ 'struct': 'AuthZPAMProperties', + 'data': { 'service': 'str' } } + +## +# @AuthZSimpleProperties: +# +# Properties for authz-simple objects. +# +# @identity: Identifies the allowed user. Its format depends on the network +# service that authorization object is associated with. For +# authorizing based on TLS x509 certificates, the identity must= be +# the x509 distinguished name. +# +# Since: 4.0 +## +{ 'struct': 'AuthZSimpleProperties', + 'data': { 'identity': 'str' } } diff --git a/qapi/qom.json b/qapi/qom.json index bf2ecb34be..30ed179bc1 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -4,6 +4,8 @@ # This work is licensed under the terms of the GNU GPL, version 2 or later. # See the COPYING file in the top-level directory. =20 +{ 'include': 'authz.json' } + ## # =3D QEMU Object Model (QOM) ## @@ -233,6 +235,10 @@ ## { 'enum': 'ObjectType', 'data': [ + 'authz-list', + 'authz-listfile', + 'authz-pam', + 'authz-simple', 'iothread' ] } =20 @@ -252,6 +258,10 @@ 'id': 'str' }, 'discriminator': 'qom-type', 'data': { + 'authz-list': 'AuthZListProperties', + 'authz-listfile': 'AuthZListFileProperties', + 'authz-pam': 'AuthZPAMProperties', + 'authz-simple': 'AuthZSimpleProperties', 'iothread': 'IothreadProperties' } } =20 diff --git a/storage-daemon/qapi/qapi-schema.json b/storage-daemon/qapi/qap= i-schema.json index 28117c3aac..67749d1101 100644 --- a/storage-daemon/qapi/qapi-schema.json +++ b/storage-daemon/qapi/qapi-schema.json @@ -26,6 +26,7 @@ { 'include': '../../qapi/crypto.json' } { 'include': '../../qapi/introspect.json' } { 'include': '../../qapi/job.json' } +{ 'include': '../../qapi/authz.json' } { 'include': '../../qapi/qom.json' } { 'include': '../../qapi/sockets.json' } { 'include': '../../qapi/transaction.json' } --=20 2.29.2 From nobody Sun May 19 02:38:07 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=1614177988; cv=none; d=zohomail.com; s=zohoarc; b=RVM7YuQwhw1Vzn7tfUUFqAxIVgV3X/MO5z+oYTS13lWZhYXWVidkU8R75YzAmF/FE1yDOz91rBmm91p4IHMMDV4dt40mgXbqnbwiQeS6mQW6sB4RCHa5c3HCWkK3KK+y09wi/YavwfF7DWR7KQ67BsINjnPx4iY+PpCl4wqdSVE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177988; 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=vvJcA0QYmmnNvV7h3BgIu40QNRyPT3zpw505mQrxRbQ=; b=mWO0VjN8fhjGvPKFOVir4dCkYYo/Gjkd0hZqaUEfCUCiOo+mVufGpeRQ9mTe6aa2wG9VHwEpabQxOieJiCSiGdark87WPtM2yyMuTIui1aTWXnePj8zxOSgXJb5yWgzTm0+1xUu/+Vh77Jr1m1Tnz4nkf0J0DK7xTi65MZPyeXI= 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) header.from= 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 1614177988692550.4452791459258; Wed, 24 Feb 2021 06:46:28 -0800 (PST) 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-239-cpVydrXBPhKsW9-cSXDopA-1; Wed, 24 Feb 2021 09:45:36 -0500 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 B68C419558F0; Wed, 24 Feb 2021 13:54:08 +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 8348119C46; Wed, 24 Feb 2021 13:54:08 +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 2FBF63807; Wed, 24 Feb 2021 13:54:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODrYwq016700 for ; Wed, 24 Feb 2021 08:53:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 937AE62460; Wed, 24 Feb 2021 13:53:34 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id A52145D6AD; Wed, 24 Feb 2021 13:53:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177986; 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=vvJcA0QYmmnNvV7h3BgIu40QNRyPT3zpw505mQrxRbQ=; b=PSbF4BHCyFqr4oWH6NEBJ7T9n4eLaZxn+NzN89lY6dSCJe+jtZ6QSAPZSmmJdKpZwrLBVs ls6HwvDg+EiOEHtAlHUTyru1cR3Qbj5+8WX2zMCTaSefYZ1FXbi/JSjdaTwSbtDX8kHX9n Dm2yxmuuQ0Tk8zZ5tKY5o5+XkrR6WiE= X-MC-Unique: cpVydrXBPhKsW9-cSXDopA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 05/31] qapi/qom: Add ObjectOptions for cryptodev-* Date: Wed, 24 Feb 2021 14:52:29 +0100 Message-Id: <20210224135255.253837-6-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the cryptodev-* objects. These interfaces have some questionable aspects (cryptodev-backend is really an abstract base class without function, and the queues option only makes sense for cryptodev-vhost-user), but as the goal is to represent the existing interface in QAPI, leave these things in place. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/qom.json | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/qapi/qom.json b/qapi/qom.json index 30ed179bc1..1dbc95fb53 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -204,6 +204,34 @@ 'returns': [ 'ObjectPropertyInfo' ], 'allow-preconfig': true } =20 +## +# @CryptodevBackendProperties: +# +# Properties for cryptodev-backend and cryptodev-backend-builtin objects. +# +# @queues: the number of queues for the cryptodev backend. Ignored for +# cryptodev-backend and must be 1 for cryptodev-backend-builtin. +# (default: 1) +# +# Since: 2.8 +## +{ 'struct': 'CryptodevBackendProperties', + 'data': { '*queues': 'uint32' } } + +## +# @CryptodevVhostUserProperties: +# +# Properties for cryptodev-vhost-user objects. +# +# @chardev: the name of a unix domain socket character device that connect= s to +# the vhost-user server +# +# Since: 2.12 +## +{ 'struct': 'CryptodevVhostUserProperties', + 'base': 'CryptodevBackendProperties', + 'data': { 'chardev': 'str' } } + ## # @IothreadProperties: # @@ -239,6 +267,9 @@ 'authz-listfile', 'authz-pam', 'authz-simple', + 'cryptodev-backend', + 'cryptodev-backend-builtin', + 'cryptodev-vhost-user', 'iothread' ] } =20 @@ -262,6 +293,9 @@ 'authz-listfile': 'AuthZListFileProperties', 'authz-pam': 'AuthZPAMProperties', 'authz-simple': 'AuthZSimpleProperties', + 'cryptodev-backend': 'CryptodevBackendProperties', + 'cryptodev-backend-builtin': 'CryptodevBackendProperties', + 'cryptodev-vhost-user': 'CryptodevVhostUserProperties', 'iothread': 'IothreadProperties' } } =20 --=20 2.29.2 From nobody Sun May 19 02:38:07 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=1614177953; cv=none; d=zohomail.com; s=zohoarc; b=euVR5bSTQBSYc6jE/b83DQFXPV8zH0v3fxCRXTmQX/XH1+8C44HxWVNG5uV/qur3M4pXy6RWshcbDYEEpmLe2ywSp1hNmBbuyOSqMDeQDG0c+WAoqc1N8kJSn0FaKIoRRvVW/3dre/g3MkX7I3FahL16gSMVN76zwH0HN8CUZIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177953; 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=93ypU12WajUfuBhSXpMPvvXNr+ewe7gyQmyl0Vj78TE=; b=O6S204mKBBy4eMv+PK13Ap6kTQK4ZAVA/12ZhzYYwyipW7pQsVfU5mQn5+RjWfmP2G3D3/6GTb05z8DgjkeCzw/jQ9TOdPfcRJl8Wjv+7AD2SVfcesYwAdzqOMHE8phN+b33FC9iiP8jjyKuLSBWUvx0Nf9Vf7WoFRdiwb0TG9s= 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) header.from= 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 1614177953754601.0705467667059; Wed, 24 Feb 2021 06:45:53 -0800 (PST) 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-39-hKpsexxFOfiyKtqRJbv-sg-1; Wed, 24 Feb 2021 09:45:46 -0500 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 C8E9DA395B1; Wed, 24 Feb 2021 13:54: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 91D4E60CE6; Wed, 24 Feb 2021 13:54: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 494DA18095CC; Wed, 24 Feb 2021 13:54:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODrbqi016711 for ; Wed, 24 Feb 2021 08:53:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id CB4DC62A1B; Wed, 24 Feb 2021 13:53:37 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id DED185D6AD; Wed, 24 Feb 2021 13:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177952; 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=93ypU12WajUfuBhSXpMPvvXNr+ewe7gyQmyl0Vj78TE=; b=N4nnw6Cg2NpvfGMQ7E6CVmQ0za3CweKSbN0sCX2xqGnizKmuefDmZorw27mLzw6F38AmoJ nIuRwGccKmOo/lujuy7VhUk1lJUNioJrHg/2Nd3+q8o6qXGcb5HbuCtPiUT+Saj9waw4bz I5zfFEPjuaRojDxdSE9/IcsnCZw/LcM= X-MC-Unique: hKpsexxFOfiyKtqRJbv-sg-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 06/31] qapi/qom: Add ObjectOptions for dbus-vmstate Date: Wed, 24 Feb 2021 14:52:30 +0100 Message-Id: <20210224135255.253837-7-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the dbus-vmstate object. A list represented as a comma separated string is clearly not very QAPI-like, but for now just describe the existing interface. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/qom.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/qapi/qom.json b/qapi/qom.json index 1dbc95fb53..a6a5049707 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -232,6 +232,22 @@ 'base': 'CryptodevBackendProperties', 'data': { 'chardev': 'str' } } =20 +## +# @DBusVMStateProperties: +# +# Properties for dbus-vmstate objects. +# +# @addr: the name of the DBus bus to connect to +# +# @id-list: a comma separated list of DBus IDs of helpers whose data shoul= d be +# included in the VM state on migration +# +# Since: 5.0 +## +{ 'struct': 'DBusVMStateProperties', + 'data': { 'addr': 'str' , + '*id-list': 'str' } } + ## # @IothreadProperties: # @@ -270,6 +286,7 @@ 'cryptodev-backend', 'cryptodev-backend-builtin', 'cryptodev-vhost-user', + 'dbus-vmstate', 'iothread' ] } =20 @@ -296,6 +313,7 @@ 'cryptodev-backend': 'CryptodevBackendProperties', 'cryptodev-backend-builtin': 'CryptodevBackendProperties', 'cryptodev-vhost-user': 'CryptodevVhostUserProperties', + 'dbus-vmstate': 'DBusVMStateProperties', 'iothread': 'IothreadProperties' } } =20 --=20 2.29.2 From nobody Sun May 19 02:38:07 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=1614177916; cv=none; d=zohomail.com; s=zohoarc; b=QpMGF6qh03Scva/XbVT5CUO0+AJ+7/IKVGlR4Tr9tZ2UMAQ2dF9D4K/LAhzzF/yaItYambMSOHIles98dDUO06V4bpFHJXP6utpR4d/+6Ijcio723yc5ZUt4TZbq16NYVBxRPcndUVDPzvB+Gb5uzdpB5J3vWb/1fnNTXL2D/6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177916; 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=EvabtEgOQTceU89X4kH6RGESPOPcL6G/+fAQcf1gisY=; b=L78NoF20F/y3CVF8nsPFAev6+01he2q3md56yF0Gjw0myjkgHIV7vQNnNBX0zzVXVFIUM4QxoX6AMkjRiRgfA7UoyEbz5jsC5qxFFTPZq/0hCezU/8QxTFcrRQKL2meP7hV2AOebFCmp/SM9Jsy4hMFMi43qiqUyqsr4ueilY1s= 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) header.from= 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 1614177916635944.8600953005084; Wed, 24 Feb 2021 06:45:16 -0800 (PST) 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-339-xuK7ejAEP7qiTClA0T6CPw-1; Wed, 24 Feb 2021 09:44:25 -0500 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 9C047A10D77; Wed, 24 Feb 2021 13:54:19 +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 55D2260C61; Wed, 24 Feb 2021 13:54: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 A837B58078; Wed, 24 Feb 2021 13:54:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODrfXD016728 for ; Wed, 24 Feb 2021 08:53:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0F07562953; Wed, 24 Feb 2021 13:53:41 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2215C5D6AD; Wed, 24 Feb 2021 13:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177915; 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=EvabtEgOQTceU89X4kH6RGESPOPcL6G/+fAQcf1gisY=; b=M2n5y4ikflvhe+lKZ0Q1xCKwzbV3jyFk/A2yz81K4oxWsgEqQJ9hgMF5CFac/4VsQ024aI Dcphaf0PA1GWw4r72WVSVKV/LzyaDXr2f9aclw1EYXma65QR+ZmtqBJjtGlns1IYeXc6YN QcrSwn2QG8zB/LuD7hDNKvoxpR4MlvQ= X-MC-Unique: xuK7ejAEP7qiTClA0T6CPw-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 07/31] qapi/qom: Add ObjectOptions for memory-backend-* Date: Wed, 24 Feb 2021 14:52:31 +0100 Message-Id: <20210224135255.253837-8-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the memory-backend-* objects. HostMemPolicy has to be moved to an include file that can be used by the storage daemon, too, because ObjectOptions must be the same in all binaries if we don't want to compile the whole code multiple times. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa --- qapi/common.json | 20 ++++++++ qapi/machine.json | 22 +-------- qapi/qom.json | 118 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 138 insertions(+), 22 deletions(-) diff --git a/qapi/common.json b/qapi/common.json index 716712d4b3..2dad4fadc3 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -145,3 +145,23 @@ ## { 'enum': 'PCIELinkWidth', 'data': [ '1', '2', '4', '8', '12', '16', '32' ] } + +## +# @HostMemPolicy: +# +# Host memory policy types +# +# @default: restore default policy, remove any nondefault policy +# +# @preferred: set the preferred host nodes for allocation +# +# @bind: a strict policy that restricts memory allocation to the +# host nodes specified +# +# @interleave: memory allocations are interleaved across the set +# of host nodes specified +# +# Since: 2.1 +## +{ 'enum': 'HostMemPolicy', + 'data': [ 'default', 'preferred', 'bind', 'interleave' ] } diff --git a/qapi/machine.json b/qapi/machine.json index 330189efe3..4322aee782 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -8,6 +8,8 @@ # =3D Machines ## =20 +{ 'include': 'common.json' } + ## # @SysEmuTarget: # @@ -897,26 +899,6 @@ 'policy': 'HmatCacheWritePolicy', 'line': 'uint16' }} =20 -## -# @HostMemPolicy: -# -# Host memory policy types -# -# @default: restore default policy, remove any nondefault policy -# -# @preferred: set the preferred host nodes for allocation -# -# @bind: a strict policy that restricts memory allocation to the -# host nodes specified -# -# @interleave: memory allocations are interleaved across the set -# of host nodes specified -# -# Since: 2.1 -## -{ 'enum': 'HostMemPolicy', - 'data': [ 'default', 'preferred', 'bind', 'interleave' ] } - ## # @memsave: # diff --git a/qapi/qom.json b/qapi/qom.json index a6a5049707..1a869006a1 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -5,6 +5,7 @@ # See the COPYING file in the top-level directory. =20 { 'include': 'authz.json' } +{ 'include': 'common.json' } =20 ## # =3D QEMU Object Model (QOM) @@ -272,6 +273,113 @@ '*poll-grow': 'int', '*poll-shrink': 'int' } } =20 +## +# @MemoryBackendProperties: +# +# Properties for objects of classes derived from memory-backend. +# +# @merge: if true, mark the memory as mergeable (default depends on the ma= chine +# type) +# +# @dump: if true, include the memory in core dumps (default depends on the +# machine type) +# +# @host-nodes: the list of NUMA host nodes to bind the memory to +# +# @policy: the NUMA policy (default: 'default') +# +# @prealloc: if true, preallocate memory (default: false) +# +# @prealloc-threads: number of CPU threads to use for prealloc (default: 1) +# +# @share: if false, the memory is private to QEMU; if true, it is shared +# (default: false) +# +# @size: size of the memory region in bytes +# +# @x-use-canonical-path-for-ramblock-id: if true, the canoncial path is us= ed +# for ramblock-id. Disable this for= 4.0 +# machine types or older to allow +# migration with newer QEMU version= s. +# (default: false generally, but tr= ue +# for machine types <=3D 4.0) +# +# Since: 2.1 +## +{ 'struct': 'MemoryBackendProperties', + 'data': { '*dump': 'bool', + '*host-nodes': ['uint16'], + '*merge': 'bool', + '*policy': 'HostMemPolicy', + '*prealloc': 'bool', + '*prealloc-threads': 'uint32', + '*share': 'bool', + 'size': 'size', + '*x-use-canonical-path-for-ramblock-id': 'bool' } } + +## +# @MemoryBackendFileProperties: +# +# Properties for memory-backend-file objects. +# +# @align: the base address alignment when QEMU mmap(2) @mem-path. Some +# backend store specified by @mem-path requires an alignment diffe= rent +# than the default one used by QEMU, e.g. the device DAX /dev/dax0= .0 +# requires 2M alignment rather than 4K. In such cases, users can +# specify the required alignment via this option. +# 0 selects a default alignment (currently the page size). (defaul= t: 0) +# +# @discard-data: if true, the file contents can be destroyed when QEMU exi= ts, +# to avoid unnecessarily flushing data to the backing file.= Note +# that ``discard-data`` is only an optimization, and QEMU m= ight +# not discard file contents if it aborts unexpectedly or is +# terminated using SIGKILL. (default: false) +# +# @mem-path: the path to either a shared memory or huge page filesystem mo= unt +# +# @pmem: specifies whether the backing file specified by @mem-path is in +# host persistent memory that can be accessed using the SNIA NVM +# programming model (e.g. Intel NVDIMM). +# +# @readonly: if true, the backing file is opened read-only; if false, it is +# opened read-write. (default: false) +# +# Since: 2.1 +## +{ 'struct': 'MemoryBackendFileProperties', + 'base': 'MemoryBackendProperties', + 'data': { '*align': 'size', + '*discard-data': 'bool', + 'mem-path': 'str', + '*pmem': 'bool', + '*readonly': 'bool' } } + +## +# @MemoryBackendMemfdProperties: +# +# Properties for memory-backend-memfd objects. +# +# The @share boolean option is true by default with memfd. +# +# @hugetlb: if true, the file to be created resides in the hugetlbfs files= ystem +# (default: false) +# +# @hugetlbsize: the hugetlb page size on systems that support multiple hug= etlb +# page sizes (it must be a power of 2 value supported by the +# system). 0 selects a default page size. This option is ign= ored +# if @hugetlb is false. (default: 0) +# +# @seal: if true, create a sealed-file, which will block further resizing = of +# the memory (default: true) +# +# Since: 2.12 +## +{ 'struct': 'MemoryBackendMemfdProperties', + 'base': 'MemoryBackendProperties', + 'data': { '*hugetlb': 'bool', + '*hugetlbsize': 'size', + '*seal': 'bool' } } + ## # @ObjectType: # @@ -287,7 +395,10 @@ 'cryptodev-backend-builtin', 'cryptodev-vhost-user', 'dbus-vmstate', - 'iothread' + 'iothread', + 'memory-backend-file', + 'memory-backend-memfd', + 'memory-backend-ram' ] } =20 ## @@ -314,7 +425,10 @@ 'cryptodev-backend-builtin': 'CryptodevBackendProperties', 'cryptodev-vhost-user': 'CryptodevVhostUserProperties', 'dbus-vmstate': 'DBusVMStateProperties', - 'iothread': 'IothreadProperties' + 'iothread': 'IothreadProperties', + 'memory-backend-file': 'MemoryBackendFileProperties', + 'memory-backend-memfd': 'MemoryBackendMemfdProperties', + 'memory-backend-ram': 'MemoryBackendProperties' } } =20 ## --=20 2.29.2 From nobody Sun May 19 02:38:07 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=1614177912; cv=none; d=zohomail.com; s=zohoarc; b=W+UPMjwrN+5nwPWAHGpLpxzQqKUWQfjSmRmaU/GpIkr5jTbhTb0mXWnyjMa8hxOXHPjsGF9ibDjYPhIh5A/dkVYsxhNESLU0lrKwZzsEgtaclmRXpaQ/oftVEPTDI/RQWaii1VAdcfZhWx56x35Tgm85c6IVNcad3pxWy3DEZRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177912; 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=Sfvkf5hlfPKL+6S9ZgYkbNz8PO+cNrLSCpCKhGOfuSo=; b=Kx6+7xWj7TQ/SZjfzL8cD9GFzgEuGL7Tx7PpgsJvKjLU82xwK11wNvnhP8ixahUCvIpRJnJVPp4I1f2qelxdW66JaUUQUDF7mrfSIpynlRFtlx+o6HfeH5g4IFYnji84a/2WfozM6fPE+MO7CM9zSXP5JIU5yrgXb6zjpipHqZo= 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) header.from= 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 1614177912673127.72556163799436; Wed, 24 Feb 2021 06:45:12 -0800 (PST) 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-259-1WddEu0pOWKtwhWeClXInA-1; Wed, 24 Feb 2021 09:44:24 -0500 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 4D95BA10D6D; Wed, 24 Feb 2021 13:54:17 +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 2555162953; Wed, 24 Feb 2021 13:54:17 +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 C23D858076; Wed, 24 Feb 2021 13:54:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODrpDr016748 for ; Wed, 24 Feb 2021 08:53:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 117A362A25; Wed, 24 Feb 2021 13:53:51 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 594395D740; Wed, 24 Feb 2021 13:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177906; 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=Sfvkf5hlfPKL+6S9ZgYkbNz8PO+cNrLSCpCKhGOfuSo=; b=Sn9SZzvMxveWRR5mBgwcU7zI9uwegpFQuOOssDGwotrp6CVDkVOUiiG5CvtIAXKu9Qi0JW CFFkAraKFp3P1ItWCDO/wDHMHlTYpOnatCGAhT3xdB4faaCIx6bkoyW0Ggcs3/QZ/CIzPp 7c1VERO2MpA/I2R5fDVrT/2QfCViqRY= X-MC-Unique: 1WddEu0pOWKtwhWeClXInA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 08/31] qapi/qom: Add ObjectOptions for rng-*, deprecate 'opened' Date: Wed, 24 Feb 2021 14:52:32 +0100 Message-Id: <20210224135255.253837-9-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the rng-* objects. The 'opened' property doesn't seem to make sense as an external interface: It is automatically set to true in ucc->complete, and explicitly setting it to true earlier just means that trying to set additional options will result in an error. After the property has once been set to true (i.e. when the object construction has completed), it can never be reset to false. In other words, the 'opened' property is useless. Mark it as deprecated in the schema from the start. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/qom.json | 56 ++++++++++++++++++++++++++++++++++++-- docs/system/deprecated.rst | 9 ++++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/qapi/qom.json b/qapi/qom.json index 1a869006a1..73f28f9608 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -380,6 +380,52 @@ '*hugetlbsize': 'size', '*seal': 'bool' } } =20 +## +# @RngProperties: +# +# Properties for objects of classes derived from rng. +# +# @opened: if true, the device is opened immediately when applying this op= tion +# and will probably fail when processing the next option. Don't u= se; +# only provided for compatibility. (default: false) +# +# Features: +# @deprecated: Member @opened is deprecated. Setting true doesn't make se= nse, +# and false is already the default. +# +# Since: 1.3 +## +{ 'struct': 'RngProperties', + 'data': { '*opened': { 'type': 'bool', 'features': ['deprecated'] } } } + +## +# @RngEgdProperties: +# +# Properties for rng-egd objects. +# +# @chardev: the name of a character device backend that provides the conne= ction +# to the RNG daemon +# +# Since: 1.3 +## +{ 'struct': 'RngEgdProperties', + 'base': 'RngProperties', + 'data': { 'chardev': 'str' } } + +## +# @RngRandomProperties: +# +# Properties for rng-random objects. +# +# @filename: the filename of the device on the host to obtain entropy from +# (default: "/dev/urandom") +# +# Since: 1.3 +## +{ 'struct': 'RngRandomProperties', + 'base': 'RngProperties', + 'data': { '*filename': 'str' } } + ## # @ObjectType: # @@ -398,7 +444,10 @@ 'iothread', 'memory-backend-file', 'memory-backend-memfd', - 'memory-backend-ram' + 'memory-backend-ram', + 'rng-builtin', + 'rng-egd', + 'rng-random' ] } =20 ## @@ -428,7 +477,10 @@ 'iothread': 'IothreadProperties', 'memory-backend-file': 'MemoryBackendFileProperties', 'memory-backend-memfd': 'MemoryBackendMemfdProperties', - 'memory-backend-ram': 'MemoryBackendProperties' + 'memory-backend-ram': 'MemoryBackendProperties', + 'rng-builtin': 'RngProperties', + 'rng-egd': 'RngEgdProperties', + 'rng-random': 'RngRandomProperties' } } =20 ## diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index 00b694e053..79991c2893 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -146,6 +146,15 @@ library enabled as a cryptography provider. Neither the ``nettle`` library, or the built-in cryptography provider are supported on FIPS enabled hosts. =20 +``opened`` property of ``rng-*`` objects (since 6.0.0) +'''''''''''''''''''''''''''''''''''''''''''''''''''''' + +The only effect of specifying ``opened=3Don`` in the command line or QMP +``object-add`` is that the device is opened immediately, possibly before a= ll +other options have been processed. This will either have no effect (if +``opened`` was the last option) or cause errors. The property is therefore +useless and should not be specified. + QEMU Machine Protocol (QMP) commands ------------------------------------ =20 --=20 2.29.2 From nobody Sun May 19 02:38:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614177959; cv=none; d=zohomail.com; s=zohoarc; b=MzVdbzR8zydPP7UWlVIhgr2iS4Ug1HrFAUZA+yY8h0jZxnETACpgX07f0+WNXlfli3vzqegCRDrDcpQwD01zTZXTvGFmRVSqwpNjXwK/xViVjbKpBSAUrNiS/gfACk1KY7JAI+V7lXzuusgu7scnM/5E2h9H/5Opk2iTg4POQZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177959; 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=fbvspXcW34sB7dx3yssVd1jyU4R/HWg91WmrK1WHLBg=; b=UsNrvzw5b9eiMyOCAu3NbAlCoEjCswXds3QPhGQlZFoF+bUJ87flwjhDuLpQkx97QcgtBJW6+FWDkhH3F6tJUHq+5UQ+R7/+SRDfz8B/VC8EBAAmmpIKx/A2TgUPVcGTNyjuj09aOwgEsXeWvKzektlpqynv+L5kTlWGLnbAnPQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614177959697202.06160573184877; Wed, 24 Feb 2021 06:45:59 -0800 (PST) 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-326-PufqYcREPwy8nF9DubVEDw-1; Wed, 24 Feb 2021 09:45:05 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B6A1118BD05; Wed, 24 Feb 2021 13:54:21 +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 404A71001281; Wed, 24 Feb 2021 13:54: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 ED5A65807B; Wed, 24 Feb 2021 13:54:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODrsOE016759 for ; Wed, 24 Feb 2021 08:53:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 465B762953; Wed, 24 Feb 2021 13:53:54 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5ADC65D6AD; Wed, 24 Feb 2021 13:53:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177958; 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=fbvspXcW34sB7dx3yssVd1jyU4R/HWg91WmrK1WHLBg=; b=fZ4ph3u7zXYMkSc4hZP8aP9Jg3co0+Ixm8Rw6ylLxsfLtzBoV4/wvv7wDfjabahUpavg2a BYLgdiw2F1amJkycGvqph22/H4MnZ8derAbJdY+nIfaKC0WlV2u2I6ZA9wZQMb9XVJ8aZ/ NH7FT/05d83AoeKZUWjRkqXtzrCZP6s= X-MC-Unique: PufqYcREPwy8nF9DubVEDw-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 09/31] qapi/qom: Add ObjectOptions for throttle-group Date: Wed, 24 Feb 2021 14:52:33 +0100 Message-Id: <20210224135255.253837-10-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.22 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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the throttle-group object. The only purpose of the x-* properties is to make the nested options in 'limits' available for a command line parser that doesn't support structs. Any parser that will use the QAPI schema will supports structs, though, so they will not be needed in the schema in the future. To keep the conversion straightforward, add them to the schema anyway. We can then remove the options and adjust documentation, test cases etc. in a separate patch. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/block-core.json | 27 +++++++++++++++++++++++++++ qapi/qom.json | 7 +++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 9f555d5c1d..a67fa0cc59 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2504,6 +2504,33 @@ '*bps-write-max' : 'int', '*bps-write-max-length' : 'int', '*iops-size' : 'int' } } =20 +## +# @ThrottleGroupProperties: +# +# 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 +# +# 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' } } + ## # @block-stream: # diff --git a/qapi/qom.json b/qapi/qom.json index 73f28f9608..449dca8ec5 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -5,6 +5,7 @@ # See the COPYING file in the top-level directory. =20 { 'include': 'authz.json' } +{ 'include': 'block-core.json' } { 'include': 'common.json' } =20 ## @@ -447,7 +448,8 @@ 'memory-backend-ram', 'rng-builtin', 'rng-egd', - 'rng-random' + 'rng-random', + 'throttle-group' ] } =20 ## @@ -480,7 +482,8 @@ 'memory-backend-ram': 'MemoryBackendProperties', 'rng-builtin': 'RngProperties', 'rng-egd': 'RngEgdProperties', - 'rng-random': 'RngRandomProperties' + 'rng-random': 'RngRandomProperties', + 'throttle-group': 'ThrottleGroupProperties' } } =20 ## --=20 2.29.2 From nobody Sun May 19 02:38:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614177962; cv=none; d=zohomail.com; s=zohoarc; b=GxXRc3aNu2fI1lH5zS3KDUoaSsSxkXipLfAkmYtxw8rHBNFZr2+6VLtL5qQE76SjVMq5OONjJMr+tLgKNtZvQfWycs6/PY6t0Ch+/7tYg+EjTBqKCnXlbLrcCzVpHije+yT2lc3bpC3vf5nJvPZwtiw1WOT1gjEbrkJJo/Yna74= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177962; 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=Y6qQ8WUyyd9Dl6d48HDjjpAlyT5GsHiTiYJryrGfxpY=; b=LirKb+hsYpnz48C7bOas3Nmnqv4StXHmeSguygoVF4Q1cnKmn0piPGY3ch8X3AFvMMN2E1wOJO/zp2c0sn19PtDRLpq6enm3r3wHwJfVE+JW+Yr2K51ZkbpIcXZApm4tUr2lrktOR7APBc4LVtKhIBIowraIa7qIxOiqnnBXFKE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614177962367988.2873064847931; Wed, 24 Feb 2021 06:46:02 -0800 (PST) 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-526-85XycUYOP1mmVzide8STrw-1; Wed, 24 Feb 2021 09:45:57 -0500 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 893EBA3D7B1; Wed, 24 Feb 2021 13:54:23 +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 58FE35D743; Wed, 24 Feb 2021 13:54:23 +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 F37D45807E; Wed, 24 Feb 2021 13:54:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODrvGS016773 for ; Wed, 24 Feb 2021 08:53:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7DFEA62A23; Wed, 24 Feb 2021 13:53:57 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 913305D6AD; Wed, 24 Feb 2021 13:53:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177961; 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=Y6qQ8WUyyd9Dl6d48HDjjpAlyT5GsHiTiYJryrGfxpY=; b=JJ/HwVl4r5xvtWUnWGA6I6XQ5m5LLj2B93QcrvDJ/M6vPWpps1yl+e8aluiex/9OH+fq3L YsJ2ExkERs5RWWBK0stsl1B6TKDtLTnKj7aJNHcMBaMCFUTIaEBQd2HahoTz21ZGcCtbSd S/2cuBG3uRyqkR7vQmShCPQ42S1l/Eg= X-MC-Unique: 85XycUYOP1mmVzide8STrw-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 10/31] qapi/qom: Add ObjectOptions for secret*, deprecate 'loaded' Date: Wed, 24 Feb 2021 14:52:34 +0100 Message-Id: <20210224135255.253837-11-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the secret* objects. The 'loaded' property doesn't seem to make sense as an external interface: It is automatically set to true in ucc->complete, and explicitly setting it to true earlier just means that additional options will be silently ignored. In other words, the 'loaded' property is useless. Mark it as deprecated in the schema from the start. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/crypto.json | 61 ++++++++++++++++++++++++++++++++++++++ qapi/qom.json | 5 ++++ docs/system/deprecated.rst | 11 +++++++ 3 files changed, 77 insertions(+) diff --git a/qapi/crypto.json b/qapi/crypto.json index 2aebe6fa20..0fef3de66d 100644 --- a/qapi/crypto.json +++ b/qapi/crypto.json @@ -381,3 +381,64 @@ 'discriminator': 'format', 'data': { 'luks': 'QCryptoBlockAmendOptionsLUKS' } } + +## +# @SecretCommonProperties: +# +# Properties for objects of classes derived from secret-common. +# +# @loaded: if true, the secret is loaded immediately when applying this op= tion +# and will probably fail when processing the next option. Don't u= se; +# only provided for compatibility. (default: false) +# +# @format: the data format that the secret is provided in (default: raw) +# +# @keyid: the name of another secret that should be used to decrypt the +# provided data. If not present, the data is assumed to be unencry= pted. +# +# @iv: the random initialization vector used for encryption of this partic= ular +# secret. Should be a base64 encrypted string of the 16-byte IV. Mand= atory +# if @keyid is given. Ignored if @keyid is absent. +# +# Features: +# @deprecated: Member @loaded is deprecated. Setting true doesn't make se= nse, +# and false is already the default. +# +# Since: 2.6 +## +{ 'struct': 'SecretCommonProperties', + 'data': { '*loaded': { 'type': 'bool', 'features': ['deprecated'] }, + '*format': 'QCryptoSecretFormat', + '*keyid': 'str', + '*iv': 'str' } } + +## +# @SecretProperties: +# +# Properties for secret objects. +# +# Either @data or @file must be provided, but not both. +# +# @data: the associated with the secret from +# +# @file: the filename to load the data associated with the secret from +# +# Since: 2.6 +## +{ 'struct': 'SecretProperties', + 'base': 'SecretCommonProperties', + 'data': { '*data': 'str', + '*file': 'str' } } + +## +# @SecretKeyringProperties: +# +# Properties for secret_keyring objects. +# +# @serial: serial number that identifies a key to get from the kernel +# +# Since: 5.1 +## +{ 'struct': 'SecretKeyringProperties', + 'base': 'SecretCommonProperties', + 'data': { 'serial': 'int32' } } diff --git a/qapi/qom.json b/qapi/qom.json index 449dca8ec5..2668ad8369 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -7,6 +7,7 @@ { 'include': 'authz.json' } { 'include': 'block-core.json' } { 'include': 'common.json' } +{ 'include': 'crypto.json' } =20 ## # =3D QEMU Object Model (QOM) @@ -449,6 +450,8 @@ 'rng-builtin', 'rng-egd', 'rng-random', + 'secret', + 'secret_keyring', 'throttle-group' ] } =20 @@ -483,6 +486,8 @@ 'rng-builtin': 'RngProperties', 'rng-egd': 'RngEgdProperties', 'rng-random': 'RngRandomProperties', + 'secret': 'SecretProperties', + 'secret_keyring': 'SecretKeyringProperties', 'throttle-group': 'ThrottleGroupProperties' } } =20 diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index 79991c2893..78b175cb59 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -155,6 +155,17 @@ other options have been processed. This will either h= ave no effect (if ``opened`` was the last option) or cause errors. The property is therefore useless and should not be specified. =20 +``loaded`` property of ``secret`` and ``secret_keyring`` objects (since 6.= 0.0) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''= '''' + +The only effect of specifying ``loaded=3Don`` in the command line or QMP +``object-add`` is that the secret is loaded immediately, possibly before a= ll +other options have been processed. This will either have no effect (if +``loaded`` was the last option) or cause options to be effectively ignored= as +if they were not given. The property is therefore useless and should not = be +specified. + + QEMU Machine Protocol (QMP) commands ------------------------------------ =20 --=20 2.29.2 From nobody Sun May 19 02:38:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614177973; cv=none; d=zohomail.com; s=zohoarc; b=WtGYpJNCuZok6aWXO98MgvKep9EWS+3miubJy4aQACSmH7o9HqFJIPCsbk64bf1N4smemO3VVSww6taM4Q6ARapeWe9LnhWQ6QJAKduPEAJEAsdlwH0nZK6flWJNIMvAh9qwlXqqgCt8BziQ3sxE27DAmB2iBobWNmESHI/XzXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177973; 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=I+tsw32m4ImJA/s2NdC+WrUHp21imXzyr/ZshNYex1o=; b=J+//CSWUzUvRuu6DpNHdrV3ipy/NJTIb6YcYdcCODWedo41f4JqfPAmh0pwQCeN8acHe1QQZ1fcqrkojfivqESc1nTmLyaE0qcKOEPNnR6ZfTSkhD64JybwrEwHMrhBYEsasIIW+QV9gEsWpe9DnV+Yv5DCno8S81qq0IUWA2/s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614177973572886.5026611569529; Wed, 24 Feb 2021 06:46:13 -0800 (PST) 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-500-rzqXSic3O_O0wgUlpXqQ8w-1; Wed, 24 Feb 2021 09:46:03 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F891A3D7BD; Wed, 24 Feb 2021 13:54:25 +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 649B85D9E3; Wed, 24 Feb 2021 13:54:25 +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 1E09858083; Wed, 24 Feb 2021 13:54:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODs0ji016784 for ; Wed, 24 Feb 2021 08:54:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id AFEB15D6AD; Wed, 24 Feb 2021 13:54:00 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id C72995D6D3; Wed, 24 Feb 2021 13:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177972; 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=I+tsw32m4ImJA/s2NdC+WrUHp21imXzyr/ZshNYex1o=; b=NdaMT4AiLPnt+/IQinBLZvPWWo/xH/lakD5jw4wjylIt3LcYlJAx9Z0AuFqt1EbmmJwWzG Jzr7g/ahW6+k9P3HlD3qHCWcMCGylRdJOvDGBBeiHnFN5hOBvC6z5SxBTK72UW7+HEwD3R qNUSVRuOAb8XFwoXvTI7KgxTelffzjg= X-MC-Unique: rzqXSic3O_O0wgUlpXqQ8w-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 11/31] qapi/qom: Add ObjectOptions for tls-*, deprecate 'loaded' Date: Wed, 24 Feb 2021 14:52:35 +0100 Message-Id: <20210224135255.253837-12-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.14 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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the tls-* objects. The 'loaded' property doesn't seem to make sense as an external interface: It is automatically set to true in ucc->complete, and explicitly setting it to true earlier just means that additional options will be silently ignored. In other words, the 'loaded' property is useless. Mark it as deprecated in the schema from the start. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/crypto.json | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ qapi/qom.json | 12 +++++- 2 files changed, 108 insertions(+), 2 deletions(-) diff --git a/qapi/crypto.json b/qapi/crypto.json index 0fef3de66d..7116ae9a46 100644 --- a/qapi/crypto.json +++ b/qapi/crypto.json @@ -442,3 +442,101 @@ { 'struct': 'SecretKeyringProperties', 'base': 'SecretCommonProperties', 'data': { 'serial': 'int32' } } + +## +# @TlsCredsProperties: +# +# Properties for objects of classes derived from tls-creds. +# +# @verify-peer: if true the peer credentials will be verified once the +# handshake is completed. This is a no-op for anonymous +# credentials. (default: true) +# +# @dir: the path of the directory that contains the credential files +# +# @endpoint: whether the QEMU network backend that uses the credentials wi= ll be +# acting as a client or as a server (default: client) +# +# @priority: a gnutls priority string as described at +# https://gnutls.org/manual/html_node/Priority-Strings.html +# +# Since: 2.5 +## +{ 'struct': 'TlsCredsProperties', + 'data': { '*verify-peer': 'bool', + '*dir': 'str', + '*endpoint': 'QCryptoTLSCredsEndpoint', + '*priority': 'str' } } + +## +# @TlsCredsAnonProperties: +# +# Properties for tls-creds-anon objects. +# +# @loaded: if true, the credentials are loaded immediately when applying t= his +# option and will ignore options that are processed later. Don't = use; +# only provided for compatibility. (default: false) +# +# Features: +# @deprecated: Member @loaded is deprecated. Setting true doesn't make se= nse, +# and false is already the default. +# +# Since: 2.5 +## +{ 'struct': 'TlsCredsAnonProperties', + 'base': 'TlsCredsProperties', + 'data': { '*loaded': { 'type': 'bool', 'features': ['deprecated'] } } } + +## +# @TlsCredsPskProperties: +# +# Properties for tls-creds-psk objects. +# +# @loaded: if true, the credentials are loaded immediately when applying t= his +# option and will ignore options that are processed later. Don't = use; +# only provided for compatibility. (default: false) +# +# @username: the username which will be sent to the server. For clients o= nly. +# If absent, "qemu" is sent and the property will read back as = an +# empty string. +# +# Features: +# @deprecated: Member @loaded is deprecated. Setting true doesn't make se= nse, +# and false is already the default. +# +# Since: 3.0 +## +{ 'struct': 'TlsCredsPskProperties', + 'base': 'TlsCredsProperties', + 'data': { '*loaded': { 'type': 'bool', 'features': ['deprecated'] }, + '*username': 'str' } } + +## +# @TlsCredsX509Properties: +# +# Properties for tls-creds-x509 objects. +# +# @loaded: if true, the credentials are loaded immediately when applying t= his +# option and will ignore options that are processed later. Don't = use; +# only provided for compatibility. (default: false) +# +# @sanity-check: if true, perform some sanity checks before using the +# credentials (default: true) +# +# @passwordid: For the server-key.pem and client-key.pem files which conta= in +# sensitive private keys, it is possible to use an encrypted +# version by providing the @passwordid parameter. This provi= des +# the ID of a previously created secret object containing the +# password for decryption. +# +# Features: +# @deprecated: Member @loaded is deprecated. Setting true doesn't make se= nse, +# and false is already the default. +# +# Since: 2.5 +## +{ 'struct': 'TlsCredsX509Properties', + 'base': 'TlsCredsProperties', + 'data': { '*loaded': { 'type': 'bool', 'features': ['deprecated'] }, + '*sanity-check': 'bool', + '*passwordid': 'str' } } diff --git a/qapi/qom.json b/qapi/qom.json index 2668ad8369..f22b7aa99b 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -452,7 +452,11 @@ 'rng-random', 'secret', 'secret_keyring', - 'throttle-group' + 'throttle-group', + 'tls-creds-anon', + 'tls-creds-psk', + 'tls-creds-x509', + 'tls-cipher-suites' ] } =20 ## @@ -488,7 +492,11 @@ 'rng-random': 'RngRandomProperties', 'secret': 'SecretProperties', 'secret_keyring': 'SecretKeyringProperties', - 'throttle-group': 'ThrottleGroupProperties' + 'throttle-group': 'ThrottleGroupProperties', + 'tls-creds-anon': 'TlsCredsAnonProperties', + 'tls-creds-psk': 'TlsCredsPskProperties', + 'tls-creds-x509': 'TlsCredsX509Properties', + 'tls-cipher-suites': 'TlsCredsProperties' } } =20 ## --=20 2.29.2 From nobody Sun May 19 02:38:07 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=1614177967; cv=none; d=zohomail.com; s=zohoarc; b=QWNxZ3SGxdP9uQj5FzBtneHGGLPGfYmUgH+uWwFS94Zgsz1l+X6QdQgEry7/3NI/x26sILzuM1nEaYN2lg+T4l+cCbQ0ELhqU6xw5bLmNiFnQriDVif5foXpcW0bpP88SXcwqFuzGvin1mzIZve/75isAZOad+YqI8RfRQVGmTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177967; 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=GgzHlh5no6ZMEWn97BK7nA1U+RXJ0YwWh/X5BXR+pJY=; b=eia8upt0h1+NpuYRidpo0qoox9lV3DLdygiZhTlk/8O8C4Toa32HnYHLPqpJ2cBZ7lrFgP6+bs7qeoemKM9E+tn16kv7ZxohaRPdNCwsi50V/0kdFv2zsjO0zKy5u3hWshZygqin6Agl7aH7NbW8cAT65pXmrw2ZBcN6EcI0jI4= 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) header.from= 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 1614177967923387.20765808100316; Wed, 24 Feb 2021 06:46:07 -0800 (PST) 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-2-DpemQ7kuO6ar6Hs0J0Jp2A-1; Wed, 24 Feb 2021 09:46:04 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DA28EA4086D; Wed, 24 Feb 2021 13:54:28 +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 AA0DE1001281; Wed, 24 Feb 2021 13:54:28 +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 5D8F118095CE; Wed, 24 Feb 2021 13:54:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODsQmS016814 for ; Wed, 24 Feb 2021 08:54:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id B3D686A8E6; Wed, 24 Feb 2021 13:54:26 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AA355D6D3; Wed, 24 Feb 2021 13:54:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177966; 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=GgzHlh5no6ZMEWn97BK7nA1U+RXJ0YwWh/X5BXR+pJY=; b=OoqDGviRw4IL0wC7RhlrkNV84fNlMR4iJpOCmdKz9HKLVusjZFb6jKyWjji7m8ekFdKR+q jZJgkdzmoX/i2Wy0Ba5Jw15bpfky8WFw8wOljagF0bFzmE52vaJD5VCPaBOGrrdfjyWjdj 1mjwPJ51nYn7RygBPYDG9TIDLOAn6Hg= X-MC-Unique: DpemQ7kuO6ar6Hs0J0Jp2A-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 12/31] qapi/qom: Add ObjectOptions for can-* Date: Wed, 24 Feb 2021 14:52:36 +0100 Message-Id: <20210224135255.253837-13-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.22 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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the can-* objects. can-bus doesn't have any properties, so it only needs to be added to the ObjectType enum without adding a new branch to ObjectOptions. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/qom.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/qapi/qom.json b/qapi/qom.json index f22b7aa99b..4b1cd4b8dc 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -207,6 +207,21 @@ 'returns': [ 'ObjectPropertyInfo' ], 'allow-preconfig': true } =20 +## +# @CanHostSocketcanProperties: +# +# Properties for can-host-socketcan objects. +# +# @if: interface name of the host system CAN bus to connect to +# +# @canbus: object ID of the can-bus object to connect to the host interface +# +# Since: 2.12 +## +{ 'struct': 'CanHostSocketcanProperties', + 'data': { 'if': 'str', + 'canbus': 'str' } } + ## # @CryptodevBackendProperties: # @@ -439,6 +454,8 @@ 'authz-listfile', 'authz-pam', 'authz-simple', + 'can-bus', + 'can-host-socketcan', 'cryptodev-backend', 'cryptodev-backend-builtin', 'cryptodev-vhost-user', @@ -479,6 +496,7 @@ 'authz-listfile': 'AuthZListFileProperties', 'authz-pam': 'AuthZPAMProperties', 'authz-simple': 'AuthZSimpleProperties', + 'can-host-socketcan': 'CanHostSocketcanProperties', 'cryptodev-backend': 'CryptodevBackendProperties', 'cryptodev-backend-builtin': 'CryptodevBackendProperties', 'cryptodev-vhost-user': 'CryptodevVhostUserProperties', --=20 2.29.2 From nobody Sun May 19 02:38:07 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=1614177884; cv=none; d=zohomail.com; s=zohoarc; b=FEA6QoH7NkmTGWPb09gJ6EKjfct+rKIenZ+AmX4gAP/Qe0DaPUSS7zuHpSuTAY1fNX/JYdZK0OrvVsIJj1OHlZMVYiiTj5i+ATNuYG50g2d8amF409fx2kZ7zL+VIyvBcMMh2URBfgCaGPoY3EPr9RQmbm9OXwUiGRU4arScCOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177884; 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=dlOzn8xjPIuRTgy9kvqoi3SITZFMJXbkV6/9K7HjVKE=; b=bWxOhi7MkAVTNPwiXoHZ6WrFQS8J9ODbU6/aidabwTUJi4FFzYOLtvTW+A0/WeuXm0jbK1uKWH9vAY/1nCo0PLQecw2hEoHyu4zizJ2qTZuzBkPf7m1xAU8J3UTjMVC9yaHnqTGc+Jd0sUFX0eNL3QGem2U0yTLzLpFUPo5V07g= 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) header.from= 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 1614177884507844.8326088750987; Wed, 24 Feb 2021 06:44:44 -0800 (PST) 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-445-WZ9ZTonaPWGHMuvRxlcaVA-1; Wed, 24 Feb 2021 09:44:39 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D0D51173A65; Wed, 24 Feb 2021 13:54:31 +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 5F3E61001281; Wed, 24 Feb 2021 13:54:31 +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 1772E1809C92; Wed, 24 Feb 2021 13:54:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODsTm2016832 for ; Wed, 24 Feb 2021 08:54:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id ED5F462953; Wed, 24 Feb 2021 13:54:29 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0989D5D6D3; Wed, 24 Feb 2021 13:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177883; 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=dlOzn8xjPIuRTgy9kvqoi3SITZFMJXbkV6/9K7HjVKE=; b=NzCbt3n2jW0eSzuQOxn84biJcNHtLSQevQRiCLecnN1qS2YMGv8A5D9ROX/NMWOp2Wwudc 0e6zDo0H5rbzXPWqKZe9FBDccKY9S/ZMH83jtAeLsZOEtmS7lwJLL4l+Q2DVrM78SITJTe XJObY6q83JONOBMJ15HC+pa9wFqR7p4= X-MC-Unique: WZ9ZTonaPWGHMuvRxlcaVA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 13/31] qapi/qom: Add ObjectOptions for colo-compare Date: Wed, 24 Feb 2021 14:52:37 +0100 Message-Id: <20210224135255.253837-14-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.22 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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the colo-compare object. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/qom.json | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/qapi/qom.json b/qapi/qom.json index 4b1cd4b8dc..8e4414f843 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -222,6 +222,53 @@ 'data': { 'if': 'str', 'canbus': 'str' } } =20 +## +# @ColoCompareProperties: +# +# Properties for colo-compare objects. +# +# @primary_in: name of the character device backend to use for the primary +# input (incoming packets are redirected to @outdev) +# +# @secondary_in: name of the character device backend to use for secondary +# input (incoming packets are only compared to the input on +# @primary_in and then dropped) +# +# @outdev: name of the character device backend to use for output +# +# @iothread: name of the iothread to run in +# +# @notify_dev: name of the character device backend to be used to communic= ate +# with the remote colo-frame (only for Xen COLO) +# +# @compare_timeout: the maximum time to hold a packet from @primary_in for +# comparison with an incoming packet on @secondary_in in +# milliseconds (default: 3000) +# +# @expired_scan_cycle: the interval at which colo-compare checks whether +# packets from @primary have timed out, in millisecon= ds +# (default: 3000) +# +# @max_queue_size: the maximum number of packets to keep in the queue for +# comparing with incoming packets from @secondary_in. If= the +# queue is full and addtional packets are received, the +# addtional packets are dropped. (default: 1024) +# +# @vnet_hdr_support: if true, vnet header support is enabled (default: fal= se) +# +# Since: 2.8 +## +{ 'struct': 'ColoCompareProperties', + 'data': { 'primary_in': 'str', + 'secondary_in': 'str', + 'outdev': 'str', + 'iothread': 'str', + '*notify_dev': 'str', + '*compare_timeout': 'uint64', + '*expired_scan_cycle': 'uint32', + '*max_queue_size': 'uint32', + '*vnet_hdr_support': 'bool' } } + ## # @CryptodevBackendProperties: # @@ -456,6 +503,7 @@ 'authz-simple', 'can-bus', 'can-host-socketcan', + 'colo-compare', 'cryptodev-backend', 'cryptodev-backend-builtin', 'cryptodev-vhost-user', @@ -497,6 +545,7 @@ 'authz-pam': 'AuthZPAMProperties', 'authz-simple': 'AuthZSimpleProperties', 'can-host-socketcan': 'CanHostSocketcanProperties', + 'colo-compare': 'ColoCompareProperties', 'cryptodev-backend': 'CryptodevBackendProperties', 'cryptodev-backend-builtin': 'CryptodevBackendProperties', 'cryptodev-vhost-user': 'CryptodevVhostUserProperties', --=20 2.29.2 From nobody Sun May 19 02:38:07 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=1614177878; cv=none; d=zohomail.com; s=zohoarc; b=HPHJxDR9toA2zCZbYA7M2Q6VwyNiZ8jl6ld4SY8Kmmn8hHj3Nq0yfyl8pH9jm34OwAod9j+YVVDDNc8enkP4LZN7LoKdYWsT3Em4NaxYOqmY0harYhVl5RKK7OZFQhUJqoKn+GOnCGxe56H0oCMHNtgV+oR4ykeKVXb2Zn5HUg4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177878; 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=hhTIPIy0dMaUfARhSGGob0eFFj39xysB5J4Jcj9XLbs=; b=Ib249cd7zP+AeV8WXjjJetRKX1hpR3ufZ6Xgbk0Ji5TNwRcTeTCQsmG7ipHeNpuseh/GmFRNG7EbVyPVpUpaKIisg09RI7ojNxl7SeeJhw56Rk5JS36nKaZcm8U32nQ5D8dkmwcK77ti5qKKISKQrcpuSKQVaUKjkoLjj1gUqsQ= 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) header.from= 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 1614177878138426.88237003173776; Wed, 24 Feb 2021 06:44:38 -0800 (PST) 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-307-4PVcXfOfOnOeyMur8WqhQA-1; Wed, 24 Feb 2021 09:44:32 -0500 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 CCE2B91DDD2; Wed, 24 Feb 2021 13:54:37 +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 9F21462467; Wed, 24 Feb 2021 13:54:37 +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 521F818089C9; Wed, 24 Feb 2021 13:54:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODsamq016845 for ; Wed, 24 Feb 2021 08:54:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1BB0163623; Wed, 24 Feb 2021 13:54:36 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 456805D6D3; Wed, 24 Feb 2021 13:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177877; 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=hhTIPIy0dMaUfARhSGGob0eFFj39xysB5J4Jcj9XLbs=; b=Gu63/7I4qidL0xX5D371Bw/bOtdgeDZeXyJj2yJ6c9VZe6LqRe0szOUr31g/XkPdmi2FtL GmS1DHOzQvMRvOuQH1AvaAkSK9WLOp/DGvNmxubskJ4gshTKT3kP96c/KC4zgL1plsmld4 COxXt80uckrPvbdjgm0XoDcnFddzRpA= X-MC-Unique: 4PVcXfOfOnOeyMur8WqhQA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 14/31] qapi/qom: Add ObjectOptions for filter-* Date: Wed, 24 Feb 2021 14:52:38 +0100 Message-Id: <20210224135255.253837-15-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the filter-* objects. Some parts of the interface (in particular NetfilterProperties.position) are very unusual for QAPI, but for now just describe the existing interface. net.json can't be included in qom.json because the storage daemon doesn't have it. NetFilterDirection is still required in the new object property definitions in qom.json, so move this enum to common.json. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/common.json | 20 +++++++ qapi/net.json | 20 ------- qapi/qom.json | 143 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 20 deletions(-) diff --git a/qapi/common.json b/qapi/common.json index 2dad4fadc3..b87e7f9039 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -165,3 +165,23 @@ ## { 'enum': 'HostMemPolicy', 'data': [ 'default', 'preferred', 'bind', 'interleave' ] } + +## +# @NetFilterDirection: +# +# Indicates whether a netfilter is attached to a netdev's transmit queue or +# receive queue or both. +# +# @all: the filter is attached both to the receive and the transmit +# queue of the netdev (default). +# +# @rx: the filter is attached to the receive queue of the netdev, +# where it will receive packets sent to the netdev. +# +# @tx: the filter is attached to the transmit queue of the netdev, +# where it will receive packets sent by the netdev. +# +# Since: 2.5 +## +{ 'enum': 'NetFilterDirection', + 'data': [ 'all', 'rx', 'tx' ] } diff --git a/qapi/net.json b/qapi/net.json index c31748c87f..af3f5b0fda 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -492,26 +492,6 @@ 'vhost-user': 'NetdevVhostUserOptions', 'vhost-vdpa': 'NetdevVhostVDPAOptions' } } =20 -## -# @NetFilterDirection: -# -# Indicates whether a netfilter is attached to a netdev's transmit queue or -# receive queue or both. -# -# @all: the filter is attached both to the receive and the transmit -# queue of the netdev (default). -# -# @rx: the filter is attached to the receive queue of the netdev, -# where it will receive packets sent to the netdev. -# -# @tx: the filter is attached to the transmit queue of the netdev, -# where it will receive packets sent by the netdev. -# -# Since: 2.5 -## -{ 'enum': 'NetFilterDirection', - 'data': [ 'all', 'rx', 'tx' ] } - ## # @RxState: # diff --git a/qapi/qom.json b/qapi/qom.json index 8e4414f843..e3357f5123 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -313,6 +313,137 @@ 'data': { 'addr': 'str' , '*id-list': 'str' } } =20 +## +# @NetfilterInsert: +# +# Indicates where to insert a netfilter relative to a given other filter. +# +# @before: insert before the specified filter +# +# @behind: insert behind the specified filter +# +# Since: 5.0 +## +{ 'enum': 'NetfilterInsert', + 'data': [ 'before', 'behind' ] } + +## +# @NetfilterProperties: +# +# Properties for objects of classes derived from netfilter. +# +# @netdev: id of the network device backend to filter +# +# @queue: indicates which queue(s) to filter (default: all) +# +# @status: indicates whether the filter is enabled ("on") or disabled ("of= f") +# (default: "on") +# +# @position: specifies where the filter should be inserted in the filter l= ist. +# "head" means the filter is inserted at the head of the filter= list, +# before any existing filters. +# "tail" means the filter is inserted at the tail of the filter= list, +# behind any existing filters (default). +# "id=3D" means the filter is inserted before or behind the= filter +# specified by , depending on the @insert property. +# (default: "tail") +# +# @insert: where to insert the filter relative to the filter given in @pos= ition. +# Ignored if @position is "head" or "tail". (default: behind) +# +# Since: 2.5 +## +{ 'struct': 'NetfilterProperties', + 'data': { 'netdev': 'str', + '*queue': 'NetFilterDirection', + '*status': 'str', + '*position': 'str', + '*insert': 'NetfilterInsert' } } + +## +# @FilterBufferProperties: +# +# Properties for filter-buffer objects. +# +# @interval: a non-zero interval in microseconds. All packets arriving in= the +# given interval are delayed until the end of the interval. +# +# Since: 2.5 +## +{ 'struct': 'FilterBufferProperties', + 'base': 'NetfilterProperties', + 'data': { 'interval': 'uint32' } } + +## +# @FilterDumpProperties: +# +# Properties for filter-dump objects. +# +# @file: the filename where the dumped packets should be stored +# +# @maxlen: maximum number of bytes in a packet that are stored (default: 6= 5536) +# +# Since: 2.5 +## +{ 'struct': 'FilterDumpProperties', + 'base': 'NetfilterProperties', + 'data': { 'file': 'str', + '*maxlen': 'uint32' } } + +## +# @FilterMirrorProperties: +# +# Properties for filter-mirror objects. +# +# @outdev: the name of a character device backend to which all incoming pa= ckets +# are mirrored +# +# @vnet_hdr_support: if true, vnet header support is enabled (default: fal= se) +# +# Since: 2.6 +## +{ 'struct': 'FilterMirrorProperties', + 'base': 'NetfilterProperties', + 'data': { 'outdev': 'str', + '*vnet_hdr_support': 'bool' } } + +## +# @FilterRedirectorProperties: +# +# Properties for filter-redirector objects. +# +# At least one of @indev or @outdev must be present. If both are present,= they +# must not refer to the same character device backend. +# +# @indev: the name of a character device backend from which packets are +# received and redirected to the filtered network device +# +# @outdev: the name of a character device backend to which all incoming pa= ckets +# are redirected +# +# @vnet_hdr_support: if true, vnet header support is enabled (default: fal= se) +# +# Since: 2.6 +## +{ 'struct': 'FilterRedirectorProperties', + 'base': 'NetfilterProperties', + 'data': { '*indev': 'str', + '*outdev': 'str', + '*vnet_hdr_support': 'bool' } } + +## +# @FilterRewriterProperties: +# +# Properties for filter-rewriter objects. +# +# @vnet_hdr_support: if true, vnet header support is enabled (default: fal= se) +# +# Since: 2.8 +## +{ 'struct': 'FilterRewriterProperties', + 'base': 'NetfilterProperties', + 'data': { '*vnet_hdr_support': 'bool' } } + ## # @IothreadProperties: # @@ -508,6 +639,12 @@ 'cryptodev-backend-builtin', 'cryptodev-vhost-user', 'dbus-vmstate', + 'filter-buffer', + 'filter-dump', + 'filter-mirror', + 'filter-redirector', + 'filter-replay', + 'filter-rewriter', 'iothread', 'memory-backend-file', 'memory-backend-memfd', @@ -550,6 +687,12 @@ 'cryptodev-backend-builtin': 'CryptodevBackendProperties', 'cryptodev-vhost-user': 'CryptodevVhostUserProperties', 'dbus-vmstate': 'DBusVMStateProperties', + 'filter-buffer': 'FilterBufferProperties', + 'filter-dump': 'FilterDumpProperties', + 'filter-mirror': 'FilterMirrorProperties', + 'filter-redirector': 'FilterRedirectorProperties', + 'filter-replay': 'NetfilterProperties', + 'filter-rewriter': 'FilterRewriterProperties', 'iothread': 'IothreadProperties', 'memory-backend-file': 'MemoryBackendFileProperties', 'memory-backend-memfd': 'MemoryBackendMemfdProperties', --=20 2.29.2 From nobody Sun May 19 02:38:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614177993; cv=none; d=zohomail.com; s=zohoarc; b=d2VGU6rWXsMA81HEEOBfJcwDWfTMtUrVq1GM15EnHSqmpD8pH84GdsarkuYMQsWkYrPCdoOD3GhmTXlybsNG2qo4Vsgr+Yz8mpZXz6VRBRRDvndRaZm1/zjOZXaShlyW6NI4c0oac/pNwRD1yFo1WujbQRxNiHrOl0f7B21yrZI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177993; 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=VgngjCam0k6n9s8F9WpRYsDHsQSnHYz2VjdENDHxYZw=; b=Bj+Qqt3GUWj4cIdt+Y22O7Ld4RH4FC06UrtWToHIFZdW7ctEY2ymt2DIpLiuW0BHlS03iYdNVplPp3w6kNFYfV3Bhfvu35aCLwBHVd79/21P+M7ItZ89GqRu5/eUlFnoXJBJmUjFuHlfIOuNeN9kWLc9x/qzg8oPTE3c3hnooKY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614177993101346.6341321241297; Wed, 24 Feb 2021 06:46:33 -0800 (PST) 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-396-dTLSaUvOM-yvwj4ZZhzrbQ-1; Wed, 24 Feb 2021 09:46:03 -0500 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 CC5F418E791E; Wed, 24 Feb 2021 13:54:46 +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 A75BE60C61; Wed, 24 Feb 2021 13:54:46 +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 5991718089D1; Wed, 24 Feb 2021 13:54:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODsjuK016869 for ; Wed, 24 Feb 2021 08:54:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id B1D1E62A1B; Wed, 24 Feb 2021 13:54:45 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65BC15D6D3; Wed, 24 Feb 2021 13:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177992; 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=VgngjCam0k6n9s8F9WpRYsDHsQSnHYz2VjdENDHxYZw=; b=Ipc8rZo++uZwF0EqEIWhrs4DWzMo/D88c1bVk5VQhBzqy2aRa5yPFb6iIqMR0YnnCh/5cL qk/au+psoyfkqkFIiDg6RT8B8gi9StY219boJjTyy5to4BlaK9tUZghNH4R8n61VuhpxfO M7klzD5NvF9w60n+yEFar35dB/teKuM= X-MC-Unique: dTLSaUvOM-yvwj4ZZhzrbQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 15/31] qapi/qom: Add ObjectOptions for pr-manager-helper Date: Wed, 24 Feb 2021 14:52:39 +0100 Message-Id: <20210224135255.253837-16-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the pr-manager-helper object. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/qom.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qapi/qom.json b/qapi/qom.json index e3357f5123..e7184122e9 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -575,6 +575,18 @@ '*hugetlbsize': 'size', '*seal': 'bool' } } =20 +## +# @PrManagerHelperProperties: +# +# Properties for pr-manager-helper objects. +# +# @path: the path to a Unix domain socket for connecting to the external h= elper +# +# Since: 2.11 +## +{ 'struct': 'PrManagerHelperProperties', + 'data': { 'path': 'str' } } + ## # @RngProperties: # @@ -649,6 +661,7 @@ 'memory-backend-file', 'memory-backend-memfd', 'memory-backend-ram', + 'pr-manager-helper', 'rng-builtin', 'rng-egd', 'rng-random', @@ -697,6 +710,7 @@ 'memory-backend-file': 'MemoryBackendFileProperties', 'memory-backend-memfd': 'MemoryBackendMemfdProperties', 'memory-backend-ram': 'MemoryBackendProperties', + 'pr-manager-helper': 'PrManagerHelperProperties', 'rng-builtin': 'RngProperties', 'rng-egd': 'RngEgdProperties', 'rng-random': 'RngRandomProperties', --=20 2.29.2 From nobody Sun May 19 02:38:07 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=1614177975; cv=none; d=zohomail.com; s=zohoarc; b=KEc+HWKzzguWf7e/AbxZqybct650pLc+AxVHm5RTlPTbTfRjbr43ujKsEIL1EN1vm4XawtXZ+QdIXorNqowQu5zNLFvugKW9zEGOjlWEchz/+HD/0jinDq4WBa70JoHZMEdU9br0bgngNkDjntVxYtocWGuXj3ZOzmQOYS2Xk+A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177975; 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=fh4qzydDPWdbmK8J8JendkPybAKa+37bNhnHqiq3mfM=; b=llfFoEeqFTVznYEnwntN/1KeV/tMQXRRy6zPR41Y1J1CO288MCrQ+iWN4nokB19VaR8NTcxPuIY/JnQ8OakJP3XI4dQaifaUXOHGnqa+rMYQESh3NgpvB4OU72aEqM5wElyB+Angms8EgH6q9ncNYjtWAMDCZ2O5aFdi0Dk25vo= 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) header.from= 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 1614177975842958.5593902373274; Wed, 24 Feb 2021 06:46:15 -0800 (PST) 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-36-Z5IjQvA7OjmJk2p4az7LSg-1; Wed, 24 Feb 2021 09:46:11 -0500 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 7986790A3C0; Wed, 24 Feb 2021 13:54:51 +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 4EBCD5C23E; Wed, 24 Feb 2021 13:54:51 +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 EEF9F5807A; Wed, 24 Feb 2021 13:54:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODsn4o016880 for ; Wed, 24 Feb 2021 08:54:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0560462953; Wed, 24 Feb 2021 13:54:49 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08C8B5D74A; Wed, 24 Feb 2021 13:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177974; 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=fh4qzydDPWdbmK8J8JendkPybAKa+37bNhnHqiq3mfM=; b=SQmDb3YMcKBBfuGPwYN5TUdjRNbTyr+QJ3Vut3wIbt/p4vfS3COKjqgtaR31rK0vD7LNYb QGXqb1VxXqsnZJP48apHENG3B/Tp1/T8MG8NP5ypf+HekG5sWN6vJdPw9itcPZDwZgl7n9 YD+jEfZtOziM0/rgprukvTpTGpDnuv8= X-MC-Unique: Z5IjQvA7OjmJk2p4az7LSg-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 16/31] qapi/qom: Add ObjectOptions for confidential-guest-support Date: Wed, 24 Feb 2021 14:52:40 +0100 Message-Id: <20210224135255.253837-17-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the objects implementing the confidential-guest-support interface. pef-guest and s390x-pv-guest don't have any properties, so they only need to be added to the ObjectType enum without adding a new branch to ObjectOptions. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/qom.json | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/qapi/qom.json b/qapi/qom.json index e7184122e9..d5f68b5c89 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -633,6 +633,38 @@ 'base': 'RngProperties', 'data': { '*filename': 'str' } } =20 +## +# @SevGuestProperties: +# +# Properties for sev-guest objects. +# +# @sev-device: SEV device to use (default: "/dev/sev") +# +# @dh-cert-file: guest owners DH certificate (encoded with base64) +# +# @session-file: guest owners session parameters (encoded with base64) +# +# @policy: SEV policy value (default: 0x1) +# +# @handle: SEV firmware handle (default: 0) +# +# @cbitpos: C-bit location in page table entry (default: 0) +# +# @reduced-phys-bits: number of bits in physical addresses that become +# unavailable when SEV is enabled +# +# Since: 2.12 +## +{ 'struct': 'SevGuestProperties', + 'data': { '*sev-device': 'str', + '*dh-cert-file': 'str', + '*session-file': 'str', + '*policy': 'uint32', + '*handle': 'uint32', + '*cbitpos': 'uint32', + 'reduced-phys-bits': 'uint32' }, + 'if': 'defined(CONFIG_SEV)' } + ## # @ObjectType: # @@ -661,12 +693,15 @@ 'memory-backend-file', 'memory-backend-memfd', 'memory-backend-ram', + {'name': 'pef-guest', 'if': 'defined(CONFIG_PSERIES)' }, 'pr-manager-helper', 'rng-builtin', 'rng-egd', 'rng-random', 'secret', 'secret_keyring', + {'name': 'sev-guest', 'if': 'defined(CONFIG_SEV)' }, + 's390-pv-guest', 'throttle-group', 'tls-creds-anon', 'tls-creds-psk', @@ -716,6 +751,8 @@ 'rng-random': 'RngRandomProperties', 'secret': 'SecretProperties', 'secret_keyring': 'SecretKeyringProperties', + 'sev-guest': { 'type': 'SevGuestProperties', + 'if': 'defined(CONFIG_SEV)' }, 'throttle-group': 'ThrottleGroupProperties', 'tls-creds-anon': 'TlsCredsAnonProperties', 'tls-creds-psk': 'TlsCredsPskProperties', --=20 2.29.2 From nobody Sun May 19 02:38:07 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=1614177896; cv=none; d=zohomail.com; s=zohoarc; b=TGIP+qCBODaZekWvs3909+LYxgKGbJZTuKPhBy25OVPrWR6IzN5WNoJhxPamRZ3qnHnMbJVA/XH7Ffzpye8DCxNBMt7cddXBJioD6j4u+zLdTh4GpYJcioRAFTyH3b8/VnXdktrV6YETVDYSD9/itYoyLz7v6Uvnl4i/HwxBnMc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177896; 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=Zfq4SzXzqUXAiI5xrLZIkrzp4js4GcRp/LiBy7aHsj0=; b=Ezra+Pavjo/f/Eciq+cq6JBCOXTAU1Gpov4qJhX9WfqJwi0ZguPXOxM7lfViT6Nm2Q9beWD68FtoRbG8/r8MlwJe6raNGr8XKAjSZxt9YgQ0lBeBGvPE/k3KeeL6AVtSF55tV4ws9BHV+1VefevJPMQcVOF7X7kdYPRETJzOjxE= 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) header.from= 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 161417789598968.70977088269422; Wed, 24 Feb 2021 06:44:55 -0800 (PST) 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-311-pz-8ymxWNXKVPwgDcqNTZQ-1; Wed, 24 Feb 2021 09:44:49 -0500 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 0FBE31176484; Wed, 24 Feb 2021 13:54:56 +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 D747560C61; Wed, 24 Feb 2021 13:54:55 +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 780CE58085; Wed, 24 Feb 2021 13:54:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODsqhE016891 for ; Wed, 24 Feb 2021 08:54:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 433A562AF8; Wed, 24 Feb 2021 13:54:52 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 502665D6D3; Wed, 24 Feb 2021 13:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177892; 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=Zfq4SzXzqUXAiI5xrLZIkrzp4js4GcRp/LiBy7aHsj0=; b=aUDoR7AryhGT4vsvmhbYNq8sqWVIzE9d4xoHORMmuysVMFQB13G+xbs537OE4HMXjsGwh0 cTX7mAYhJkvqjwR4fyOrHS2slwlPd4ze2PM89vr52Bq72hXATUmqZ+4GdBkatYuNHEZrN/ sUrnQhvZffpH8XojuLNl5nWH1yI6ghU= X-MC-Unique: pz-8ymxWNXKVPwgDcqNTZQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 17/31] qapi/qom: Add ObjectOptions for input-* Date: Wed, 24 Feb 2021 14:52:41 +0100 Message-Id: <20210224135255.253837-18-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the input-* objects. ui.json cannot be included in qom.json because the storage daemon can't use it, so move GrabToggleKeys to common.json. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/common.json | 12 ++++++++++ qapi/qom.json | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ qapi/ui.json | 13 +---------- 3 files changed, 71 insertions(+), 12 deletions(-) diff --git a/qapi/common.json b/qapi/common.json index b87e7f9039..7c976296f0 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -185,3 +185,15 @@ ## { 'enum': 'NetFilterDirection', 'data': [ 'all', 'rx', 'tx' ] } + +## +# @GrabToggleKeys: +# +# Keys to toggle input-linux between host and guest. +# +# Since: 4.0 +# +## +{ 'enum': 'GrabToggleKeys', + 'data': [ 'ctrl-ctrl', 'alt-alt', 'shift-shift','meta-meta', 'scrolllock= ', + 'ctrl-scrolllock' ] } diff --git a/qapi/qom.json b/qapi/qom.json index d5f68b5c89..f8ff322df0 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -444,6 +444,60 @@ 'base': 'NetfilterProperties', 'data': { '*vnet_hdr_support': 'bool' } } =20 +## +# @InputBarrierProperties: +# +# Properties for input-barrier objects. +# +# @name: the screen name as declared in the screens section of barrier.conf +# +# @server: hostname of the Barrier server (default: "localhost") +# +# @port: TCP port of the Barrier server (default: "24800") +# +# @x-origin: x coordinate of the leftmost pixel on the guest screen +# (default: "0") +# +# @y-origin: y coordinate of he topmost pixel on the guest screen (default= : "0") +# +# @width: the width of secondary screen in pixels (default: "1920") +# +# @height: the height of secondary screen in pixels (default: "1080") +# +# Since: 4.2 +## +{ 'struct': 'InputBarrierProperties', + 'data': { 'name': 'str', + '*server': 'str', + '*port': 'str', + '*x-origin': 'str', + '*y-origin': 'str', + '*width': 'str', + '*height': 'str' } } + +## +# @InputLinuxProperties: +# +# Properties for input-linux objects. +# +# @evdev: the path of the host evdev device to use +# +# @grab_all: if true, grab is toggled for all devices (e.g. both keyboard = and +# mouse) instead of just one device (default: false) +# +# @repeat: enables auto-repeat events (default: false) +# +# @grab-toggle: the key or key combination that toggles device grab +# (default: ctrl-ctrl) +# +# Since: 2.6 +## +{ 'struct': 'InputLinuxProperties', + 'data': { 'evdev': 'str', + '*grab_all': 'bool', + '*repeat': 'bool', + '*grab-toggle': 'GrabToggleKeys' } } + ## # @IothreadProperties: # @@ -689,6 +743,8 @@ 'filter-redirector', 'filter-replay', 'filter-rewriter', + 'input-barrier', + 'input-linux', 'iothread', 'memory-backend-file', 'memory-backend-memfd', @@ -741,6 +797,8 @@ 'filter-redirector': 'FilterRedirectorProperties', 'filter-replay': 'NetfilterProperties', 'filter-rewriter': 'FilterRewriterProperties', + 'input-barrier': 'InputBarrierProperties', + 'input-linux': 'InputLinuxProperties', 'iothread': 'IothreadProperties', 'memory-backend-file': 'MemoryBackendFileProperties', 'memory-backend-memfd': 'MemoryBackendMemfdProperties', diff --git a/qapi/ui.json b/qapi/ui.json index d08d72b439..cc1882108b 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -6,6 +6,7 @@ # =3D Remote desktop ## =20 +{ 'include': 'common.json' } { 'include': 'sockets.json' } =20 ## @@ -1021,18 +1022,6 @@ '*head' : 'int', 'events' : [ 'InputEvent' ] } } =20 -## -# @GrabToggleKeys: -# -# Keys to toggle input-linux between host and guest. -# -# Since: 4.0 -# -## -{ 'enum': 'GrabToggleKeys', - 'data': [ 'ctrl-ctrl', 'alt-alt', 'shift-shift','meta-meta', 'scrolllock= ', - 'ctrl-scrolllock' ] } - ## # @DisplayGTK: # --=20 2.29.2 From nobody Sun May 19 02:38:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614177977; cv=none; d=zohomail.com; s=zohoarc; b=IfWT/lVAbxBqJhRiT6Zo2NY8suhpehCvGRKO9m7dvyhynjTQ9LWGRQJcpLBGb8XdyZjAjOn3l8M5aMQ2HTGG+aB2vGIszFfiDr6hUOtiaDBSrxhkSXv2dlHAvfBltCumN5mwKX/uG9ntlLSoV4f8CRB8I8/fSkqcZJzAYPFpgkU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177977; 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=B4mFIIwPoekdGn6jvV+m11IKB4CkXiZAiqSV9n12yM0=; b=dwk8IExC0n/Bj7CzfEHQiwuaa4FUaTRwlNtYeqC7BB10xe8c20Dq+O4mG2Rryi/X7DNESxka+SLOD3YjbLsJCl1XvbbZyeFXXSAmDG8Z7t1Vo80FEHdBPuQxBg3UVGmrs5Ur4ZIb0eMaZTnq3F1QGP3T8EPtKyEYyQULS+kuWiY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614177977625808.8173596673134; Wed, 24 Feb 2021 06:46:17 -0800 (PST) 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-134-K2WZVGGzMWCL1v4DrVqGoA-1; Wed, 24 Feb 2021 09:46:14 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6F42A476E2; Wed, 24 Feb 2021 13:55:00 +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 8E74B5D9D3; Wed, 24 Feb 2021 13:55:00 +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 2819C58088; Wed, 24 Feb 2021 13:55:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODst4F016907 for ; Wed, 24 Feb 2021 08:54:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 80473669EB; Wed, 24 Feb 2021 13:54:55 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DAF05D6D3; Wed, 24 Feb 2021 13:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177976; 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=B4mFIIwPoekdGn6jvV+m11IKB4CkXiZAiqSV9n12yM0=; b=Yj3qD7X+r1UG1YampmIj1+AfoYo5lneZb19IE7tohhtkvXXg3fGoCsmYGLfL+sQQ0Sag+R 0co8NHtPlgnzULMmFqBVFXCKsSJoIScTAnnfm/MltpCbVxRMY8g2BZKv16pRj1tEXT2x3q QSKENw2BElDqU7TWJIiuL55WUK2aS6o= X-MC-Unique: K2WZVGGzMWCL1v4DrVqGoA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 18/31] qapi/qom: Add ObjectOptions for x-remote-object Date: Wed, 24 Feb 2021 14:52:42 +0100 Message-Id: <20210224135255.253837-19-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.14 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) Content-Type: text/plain; charset="utf-8" This adds a QAPI schema for the properties of the x-remote-object object. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/qom.json | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/qapi/qom.json b/qapi/qom.json index f8ff322df0..6793342e81 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -641,6 +641,20 @@ { 'struct': 'PrManagerHelperProperties', 'data': { 'path': 'str' } } =20 +## +# @RemoteObjectProperties: +# +# Properties for x-remote-object objects. +# +# @fd: file descriptor name previously passed via 'getfd' command +# +# @devid: the id of the device to be associated with the file descriptor +# +# Since: 6.0 +## +{ 'struct': 'RemoteObjectProperties', + 'data': { 'fd': 'str', 'devid': 'str' } } + ## # @RngProperties: # @@ -762,7 +776,8 @@ 'tls-creds-anon', 'tls-creds-psk', 'tls-creds-x509', - 'tls-cipher-suites' + 'tls-cipher-suites', + 'x-remote-object' ] } =20 ## @@ -815,7 +830,8 @@ 'tls-creds-anon': 'TlsCredsAnonProperties', 'tls-creds-psk': 'TlsCredsPskProperties', 'tls-creds-x509': 'TlsCredsX509Properties', - 'tls-cipher-suites': 'TlsCredsProperties' + 'tls-cipher-suites': 'TlsCredsProperties', + 'x-remote-object': 'RemoteObjectProperties' } } =20 ## --=20 2.29.2 From nobody Sun May 19 02:38:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614177901; cv=none; d=zohomail.com; s=zohoarc; b=cm+bH+hu5GE95F5btnG0gRLr7ZGovUL8IpCv/xEYl6w7PjMsWkXnNEjyFYvpDPKcv0qt5ZFV4vQim66hgH1+ULbbBXN9eVdloku6D0x/5jVZ0e673QgfnUkDI6Y0qiuZ3LPicsxk5a/yae0Wj62OJsscujDcrAj8w/pC7YJz/eQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177901; 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=Op1QyPMQTFyHtE4n34pVNs4NUIZvPABPnPTmaTNMnGs=; b=hId1GK6IUyeDxLxlNAvEu+H2bKQx1zwyNaYNhxMrG7Uj3FzR3voyVsBzADD8bfQwRYwspfOBFe/FYqPBJxNs58BUZ5XUuxxU5pqafRDWV1RdJYnNa4iLja9Hn4flIZ+7wC7i0GtQ4zNLNegODy1Lg9FLsH2db2JOXbr2M0NsQsc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614177901376755.2310080770582; Wed, 24 Feb 2021 06:45:01 -0800 (PST) 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-390-zVZOr9XLPeW4rSlvgquIsg-1; Wed, 24 Feb 2021 09:44:45 -0500 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 D18268D08F0; Wed, 24 Feb 2021 13:55:20 +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 9556E7770F; Wed, 24 Feb 2021 13:55:20 +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 257A61809C8F; Wed, 24 Feb 2021 13:55:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODtIQQ016970 for ; Wed, 24 Feb 2021 08:55:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id B092962467; Wed, 24 Feb 2021 13:55:18 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB3AF669EB; Wed, 24 Feb 2021 13:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177897; 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=Op1QyPMQTFyHtE4n34pVNs4NUIZvPABPnPTmaTNMnGs=; b=ZeGqk323roNhkRIcH4Nmv2Cf1YFOfhv0rEg1npZ1oLgQguGdEaLklr9R2z9DxVPe8qG9++ ZQX8Xmzfvjl7jA/0XkwmYHyiCKG1kbL3eFs1nrxS4SOhTLjyuT3xkOku9hJS9qqAcXICKR 7TGjM5ZhWK+9z4nYx4nCO/kk/Y+BDPk= X-MC-Unique: zVZOr9XLPeW4rSlvgquIsg-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 19/31] qapi/qom: QAPIfy object-add Date: Wed, 24 Feb 2021 14:52:43 +0100 Message-Id: <20210224135255.253837-20-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This converts object-add from 'gen': false to the ObjectOptions QAPI type. As an immediate benefit, clients can now use QAPI schema introspection for user creatable QOM objects. It is also the first step towards making the QAPI schema the only external interface for the creation of user creatable objects. Once all other places (HMP and command lines of the system emulator and all tools) go through QAPI, too, some object implementations can be simplified because some checks (e.g. that mandatory options are set) are already performed by QAPI, and in another step, QOM boilerplate code could be generated from the schema. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qapi/qom.json | 11 +---------- include/qom/object_interfaces.h | 7 ------- hw/block/xen-block.c | 16 ++++++++-------- monitor/misc.c | 2 -- qom/qom-qmp-cmds.c | 25 +++++++++++++++++++++++-- storage-daemon/qemu-storage-daemon.c | 2 -- 6 files changed, 32 insertions(+), 31 deletions(-) diff --git a/qapi/qom.json b/qapi/qom.json index 6793342e81..e5b219df58 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -839,13 +839,6 @@ # # Create a QOM object. # -# @qom-type: the class name for the object to be created -# -# @id: the name of the new object -# -# Additional arguments depend on qom-type and are passed to the backend -# unchanged. -# # Returns: Nothing on success # Error if @qom-type is not a valid class name # @@ -859,9 +852,7 @@ # <- { "return": {} } # ## -{ 'command': 'object-add', - 'data': {'qom-type': 'str', 'id': 'str'}, - 'gen': false } # so we can get the additional arguments +{ 'command': 'object-add', 'data': 'ObjectOptions', 'boxed': true } =20 ## # @object-del: diff --git a/include/qom/object_interfaces.h b/include/qom/object_interface= s.h index 07d5cc8832..9b9938b8c0 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -196,11 +196,4 @@ bool user_creatable_del(const char *id, Error **errp); */ void user_creatable_cleanup(void); =20 -/** - * qmp_object_add: - * - * QMP command handler for object-add. See the QAPI schema for documentati= on. - */ -void qmp_object_add(QDict *qdict, QObject **ret_data, Error **errp); - #endif diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index a3b69e2709..ac82d54063 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -836,17 +836,17 @@ static XenBlockIOThread *xen_block_iothread_create(co= nst char *id, { ERRP_GUARD(); XenBlockIOThread *iothread =3D g_new(XenBlockIOThread, 1); - QDict *opts; - QObject *ret_data =3D NULL; + ObjectOptions *opts; =20 iothread->id =3D g_strdup(id); =20 - opts =3D qdict_new(); - qdict_put_str(opts, "qom-type", TYPE_IOTHREAD); - qdict_put_str(opts, "id", id); - qmp_object_add(opts, &ret_data, errp); - qobject_unref(opts); - qobject_unref(ret_data); + opts =3D g_new(ObjectOptions, 1); + *opts =3D (ObjectOptions) { + .qom_type =3D OBJECT_TYPE_IOTHREAD, + .id =3D g_strdup(id), + }; + qmp_object_add(opts, errp); + qapi_free_ObjectOptions(opts); =20 if (*errp) { g_free(iothread->id); diff --git a/monitor/misc.c b/monitor/misc.c index a7650ed747..42efd9e2ab 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -235,8 +235,6 @@ static void monitor_init_qmp_commands(void) qmp_query_qmp_schema, QCO_ALLOW_PRECONFIG); qmp_register_command(&qmp_commands, "device_add", qmp_device_add, QCO_NO_OPTIONS); - qmp_register_command(&qmp_commands, "object-add", qmp_object_add, - QCO_NO_OPTIONS); =20 QTAILQ_INIT(&qmp_cap_negotiation_commands); qmp_register_command(&qmp_cap_negotiation_commands, "qmp_capabilities", diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index 19fd5e117f..e577a96adf 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -19,8 +19,11 @@ #include "qapi/error.h" #include "qapi/qapi-commands-qdev.h" #include "qapi/qapi-commands-qom.h" +#include "qapi/qapi-visit-qom.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" +#include "qapi/qobject-input-visitor.h" +#include "qapi/qobject-output-visitor.h" #include "qemu/cutils.h" #include "qom/object_interfaces.h" #include "qom/qom-qobject.h" @@ -223,9 +226,27 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const = char *typename, return prop_list; } =20 -void qmp_object_add(QDict *qdict, QObject **ret_data, Error **errp) +void qmp_object_add(ObjectOptions *options, Error **errp) { - user_creatable_add_dict(qdict, false, errp); + Visitor *v; + QObject *qobj; + QDict *props; + Object *obj; + + v =3D qobject_output_visitor_new(&qobj); + visit_type_ObjectOptions(v, NULL, &options, &error_abort); + visit_complete(v, &qobj); + visit_free(v); + + props =3D qobject_to(QDict, qobj); + qdict_del(props, "qom-type"); + qdict_del(props, "id"); + + v =3D qobject_input_visitor_new(QOBJECT(props)); + obj =3D user_creatable_add_type(ObjectType_str(options->qom_type), + options->id, props, v, errp); + object_unref(obj); + visit_free(v); } =20 void qmp_object_del(const char *id, Error **errp) diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-sto= rage-daemon.c index 9021a46b3a..d8d172cc60 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -144,8 +144,6 @@ static void init_qmp_commands(void) qmp_init_marshal(&qmp_commands); qmp_register_command(&qmp_commands, "query-qmp-schema", qmp_query_qmp_schema, QCO_ALLOW_PRECONFIG); - qmp_register_command(&qmp_commands, "object-add", qmp_object_add, - QCO_NO_OPTIONS); =20 QTAILQ_INIT(&qmp_cap_negotiation_commands); qmp_register_command(&qmp_cap_negotiation_commands, "qmp_capabilities", --=20 2.29.2 From nobody Sun May 19 02:38:07 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=1614178033; cv=none; d=zohomail.com; s=zohoarc; b=BI9PqbDiHi0eaqNSW1/gWSVzYhbRP3D6LMGn45LDOY5+kNMxrY0NYMG5nzKJ5CSx5Y0a6hjtD/517n8SkLKf8+LL5PFevN9UZNBUFdj0SBRH/rFMORcD1OpvnocmfV7YqwayscJvrIrc8XnhuPZHGyrpkSDKVqBErPHxfXjDquw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614178033; 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=AobaPlNgCAnqHONabFOcGNEwPc/8s4zw3ZcU4Gk/lEw=; b=YG6Zjavxcd+H1JWzNFUJyLZ7cxw3REkodg7lhnSzfgOOUZyFr+ccBbpwr6aKzmiH0yBpG9r9SfokMjdQ7KtIdthGmHd37Ov2i1g9lXMn9DmarDOyr7TNwRmHrHLJGFEeE5ZxdRTg+B1QajhMK2qCPlDfTnBb41z4uKu/DSdmsY4= 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) header.from= 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 1614178033988300.8459013107838; Wed, 24 Feb 2021 06:47:13 -0800 (PST) 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-159-qTWKxKJ-NtqRBlnBWPNaEQ-1; Wed, 24 Feb 2021 09:47:09 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5FFAB189BEB8; Wed, 24 Feb 2021 13:55:55 +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 35E74702D8; Wed, 24 Feb 2021 13:55:55 +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 DC5BA58074; Wed, 24 Feb 2021 13:55:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODtsXU017022 for ; Wed, 24 Feb 2021 08:55:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 471A11ABE5; Wed, 24 Feb 2021 13:55:54 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0776662467; Wed, 24 Feb 2021 13:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614178033; 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=AobaPlNgCAnqHONabFOcGNEwPc/8s4zw3ZcU4Gk/lEw=; b=SzNfE5X1I6IwbNxCSoId+cyuQL2BxQ4HIyMJyyM6Gu9ZvtZQtyBm6XS2Pk1JOnxaSNs7cv m6Hx06GHxMfRua2u7h5U561ijRJ96XgqEN0aAPxor5prx7NNB3BY9HTi2TTUIfn3LX/eYX EGCU/Os8FkNX8AmG4kOz8dvhy7QPWRE= X-MC-Unique: qTWKxKJ-NtqRBlnBWPNaEQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 20/31] qom: Make "object" QemuOptsList optional Date: Wed, 24 Feb 2021 14:52:44 +0100 Message-Id: <20210224135255.253837-21-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.11 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) Content-Type: text/plain; charset="utf-8" This code is going away anyway, but for a few more commits, we'll be in a state where some binaries still use QemuOpts and others don't. If the "object" QemuOptsList doesn't even exist, we don't have to remove (or fail to remove, and therefore abort) a user creatable object from it. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qom/object_interfaces.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 1e9ad6f08a..b9a99c8bf4 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -290,6 +290,7 @@ void user_creatable_print_help_from_qdict(QDict *args) =20 bool user_creatable_del(const char *id, Error **errp) { + QemuOptsList *opts_list; Object *container; Object *obj; =20 @@ -309,8 +310,10 @@ bool user_creatable_del(const char *id, Error **errp) * if object was defined on the command-line, remove its corresponding * option group entry */ - qemu_opts_del(qemu_opts_find(qemu_find_opts_err("object", &error_abort= ), - id)); + opts_list =3D qemu_find_opts_err("object", NULL); + if (opts_list) { + qemu_opts_del(qemu_opts_find(opts_list, id)); + } =20 object_unparent(obj); return true; --=20 2.29.2 From nobody Sun May 19 02:38:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614178026; cv=none; d=zohomail.com; s=zohoarc; b=UBkcDPjG106a4aFLuScIVraeJcl5MH4HiSWOfe5RQLwqwCTS522ih28Owhxjew4LBZlLn3z98rFMt38W+ypWHui4WH8+FalWDB/z49fNVKjYLRqpiOeKmmFaMBW2Gzn/nOV0Czupdb4DBW0clRKFMAUwPx4CYc4H9ZEhAG8wL28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614178026; 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=Rvu65+jRiUDjpKVVzlkVo7vGPJ+1eTBtulg5V6OM288=; b=Z1cEVmfEbz7kfw6XV4VDjb3kMpFOMONikpXxN8c4o97qpVnabbzVW7VyGClRCbt/+M9n1DiFpkOQ5uDDHUet/19Miu10+vjyJF8aAzUSDmf3xxJQ6TgXkzJ638EkBNREt3AEZyS3wVERt6VbQ+ub/ywBNyodKOM1BmoVB7h0bx0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 16141780269336.577739793331261; Wed, 24 Feb 2021 06:47:06 -0800 (PST) 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-330-A5CHiytJOPiKBeXRBuK1EA-1; Wed, 24 Feb 2021 09:46:43 -0500 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 E0144101D0B1; Wed, 24 Feb 2021 13:55:59 +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 AC32919C46; Wed, 24 Feb 2021 13:55:59 +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 3578A58074; Wed, 24 Feb 2021 13:55:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODtvPJ017043 for ; Wed, 24 Feb 2021 08:55:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8162A5D743; Wed, 24 Feb 2021 13:55:57 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 937025D6D3; Wed, 24 Feb 2021 13:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614178025; 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=Rvu65+jRiUDjpKVVzlkVo7vGPJ+1eTBtulg5V6OM288=; b=U4ezGw/GzG76Vy42t2TJqMEuCMJVvVt008NSVUpOUXTXk4fQZrCpCZeh3sfYIJl0K/wLzi K/i6LA2vUhHAwkZkEkp35ZGi2aGBVXjmTsRM8aMa3RLgIb78Ms8UxoJmxMEvsPqwoU2gLt yTNn58pFpRcX5qQY4cGe9iRJ/LEjT0k= X-MC-Unique: A5CHiytJOPiKBeXRBuK1EA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 21/31] qemu-storage-daemon: Implement --object with qmp_object_add() Date: Wed, 24 Feb 2021 14:52:45 +0100 Message-Id: <20210224135255.253837-22-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This QAPIfies --object and ensures that QMP and the command line option behave the same. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- storage-daemon/qemu-storage-daemon.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-sto= rage-daemon.c index d8d172cc60..0dfb9c1448 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -38,6 +38,7 @@ #include "qapi/qapi-visit-block-core.h" #include "qapi/qapi-visit-block-export.h" #include "qapi/qapi-visit-control.h" +#include "qapi/qapi-visit-qom.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" #include "qapi/qobject-input-visitor.h" @@ -130,15 +131,6 @@ enum { =20 extern QemuOptsList qemu_chardev_opts; =20 -static QemuOptsList qemu_object_opts =3D { - .name =3D "object", - .implied_opt_name =3D "qom-type", - .head =3D QTAILQ_HEAD_INITIALIZER(qemu_object_opts.head), - .desc =3D { - { } - }, -}; - static void init_qmp_commands(void) { qmp_init_marshal(&qmp_commands); @@ -263,14 +255,22 @@ static void process_options(int argc, char *argv[]) { QDict *args; bool help; + Visitor *v; + ObjectOptions *options; =20 args =3D keyval_parse(optarg, "qom-type", &help, &error_fa= tal); if (help) { user_creatable_print_help_from_qdict(args); exit(EXIT_SUCCESS); } - user_creatable_add_dict(args, true, &error_fatal); + + v =3D qobject_input_visitor_new_keyval(QOBJECT(args)); + visit_type_ObjectOptions(v, NULL, &options, &error_fatal); + visit_free(v); qobject_unref(args); + + qmp_object_add(options, &error_fatal); + qapi_free_ObjectOptions(options); break; } default: @@ -295,7 +295,6 @@ int main(int argc, char *argv[]) =20 module_call_init(MODULE_INIT_QOM); module_call_init(MODULE_INIT_TRACE); - qemu_add_opts(&qemu_object_opts); qemu_add_opts(&qemu_trace_opts); qcrypto_init(&error_fatal); bdrv_init(); --=20 2.29.2 From nobody Sun May 19 02:38:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614177996; cv=none; d=zohomail.com; s=zohoarc; b=gmQ+iQ4w2eYrK0KVTvCLPfe18KFgEJmYZX4GF3o9Gp93ogyaEGl4x2zCsrVdHv9S2HJ2pAESycV6kkQS57TW7X4uPCBBCqY/+KKrXkeHDGef0Y2WRbVue1MJQmsNb1iVamahyw9hNI2u70+3q5s1xJ2jUDD93Hj8shIAJKeBcJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177996; 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=j2zm2qamYNKsYNTtudWB9DrFDR64C6so6aYk0SXWUik=; b=PRR8V+KCXK45SBC/hnkPmRQKuojXiT0YRp7+kI3KPChsWZVsBsSmRNOOcxuHS3l2NVMpL8qokX6VVDUTI0LgDnNpof3gDpp38+vo6salvVYZO9Y+NECIDV9C8gYk3O+JgxVz1uB4bxYPoXL9DpMVsIx9UgF8msFBY6rf371BRAw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614177996150867.987976680129; Wed, 24 Feb 2021 06:46:36 -0800 (PST) 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-426-0hAP7PNbOseRIaXbPMjS1w-1; Wed, 24 Feb 2021 09:46:32 -0500 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 9BC8882186; Wed, 24 Feb 2021 13:56:04 +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 6218619C46; Wed, 24 Feb 2021 13:56:04 +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 EE99158075; Wed, 24 Feb 2021 13:56:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODu0ew017072 for ; Wed, 24 Feb 2021 08:56:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id BB7995D743; Wed, 24 Feb 2021 13:56:00 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEB055D6D3; Wed, 24 Feb 2021 13:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177995; 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=j2zm2qamYNKsYNTtudWB9DrFDR64C6so6aYk0SXWUik=; b=O6yZI/rJETlJ27IvZ4U5MTEv3fjj8sHkNUv62lnermTsUsqw7OE1lYGZ4OPCDtNRZHtONQ pQ5pMc9db5mi5BGGizY0ocwKgz6qQ3DdAyZmmcQyfkSdUyHzHfhx24qdBmIn+hyfCutp5f 9FBqv6/+IdL+3xgjYpEZd6Ft5MKBW8c= X-MC-Unique: 0hAP7PNbOseRIaXbPMjS1w-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 22/31] qom: Remove user_creatable_add_dict() Date: Wed, 24 Feb 2021 14:52:46 +0100 Message-Id: <20210224135255.253837-23-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This function is now unused and can be removed. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- include/qom/object_interfaces.h | 18 ------------------ qom/object_interfaces.c | 32 -------------------------------- 2 files changed, 50 deletions(-) diff --git a/include/qom/object_interfaces.h b/include/qom/object_interface= s.h index 9b9938b8c0..5299603f50 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -86,24 +86,6 @@ Object *user_creatable_add_type(const char *type, const = char *id, const QDict *qdict, Visitor *v, Error **errp); =20 -/** - * user_creatable_add_dict: - * @qdict: the object definition - * @keyval: if true, use a keyval visitor for processing @qdict (i.e. - * assume that all @qdict values are strings); otherwise, use - * the normal QObject visitor (i.e. assume all @qdict values - * have the QType expected by the QOM object type) - * @errp: if an error occurs, a pointer to an area to store the error - * - * Create an instance of the user creatable object that is defined by - * @qdict. The object type is taken from the QDict key 'qom-type', its - * ID from the key 'id'. The remaining entries in @qdict are used to - * initialize the object properties. - * - * Returns: %true on success, %false on failure. - */ -bool user_creatable_add_dict(QDict *qdict, bool keyval, Error **errp); - /** * user_creatable_add_opts: * @opts: the object definition diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index b9a99c8bf4..7d8a4b77b8 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -104,38 +104,6 @@ out: return obj; } =20 -bool user_creatable_add_dict(QDict *qdict, bool keyval, Error **errp) -{ - Visitor *v; - Object *obj; - g_autofree char *type =3D NULL; - g_autofree char *id =3D NULL; - - type =3D g_strdup(qdict_get_try_str(qdict, "qom-type")); - if (!type) { - error_setg(errp, QERR_MISSING_PARAMETER, "qom-type"); - return false; - } - qdict_del(qdict, "qom-type"); - - id =3D g_strdup(qdict_get_try_str(qdict, "id")); - if (!id) { - error_setg(errp, QERR_MISSING_PARAMETER, "id"); - return false; - } - qdict_del(qdict, "id"); - - if (keyval) { - v =3D qobject_input_visitor_new_keyval(QOBJECT(qdict)); - } else { - v =3D qobject_input_visitor_new(QOBJECT(qdict)); - } - obj =3D user_creatable_add_type(type, id, qdict, v, errp); - visit_free(v); - object_unref(obj); - return !!obj; -} - Object *user_creatable_add_opts(QemuOpts *opts, Error **errp) { Visitor *v; --=20 2.29.2 From nobody Sun May 19 02:38:07 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=1614178047; cv=none; d=zohomail.com; s=zohoarc; b=eBmlYqqUGQDRImDd8WFgRXGp4WAcRnSf16olgwpNvLi6Mq+TZNqUbvyANeqwvgf0IdJRQQ87IMe7n/j8NX9bYzwcpHW39g/rrzjQveHEp9bbRezEnWMNzA52sfRHOTbA/XVGpmkuBiRPmKfbSWcAGTgok15GiQ5rGyg5Zdlvn58= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614178047; 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=gXKPVrh+jgfeYVb1XMNU0rRTCPP0Mh1UYn9crCAR9qA=; b=haLY66kMO9T0Zxrbo1uXpmTu+Z5mj+Q+JnHICiwSEGYinpBGmCtZOK9jowgV2q6tCpsZnKfCklpJ2FEA2/fxA5r0B+y+7qGbB+wVNtSrVXZC8Rc5JquAuyA2cypoVsRHJsVCcCUGDvd7bnR8tXIvPX2aJfopTXl0ASQNRtmQ+40= 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) header.from= 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 1614178047011623.779495173762; Wed, 24 Feb 2021 06:47:27 -0800 (PST) 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-255-HOBIdmTgPN6_gAE7-qeQvw-1; Wed, 24 Feb 2021 09:47:22 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D01401970D7E; Wed, 24 Feb 2021 13:56:06 +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 A15125D9D3; Wed, 24 Feb 2021 13:56:06 +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 3F80A58075; Wed, 24 Feb 2021 13:56:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODu55M017083 for ; Wed, 24 Feb 2021 08:56:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 19C8D1ABE5; Wed, 24 Feb 2021 13:56:05 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15AC25D6D3; Wed, 24 Feb 2021 13:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614178045; 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=gXKPVrh+jgfeYVb1XMNU0rRTCPP0Mh1UYn9crCAR9qA=; b=YdinV3CqsU5D3NlrNcUZsJm0Jg+ychvsHvqJEZbgWnoDKYedqsKqE1Yj5SSKdwnZnQxtsj wVDYOGsOwXkDESHR2sos5I9lq7GFhDNHOIR6S+UA0Zn2Cxo3EyXKmEdfG4o61+PqAKi7hh fTZLt9hk0FPjGrnNZOQa4QjgallpEWk= X-MC-Unique: HOBIdmTgPN6_gAE7-qeQvw-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 23/31] qom: Factor out user_creatable_process_cmdline() Date: Wed, 24 Feb 2021 14:52:47 +0100 Message-Id: <20210224135255.253837-24-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.14 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) Content-Type: text/plain; charset="utf-8" The implementation for --object can be shared between qemu-storage-daemon and other binaries, so move it into a function in qom/object_interfaces.c that is accessible from everywhere. This also requires moving the implementation of qmp_object_add() into a new user_creatable_add_qapi(), because qom/qom-qmp-cmds.c is not linked for tools. user_creatable_print_help_from_qdict() can become static now. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- include/qom/object_interfaces.h | 41 +++++++++++++++-------- qom/object_interfaces.c | 50 +++++++++++++++++++++++++++- qom/qom-qmp-cmds.c | 20 +---------- storage-daemon/qemu-storage-daemon.c | 22 +----------- 4 files changed, 79 insertions(+), 54 deletions(-) diff --git a/include/qom/object_interfaces.h b/include/qom/object_interface= s.h index 5299603f50..1e6c51b541 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -2,6 +2,7 @@ #define OBJECT_INTERFACES_H =20 #include "qom/object.h" +#include "qapi/qapi-types-qom.h" #include "qapi/visitor.h" =20 #define TYPE_USER_CREATABLE "user-creatable" @@ -86,6 +87,18 @@ Object *user_creatable_add_type(const char *type, const = char *id, const QDict *qdict, Visitor *v, Error **errp); =20 +/** + * user_creatable_add_qapi: + * @options: the object definition + * @errp: if an error occurs, a pointer to an area to store the error + * + * Create an instance of the user creatable object according to the + * options passed in @opts as described in the QAPI schema documentation. + * + * Returns: the newly created object or NULL on error + */ +void user_creatable_add_qapi(ObjectOptions *options, Error **errp); + /** * user_creatable_add_opts: * @opts: the object definition @@ -131,6 +144,21 @@ typedef bool (*user_creatable_add_opts_predicate)(cons= t char *type); int user_creatable_add_opts_foreach(void *opaque, QemuOpts *opts, Error **errp); =20 +/** + * user_creatable_process_cmdline: + * @optarg: the object definition string as passed on the command line + * + * Create an instance of the user creatable object by parsing optarg + * with a keyval parser and implicit key 'qom-type', converting the + * result to ObjectOptions and calling into qmp_object_add(). + * + * If a help option is given, print help instead and exit. + * + * This function is only meant to be called during command line parsing. + * It exits the process on failure or after printing help. + */ +void user_creatable_process_cmdline(const char *optarg); + /** * user_creatable_print_help: * @type: the QOM type to be added @@ -145,19 +173,6 @@ int user_creatable_add_opts_foreach(void *opaque, */ bool user_creatable_print_help(const char *type, QemuOpts *opts); =20 -/** - * user_creatable_print_help_from_qdict: - * @args: options to create - * - * Prints help considering the other options given in @args (if "qom-type"= is - * given and valid, print properties for the type, otherwise print valid t= ypes) - * - * In contrast to user_creatable_print_help(), this function can't return = that - * no help was requested. It should only be called if we know that help is - * requested and it will always print some help. - */ -void user_creatable_print_help_from_qdict(QDict *args); - /** * user_creatable_del: * @id: the unique ID for the object diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 7d8a4b77b8..efb48249d5 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -2,10 +2,13 @@ =20 #include "qemu/cutils.h" #include "qapi/error.h" +#include "qapi/qapi-commands-qom.h" +#include "qapi/qapi-visit-qom.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "qapi/qmp/qjson.h" #include "qapi/qobject-input-visitor.h" +#include "qapi/qobject-output-visitor.h" #include "qom/object_interfaces.h" #include "qemu/help_option.h" #include "qemu/module.h" @@ -104,6 +107,29 @@ out: return obj; } =20 +void user_creatable_add_qapi(ObjectOptions *options, Error **errp) +{ + Visitor *v; + QObject *qobj; + QDict *props; + Object *obj; + + v =3D qobject_output_visitor_new(&qobj); + visit_type_ObjectOptions(v, NULL, &options, &error_abort); + visit_complete(v, &qobj); + visit_free(v); + + props =3D qobject_to(QDict, qobj); + qdict_del(props, "qom-type"); + qdict_del(props, "id"); + + v =3D qobject_input_visitor_new(QOBJECT(props)); + obj =3D user_creatable_add_type(ObjectType_str(options->qom_type), + options->id, props, v, errp); + object_unref(obj); + visit_free(v); +} + Object *user_creatable_add_opts(QemuOpts *opts, Error **errp) { Visitor *v; @@ -247,7 +273,7 @@ bool user_creatable_print_help(const char *type, QemuOp= ts *opts) return false; } =20 -void user_creatable_print_help_from_qdict(QDict *args) +static void user_creatable_print_help_from_qdict(QDict *args) { const char *type =3D qdict_get_try_str(args, "qom-type"); =20 @@ -256,6 +282,28 @@ void user_creatable_print_help_from_qdict(QDict *args) } } =20 +void user_creatable_process_cmdline(const char *optarg) +{ + QDict *args; + bool help; + Visitor *v; + ObjectOptions *options; + + args =3D keyval_parse(optarg, "qom-type", &help, &error_fatal); + if (help) { + user_creatable_print_help_from_qdict(args); + exit(EXIT_SUCCESS); + } + + v =3D qobject_input_visitor_new_keyval(QOBJECT(args)); + visit_type_ObjectOptions(v, NULL, &options, &error_fatal); + visit_free(v); + qobject_unref(args); + + user_creatable_add_qapi(options, &error_fatal); + qapi_free_ObjectOptions(options); +} + bool user_creatable_del(const char *id, Error **errp) { QemuOptsList *opts_list; diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index e577a96adf..2d6f41ecc7 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -228,25 +228,7 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const = char *typename, =20 void qmp_object_add(ObjectOptions *options, Error **errp) { - Visitor *v; - QObject *qobj; - QDict *props; - Object *obj; - - v =3D qobject_output_visitor_new(&qobj); - visit_type_ObjectOptions(v, NULL, &options, &error_abort); - visit_complete(v, &qobj); - visit_free(v); - - props =3D qobject_to(QDict, qobj); - qdict_del(props, "qom-type"); - qdict_del(props, "id"); - - v =3D qobject_input_visitor_new(QOBJECT(props)); - obj =3D user_creatable_add_type(ObjectType_str(options->qom_type), - options->id, props, v, errp); - object_unref(obj); - visit_free(v); + user_creatable_add_qapi(options, errp); } =20 void qmp_object_del(const char *id, Error **errp) diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-sto= rage-daemon.c index 0dfb9c1448..32b59878a7 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -38,7 +38,6 @@ #include "qapi/qapi-visit-block-core.h" #include "qapi/qapi-visit-block-export.h" #include "qapi/qapi-visit-control.h" -#include "qapi/qapi-visit-qom.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" #include "qapi/qobject-input-visitor.h" @@ -252,27 +251,8 @@ static void process_options(int argc, char *argv[]) break; } case OPTION_OBJECT: - { - QDict *args; - bool help; - Visitor *v; - ObjectOptions *options; - - args =3D keyval_parse(optarg, "qom-type", &help, &error_fa= tal); - if (help) { - user_creatable_print_help_from_qdict(args); - exit(EXIT_SUCCESS); - } - - v =3D qobject_input_visitor_new_keyval(QOBJECT(args)); - visit_type_ObjectOptions(v, NULL, &options, &error_fatal); - visit_free(v); - qobject_unref(args); - - qmp_object_add(options, &error_fatal); - qapi_free_ObjectOptions(options); + user_creatable_process_cmdline(optarg); break; - } default: g_assert_not_reached(); } --=20 2.29.2 From nobody Sun May 19 02:38:07 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=1614177989; cv=none; d=zohomail.com; s=zohoarc; b=S3CHiG/woHTTNbVsSCmmF9QKUmG2l+/Q1uKfZyX/CVhG8/C37qwvI4ZQievW6rEx23oTBcAnL7lvd30y2nPaa3lC4QE7dyddqrOn5KBK6pW3GhxBlM93A+7yAqjX7O6YqslUagmKjNn8aYjE8/s7GatRVSCdn/VNb9A9MVXTOe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177989; 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=feB+MH6bOD5uyb0j/c8EeYyC86YRMBCIo46Nw4bo/pk=; b=YnKlVZzodmZALAbVwtmLc3kmGwPius7Fc5muBVuqIbtkd34DEOWfrZUx9XfUHGioXdlvqJ7itCIUCqR2d0drvCUbx2TT501KUri0zlCdIQttMfgqGS7Z+le5AKuHHtJFuD2vyA8j4krM6COYlBiNRicBMZ61urLtz+gReNDkunI= 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) header.from= 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 1614177989521690.3321864884985; Wed, 24 Feb 2021 06:46:29 -0800 (PST) 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-229-1yHSPdH3Os211keLucpy3A-1; Wed, 24 Feb 2021 09:46:22 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0981310871FB; Wed, 24 Feb 2021 13:56: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 CD8B31001281; Wed, 24 Feb 2021 13:56:18 +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 7227C18095CB; Wed, 24 Feb 2021 13:56:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODuGXT017099 for ; Wed, 24 Feb 2021 08:56:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9B5605D6AD; Wed, 24 Feb 2021 13:56:16 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 612985D740; Wed, 24 Feb 2021 13:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177986; 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=feB+MH6bOD5uyb0j/c8EeYyC86YRMBCIo46Nw4bo/pk=; b=bmwdCTcFIii4atqO5IZlHnUV+O2utgm00YRBqrtKLH2TTxac3vSTmtIdvV2sxgEXPmZgBx Bm9AMo1n/LL2R2fajftpzz/0cPDkVmysClyQkTBwRnnN1ZmWiCIyKEj5eYUGLpaWSQ67Og CPvnFXIvpOfDQgkl8JJWYSIp+xPKRUw= X-MC-Unique: 1yHSPdH3Os211keLucpy3A-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 24/31] qemu-io: Use user_creatable_process_cmdline() for --object Date: Wed, 24 Feb 2021 14:52:48 +0100 Message-Id: <20210224135255.253837-25-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.22 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) Content-Type: text/plain; charset="utf-8" This switches qemu-io from a QemuOpts-based parser for --object to user_creatable_process_cmdline() which uses a keyval parser and enforces the QAPI schema. Apart from being a cleanup, this makes non-scalar properties accessible. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qemu-io.c | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index ac88d8bd40..bf902302e9 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -477,23 +477,6 @@ enum { OPTION_IMAGE_OPTS =3D 257, }; =20 -static QemuOptsList qemu_object_opts =3D { - .name =3D "object", - .implied_opt_name =3D "qom-type", - .head =3D QTAILQ_HEAD_INITIALIZER(qemu_object_opts.head), - .desc =3D { - { } - }, -}; - -static bool qemu_io_object_print_help(const char *type, QemuOpts *opts) -{ - if (user_creatable_print_help(type, opts)) { - exit(0); - } - return true; -} - static QemuOptsList file_opts =3D { .name =3D "file", .implied_opt_name =3D "file", @@ -550,7 +533,6 @@ int main(int argc, char **argv) qcrypto_init(&error_fatal); =20 module_call_init(MODULE_INIT_QOM); - qemu_add_opts(&qemu_object_opts); qemu_add_opts(&qemu_trace_opts); bdrv_init(); =20 @@ -612,14 +594,9 @@ int main(int argc, char **argv) case 'U': force_share =3D true; break; - case OPTION_OBJECT: { - QemuOpts *qopts; - qopts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!qopts) { - exit(1); - } - } break; + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); + break; case OPTION_IMAGE_OPTS: imageOpts =3D true; break; @@ -644,10 +621,6 @@ int main(int argc, char **argv) exit(1); } =20 - qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_io_object_print_help, &error_fatal); - if (!trace_init_backends()) { exit(1); } --=20 2.29.2 From nobody Sun May 19 02:38:08 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=1614178028; cv=none; d=zohomail.com; s=zohoarc; b=DTqxjURMY5Rf17rhenv8LSWekB2ErncmdL95RT1H05FPCFjp7iBmLHduO/Qs8rr2flag+rnos1c2DzX8zK97W2zeebmdmphopX8XArUZNEHyv+/lcDgvqBvobk6U3LdqlRHkjhR4SUa8o1Oit237LzSGunORjCpR6Oh4Tfsq8To= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614178028; 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=+LbhhiiNIlKIsm1gnhOQmAJPYmOj0Sf+sYClgkW38Lo=; b=PFMItpLtDMivwfqg4Au4mDxheBA0iWsColVnNubAm4AvJoYtwdz33J8HO1x5ngdvBJuqVyIbdluU3yvoamUx/bOYA8/0xf9ocmH5rqC16JJvjs1WhbCgCxeIqMlb6VkJwzuzrXkKvFuwGaaj0cCF6N/Sv8M9nF4nHFERDLG0Ero= 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) header.from= 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 1614178028617598.5236959081601; Wed, 24 Feb 2021 06:47:08 -0800 (PST) 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-301-mmWd6e49PN-TErwb1CrHiw-1; Wed, 24 Feb 2021 09:47:05 -0500 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 A0140119E66A; Wed, 24 Feb 2021 13:56:22 +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 6366B19934; Wed, 24 Feb 2021 13:56:22 +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 D382E18095CC; Wed, 24 Feb 2021 13:56:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODuJ81017110 for ; Wed, 24 Feb 2021 08:56:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id DCA7654272; Wed, 24 Feb 2021 13:56:19 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id E99755D6AD; Wed, 24 Feb 2021 13:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614178027; 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=+LbhhiiNIlKIsm1gnhOQmAJPYmOj0Sf+sYClgkW38Lo=; b=a5IA9t/859TEbUQwYjOYnaljOYmagTI2y8aGmm4nZ4NzmYd7Ol9eldCGpqp57gCh7XEvFt Z42txu89/C4FXfn2bt3+BzYL5nnqWK/f3JWC6vQ9HPinzN+lqqqB2jxL96Q46rvZl6yFcI Wl5MqVqTpkff8C1T7QAHyaEaPGzG2pE= X-MC-Unique: mmWd6e49PN-TErwb1CrHiw-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 25/31] qemu-img: Use user_creatable_process_cmdline() for --object Date: Wed, 24 Feb 2021 14:52:49 +0100 Message-Id: <20210224135255.253837-26-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This switches qemu-img from a QemuOpts-based parser for --object to user_creatable_process_cmdline() which uses a keyval parser and enforces the QAPI schema. Apart from being a cleanup, this makes non-scalar properties accessible. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa --- qemu-img.c | 239 ++++++++--------------------------------------------- 1 file changed, 33 insertions(+), 206 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index e2952fe955..ebf8661e2a 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -226,23 +226,6 @@ static void QEMU_NORETURN help(void) exit(EXIT_SUCCESS); } =20 -static QemuOptsList qemu_object_opts =3D { - .name =3D "object", - .implied_opt_name =3D "qom-type", - .head =3D QTAILQ_HEAD_INITIALIZER(qemu_object_opts.head), - .desc =3D { - { } - }, -}; - -static bool qemu_img_object_print_help(const char *type, QemuOpts *opts) -{ - if (user_creatable_print_help(type, opts)) { - exit(0); - } - return true; -} - /* * Is @optarg safe for accumulate_options()? * It is when multiple of them can be joined together separated by ','. @@ -566,14 +549,9 @@ static int img_create(int argc, char **argv) case 'u': flags |=3D BDRV_O_NO_BACKING; break; - case OPTION_OBJECT: { - QemuOpts *opts; - opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!opts) { - goto fail; - } - } break; + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); + break; } } =20 @@ -589,12 +567,6 @@ static int img_create(int argc, char **argv) } optind++; =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - goto fail; - } - /* Get image size, if specified */ if (optind < argc) { int64_t sval; @@ -804,14 +776,9 @@ static int img_check(int argc, char **argv) case 'U': force_share =3D true; break; - case OPTION_OBJECT: { - QemuOpts *opts; - opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!opts) { - return 1; - } - } break; + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); + break; case OPTION_IMAGE_OPTS: image_opts =3D true; break; @@ -831,12 +798,6 @@ static int img_check(int argc, char **argv) return 1; } =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - return 1; - } - ret =3D bdrv_parse_cache_mode(cache, &flags, &writethrough); if (ret < 0) { error_report("Invalid source cache option: %s", cache); @@ -1034,14 +995,9 @@ static int img_commit(int argc, char **argv) return 1; } break; - case OPTION_OBJECT: { - QemuOpts *opts; - opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!opts) { - return 1; - } - } break; + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); + break; case OPTION_IMAGE_OPTS: image_opts =3D true; break; @@ -1058,12 +1014,6 @@ static int img_commit(int argc, char **argv) } filename =3D argv[optind++]; =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - return 1; - } - flags =3D BDRV_O_RDWR | BDRV_O_UNMAP; ret =3D bdrv_parse_cache_mode(cache, &flags, &writethrough); if (ret < 0) { @@ -1423,15 +1373,9 @@ static int img_compare(int argc, char **argv) case 'U': force_share =3D true; break; - case OPTION_OBJECT: { - QemuOpts *opts; - opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!opts) { - ret =3D 2; - goto out4; - } - } break; + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); + break; case OPTION_IMAGE_OPTS: image_opts =3D true; break; @@ -1450,13 +1394,6 @@ static int img_compare(int argc, char **argv) filename1 =3D argv[optind++]; filename2 =3D argv[optind++]; =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - ret =3D 2; - goto out4; - } - /* Initialize before goto out */ qemu_progress_init(progress, 2.0); =20 @@ -1641,7 +1578,6 @@ out2: blk_unref(blk1); out3: qemu_progress_end(); -out4: return ret; } =20 @@ -2342,15 +2278,9 @@ static int img_convert(int argc, char **argv) goto fail_getopt; } break; - case OPTION_OBJECT: { - QemuOpts *object_opts; - object_opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!object_opts) { - goto fail_getopt; - } + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); break; - } case OPTION_IMAGE_OPTS: image_opts =3D true; break; @@ -2378,12 +2308,6 @@ static int img_convert(int argc, char **argv) out_fmt =3D "raw"; } =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - goto fail_getopt; - } - if (s.compressed && s.copy_range) { error_report("Cannot enable copy offloading when -c is used"); goto fail_getopt; @@ -2971,14 +2895,9 @@ static int img_info(int argc, char **argv) case OPTION_BACKING_CHAIN: chain =3D true; break; - case OPTION_OBJECT: { - QemuOpts *opts; - opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!opts) { - return 1; - } - } break; + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); + break; case OPTION_IMAGE_OPTS: image_opts =3D true; break; @@ -2998,12 +2917,6 @@ static int img_info(int argc, char **argv) return 1; } =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - return 1; - } - list =3D collect_image_info_list(image_opts, filename, fmt, chain, force_share); if (!list) { @@ -3213,14 +3126,9 @@ static int img_map(int argc, char **argv) return 1; } break; - case OPTION_OBJECT: { - QemuOpts *opts; - opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!opts) { - return 1; - } - } break; + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); + break; case OPTION_IMAGE_OPTS: image_opts =3D true; break; @@ -3240,12 +3148,6 @@ static int img_map(int argc, char **argv) return 1; } =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - return 1; - } - blk =3D img_open(image_opts, filename, fmt, 0, false, false, force_sha= re); if (!blk) { return 1; @@ -3384,14 +3286,9 @@ static int img_snapshot(int argc, char **argv) case 'U': force_share =3D true; break; - case OPTION_OBJECT: { - QemuOpts *opts; - opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!opts) { - return 1; - } - } break; + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); + break; case OPTION_IMAGE_OPTS: image_opts =3D true; break; @@ -3403,12 +3300,6 @@ static int img_snapshot(int argc, char **argv) } filename =3D argv[optind++]; =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - return 1; - } - /* Open the image */ blk =3D img_open(image_opts, filename, NULL, bdrv_oflags, false, quiet, force_share); @@ -3542,14 +3433,9 @@ static int img_rebase(int argc, char **argv) case 'q': quiet =3D true; break; - case OPTION_OBJECT: { - QemuOpts *opts; - opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!opts) { - return 1; - } - } break; + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); + break; case OPTION_IMAGE_OPTS: image_opts =3D true; break; @@ -3571,12 +3457,6 @@ static int img_rebase(int argc, char **argv) } filename =3D argv[optind++]; =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - return 1; - } - qemu_progress_init(progress, 2.0); qemu_progress_print(0, 100); =20 @@ -3967,14 +3847,9 @@ static int img_resize(int argc, char **argv) case 'q': quiet =3D true; break; - case OPTION_OBJECT: { - QemuOpts *opts; - opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!opts) { - return 1; - } - } break; + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); + break; case OPTION_IMAGE_OPTS: image_opts =3D true; break; @@ -3996,12 +3871,6 @@ static int img_resize(int argc, char **argv) } filename =3D argv[optind++]; =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - return 1; - } - /* Choose grow, shrink, or absolute resize mode */ switch (size[0]) { case '+': @@ -4181,12 +4050,7 @@ static int img_amend(int argc, char **argv) quiet =3D true; break; case OPTION_OBJECT: - opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!opts) { - ret =3D -1; - goto out_no_progress; - } + user_creatable_process_cmdline(optarg); break; case OPTION_IMAGE_OPTS: image_opts =3D true; @@ -4201,13 +4065,6 @@ static int img_amend(int argc, char **argv) error_exit("Must specify options (-o)"); } =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - ret =3D -1; - goto out_no_progress; - } - if (quiet) { progress =3D false; } @@ -4760,10 +4617,7 @@ static int img_bitmap(int argc, char **argv) merge =3D true; break; case OPTION_OBJECT: - opts =3D qemu_opts_parse_noisily(&qemu_object_opts, optarg, tr= ue); - if (!opts) { - goto out; - } + user_creatable_process_cmdline(optarg); break; case OPTION_IMAGE_OPTS: image_opts =3D true; @@ -4771,12 +4625,6 @@ static int img_bitmap(int argc, char **argv) } } =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - goto out; - } - if (QSIMPLEQ_EMPTY(&actions)) { error_report("Need at least one of --add, --remove, --clear, " "--enable, --disable, or --merge"); @@ -5034,10 +4882,7 @@ static int img_dd(int argc, char **argv) force_share =3D true; break; case OPTION_OBJECT: - if (!qemu_opts_parse_noisily(&qemu_object_opts, optarg, true))= { - ret =3D -1; - goto out; - } + user_creatable_process_cmdline(optarg); break; case OPTION_IMAGE_OPTS: image_opts =3D true; @@ -5084,13 +4929,6 @@ static int img_dd(int argc, char **argv) goto out; } =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - ret =3D -1; - goto out; - } - blk1 =3D img_open(image_opts, in.filename, fmt, 0, false, false, force_share); =20 @@ -5311,11 +5149,7 @@ static int img_measure(int argc, char **argv) force_share =3D true; break; case OPTION_OBJECT: - object_opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!object_opts) { - goto out; - } + user_creatable_process_cmdline(optarg); break; case OPTION_IMAGE_OPTS: image_opts =3D true; @@ -5345,12 +5179,6 @@ static int img_measure(int argc, char **argv) } } =20 - if (qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_img_object_print_help, &error_fatal)) { - goto out; - } - if (argc - optind > 1) { error_report("At most one filename argument is allowed."); goto out; @@ -5490,7 +5318,6 @@ int main(int argc, char **argv) error_exit("Not enough arguments"); } =20 - qemu_add_opts(&qemu_object_opts); qemu_add_opts(&qemu_source_opts); qemu_add_opts(&qemu_trace_opts); =20 --=20 2.29.2 From nobody Sun May 19 02:38:08 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=1614178082; cv=none; d=zohomail.com; s=zohoarc; b=Mo7LmZvJWhU4pG0I5YAHf0h5zPpA0O5R0onQ2ItGgGcW4ndYDezH4MKKhSDy/FQQYosm8vfIO8RX4j17ywa6eTCqi/BxwIG6yWw0ACXyNn5sknklR6P3yeVndZtDvOkEcqLItYteHb+9x2OAFz27IWdTSIS7/PfKXSweJ0ZLrxA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614178082; 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=Q9DGCu03QvlVgI5XKZx2Ji8ENNb6zZOAgJNRQksoZk0=; b=Gn0/ov0bPIobmpq5GQc4LR99ZJbCSAlun1Bb7/FMsvRJ5OVO8ixf74VOwXBHcfnkuTFadqZM71cwvMbrCEWGMVWjNOYw8z6rdS65u3Ej0HAHQxpymlWFWmwluIwRx7u8gQgDvtkUBLbazXxx6sgJ7yUAyoWbobabA/8U2TSmjow= 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) header.from= 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 1614178082504796.6425650249595; Wed, 24 Feb 2021 06:48:02 -0800 (PST) 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-149-pg2NOpilNharf3_frl4EWg-1; Wed, 24 Feb 2021 09:47:58 -0500 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 3489EA9356B; Wed, 24 Feb 2021 13:56:25 +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 0391E60C5F; Wed, 24 Feb 2021 13:56:25 +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 A810158074; Wed, 24 Feb 2021 13:56:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODuNBO017120 for ; Wed, 24 Feb 2021 08:56:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2113A62467; Wed, 24 Feb 2021 13:56:23 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3544E5D6AD; Wed, 24 Feb 2021 13:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614178081; 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=Q9DGCu03QvlVgI5XKZx2Ji8ENNb6zZOAgJNRQksoZk0=; b=Njpe9Pdx578vCYKqOqorwwXAdrTkLRKf8FbIn83UQ5KcplvYAFj5hyj7l9PFQW2bX974Px 3XktuqhcRWuEOgGe/9puXg2/BJtK30TzTRx2lkjPvGhUVY8e8VMtyw93bSN6yIehDsMiB1 KFee4Btxkvpd2A8ItIdcCnhPk1KLYW4= X-MC-Unique: pg2NOpilNharf3_frl4EWg-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 26/31] qemu-nbd: Use user_creatable_process_cmdline() for --object Date: Wed, 24 Feb 2021 14:52:50 +0100 Message-Id: <20210224135255.253837-27-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This switches qemu-nbd from a QemuOpts-based parser for --object to user_creatable_process_cmdline() which uses a keyval parser and enforces the QAPI schema. Apart from being a cleanup, this makes non-scalar properties accessible. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- qemu-nbd.c | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index b1b9430a8f..93ef4e288f 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -401,24 +401,6 @@ static QemuOptsList file_opts =3D { }, }; =20 -static QemuOptsList qemu_object_opts =3D { - .name =3D "object", - .implied_opt_name =3D "qom-type", - .head =3D QTAILQ_HEAD_INITIALIZER(qemu_object_opts.head), - .desc =3D { - { } - }, -}; - -static bool qemu_nbd_object_print_help(const char *type, QemuOpts *opts) -{ - if (user_creatable_print_help(type, opts)) { - exit(0); - } - return true; -} - - static QCryptoTLSCreds *nbd_get_tls_creds(const char *id, bool list, Error **errp) { @@ -594,7 +576,6 @@ int main(int argc, char **argv) qcrypto_init(&error_fatal); =20 module_call_init(MODULE_INIT_QOM); - qemu_add_opts(&qemu_object_opts); qemu_add_opts(&qemu_trace_opts); qemu_init_exec_dir(argv[0]); =20 @@ -747,14 +728,9 @@ int main(int argc, char **argv) case '?': error_report("Try `%s --help' for more information.", argv[0]); exit(EXIT_FAILURE); - case QEMU_NBD_OPT_OBJECT: { - QemuOpts *opts; - opts =3D qemu_opts_parse_noisily(&qemu_object_opts, - optarg, true); - if (!opts) { - exit(EXIT_FAILURE); - } - } break; + case QEMU_NBD_OPT_OBJECT: + user_creatable_process_cmdline(optarg); + break; case QEMU_NBD_OPT_TLSCREDS: tlscredsid =3D optarg; break; @@ -802,10 +778,6 @@ int main(int argc, char **argv) export_name =3D ""; } =20 - qemu_opts_foreach(&qemu_object_opts, - user_creatable_add_opts_foreach, - qemu_nbd_object_print_help, &error_fatal); - if (!trace_init_backends()) { exit(1); } --=20 2.29.2 From nobody Sun May 19 02:38:08 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=1614177996; cv=none; d=zohomail.com; s=zohoarc; b=JBIWYVld6HhE32/21XUUqfsro4FU5Dy5ZT5f/B3ePUvBytGE/mr8VqSfWs/xnmHsQ+hOQJQTrqB5Pvm+PPqiqk0aXQGD/c0TzN7s28UcfVdwZW+4yA+ToM4/xqGA/XQQ+wRRPqlacs5yGCxJnbbO5CBqn4aUXFwgNuVRdD3cWkE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177996; 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=DNxBKpWkdEItNJwAB7jz+BZhN/uyoRmcAPf5Li1hh9w=; b=ZP+Ie7PCQXjm1HDt8SEKObSr6jcpDix01LJFyBFvOzREz4CpXjb2h76ZwsqieIpSUoHXDRlspHtAnKOUji3KNvw9A9aAqBEer6HcztyXqPR2P9+nOoZO2Io5leOGtPitLFyAVGot4fANJAFCa4J60Fa/fgtTlER2xN02Gd3hnJQ= 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) header.from= 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 1614177996542584.976355550158; Wed, 24 Feb 2021 06:46:36 -0800 (PST) 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-509-otFPvo0JNoWSzy557T17_g-1; Wed, 24 Feb 2021 09:46:31 -0500 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 369AE1185CAD; Wed, 24 Feb 2021 13:56:28 +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 E01CF19C46; Wed, 24 Feb 2021 13:56:27 +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 8E2D618095CC; Wed, 24 Feb 2021 13:56:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODuQWL017132 for ; Wed, 24 Feb 2021 08:56:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5B3921865D; Wed, 24 Feb 2021 13:56:26 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D9A15D6D3; Wed, 24 Feb 2021 13:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177995; 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=DNxBKpWkdEItNJwAB7jz+BZhN/uyoRmcAPf5Li1hh9w=; b=ddV5YffcZ9NGv/5uHP60qjKGyCQviVokfNhmwb9EIPqQ2F+tu9j9LVlOWAtnw/1uvpcPqi W53XcBakWMQt1z3m2TiSnc1sr5acFyM6t+tTEHM87/8L+ft4LDwED9DzozKZn4kDlyocZ6 0Ns5fmRZrx7/xSP9l2ybgtAxUWgr9mM= X-MC-Unique: otFPvo0JNoWSzy557T17_g-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 27/31] qom: Add user_creatable_add_from_str() Date: Wed, 24 Feb 2021 14:52:51 +0100 Message-Id: <20210224135255.253837-28-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This is a version of user_creatable_process_cmdline() with an Error parameter that never calls exit() and is therefore usable in HMP. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- include/qom/object_interfaces.h | 16 ++++++++++++++++ qom/object_interfaces.c | 29 ++++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/include/qom/object_interfaces.h b/include/qom/object_interface= s.h index 1e6c51b541..07511e6cff 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -144,6 +144,22 @@ typedef bool (*user_creatable_add_opts_predicate)(cons= t char *type); int user_creatable_add_opts_foreach(void *opaque, QemuOpts *opts, Error **errp); =20 +/** + * user_creatable_add_from_str: + * @optarg: the object definition string as passed on the command line + * @errp: if an error occurs, a pointer to an area to store the error + * + * Create an instance of the user creatable object by parsing optarg + * with a keyval parser and implicit key 'qom-type', converting the + * result to ObjectOptions and calling into qmp_object_add(). + * + * If a help option is given, print help instead. + * + * Returns: true when an object was successfully created, false when an er= ror + * occurred (*errp is set then) or help was printed (*errp is not set). + */ +bool user_creatable_add_from_str(const char *optarg, Error **errp); + /** * user_creatable_process_cmdline: * @optarg: the object definition string as passed on the command line diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index efb48249d5..54f0dadfea 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -282,26 +282,45 @@ static void user_creatable_print_help_from_qdict(QDic= t *args) } } =20 -void user_creatable_process_cmdline(const char *optarg) +bool user_creatable_add_from_str(const char *optarg, Error **errp) { + ERRP_GUARD(); QDict *args; bool help; Visitor *v; ObjectOptions *options; =20 - args =3D keyval_parse(optarg, "qom-type", &help, &error_fatal); + args =3D keyval_parse(optarg, "qom-type", &help, errp); + if (*errp) { + return false; + } if (help) { user_creatable_print_help_from_qdict(args); - exit(EXIT_SUCCESS); + qobject_unref(args); + return false; } =20 v =3D qobject_input_visitor_new_keyval(QOBJECT(args)); - visit_type_ObjectOptions(v, NULL, &options, &error_fatal); + visit_type_ObjectOptions(v, NULL, &options, errp); visit_free(v); qobject_unref(args); =20 - user_creatable_add_qapi(options, &error_fatal); + if (*errp) { + goto out; + } + + user_creatable_add_qapi(options, errp); +out: qapi_free_ObjectOptions(options); + return !*errp; +} + +void user_creatable_process_cmdline(const char *optarg) +{ + if (!user_creatable_add_from_str(optarg, &error_fatal)) { + /* Help was printed */ + exit(EXIT_SUCCESS); + } } =20 bool user_creatable_del(const char *id, Error **errp) --=20 2.29.2 From nobody Sun May 19 02:38:08 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=1614177999; cv=none; d=zohomail.com; s=zohoarc; b=OlSo83trFMmWIg2G4zbzRxPpIy7SclifHwdoMGMiHWLbb3XDqzwO/g6/ppCK1Ma0u3Aof0wNjvds2SP9XUXcSjs0saPyZhSCBdXV/teRu04jE5gSi4PgMOdJ+Y+ceCx51mjo6dwgxYHn3Rfn8wibjskrNqChXj0TWolR9+O6RGo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614177999; 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=lQE7LwEnMXez4+FEX/dIa+IYFEfcoeLiKxAtri633zc=; b=Z95+Rvgi2et/sgBLn2veAmzo5MB96UfDrOV5v3JSsblXWJ58bo9Q4ZjFMLaud3egvf/DekZfRiJX02mVXQRjSicTifCGo+XsVz3Zw+ZnH7wSKgSRPCiv7nJ415IYC3TWaVu+JYA2N4snGCUgr6T5yOx+qH9obWF8GDEPZCbnsGQ= 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) header.from= 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 1614177999705546.2186683643549; Wed, 24 Feb 2021 06:46:39 -0800 (PST) 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-47--Dzo6-ofPP62OuJ2wxXKAA-1; Wed, 24 Feb 2021 09:46:36 -0500 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 7B55A1185CD4; Wed, 24 Feb 2021 13:56:34 +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 3ECE619C46; Wed, 24 Feb 2021 13:56:34 +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 C2F4D18095CC; Wed, 24 Feb 2021 13:56:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODuW0j017144 for ; Wed, 24 Feb 2021 08:56:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4ECD762467; Wed, 24 Feb 2021 13:56:32 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6FFF5D6AD; Wed, 24 Feb 2021 13:56:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177998; 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=lQE7LwEnMXez4+FEX/dIa+IYFEfcoeLiKxAtri633zc=; b=T92s5f2Pn3IVr4VWsmxXTjGewBlpUJhLQ5ot2xXu+GSiXS319QbtpPwnsTvXYUX939OH62 rtSsv3fTtv9ud5f4LvA7JoGt97gkPcCo97GelQIUNUOCjlqwUri/OfJaUGD3tIMZUY4LUo y/7Mvg/o7RAMLfFXwimm8NurO1ZUQMk= X-MC-Unique: -Dzo6-ofPP62OuJ2wxXKAA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 28/31] hmp: QAPIfy object_add Date: Wed, 24 Feb 2021 14:52:52 +0100 Message-Id: <20210224135255.253837-29-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" This switches the HMP command object_add from a QemuOpts-based parser to user_creatable_add_from_str() which uses a keyval parser and enforces the QAPI schema. Apart from being a cleanup, this makes non-scalar properties and help accessible. In order for help to be printed to the monitor instead of stdout, the printf() calls in the help functions are changed to qemu_printf(). Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Eric Blake --- monitor/hmp-cmds.c | 17 ++--------------- qom/object_interfaces.c | 11 ++++++----- hmp-commands.hx | 2 +- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 3c88a4faef..652cf9ff21 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1670,24 +1670,11 @@ void hmp_netdev_del(Monitor *mon, const QDict *qdic= t) =20 void hmp_object_add(Monitor *mon, const QDict *qdict) { + const char *options =3D qdict_get_str(qdict, "object"); Error *err =3D NULL; - QemuOpts *opts; - Object *obj =3D NULL; - - opts =3D qemu_opts_from_qdict(qemu_find_opts("object"), qdict, &err); - if (err) { - goto end; - } =20 - obj =3D user_creatable_add_opts(opts, &err); - qemu_opts_del(opts); - -end: + user_creatable_add_from_str(options, &err); hmp_handle_error(mon, err); - - if (obj) { - object_unref(obj); - } } =20 void hmp_getfd(Monitor *mon, const QDict *qdict) diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 54f0dadfea..c4982dd7a0 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -13,6 +13,7 @@ #include "qemu/help_option.h" #include "qemu/module.h" #include "qemu/option.h" +#include "qemu/qemu-print.h" #include "qapi/opts-visitor.h" #include "qemu/config-file.h" =20 @@ -212,11 +213,11 @@ static void user_creatable_print_types(void) { GSList *l, *list; =20 - printf("List of user creatable objects:\n"); + qemu_printf("List of user creatable objects:\n"); list =3D object_class_get_list_sorted(TYPE_USER_CREATABLE, false); for (l =3D list; l !=3D NULL; l =3D l->next) { ObjectClass *oc =3D OBJECT_CLASS(l->data); - printf(" %s\n", object_class_get_name(oc)); + qemu_printf(" %s\n", object_class_get_name(oc)); } g_slist_free(list); } @@ -247,12 +248,12 @@ static bool user_creatable_print_type_properites(cons= t char *type) } g_ptr_array_sort(array, (GCompareFunc)qemu_pstrcmp0); if (array->len > 0) { - printf("%s options:\n", type); + qemu_printf("%s options:\n", type); } else { - printf("There are no options for %s.\n", type); + qemu_printf("There are no options for %s.\n", type); } for (i =3D 0; i < array->len; i++) { - printf("%s\n", (char *)array->pdata[i]); + qemu_printf("%s\n", (char *)array->pdata[i]); } g_ptr_array_set_free_func(array, g_free); g_ptr_array_free(array, true); diff --git a/hmp-commands.hx b/hmp-commands.hx index d4001f9c5d..6f5d9ce2fb 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1337,7 +1337,7 @@ ERST =20 { .name =3D "object_add", - .args_type =3D "object:O", + .args_type =3D "object:S", .params =3D "[qom-type=3D]type,id=3Dstr[,prop=3Dvalue][,...]", .help =3D "create QOM object", .cmd =3D hmp_object_add, --=20 2.29.2 From nobody Sun May 19 02:38:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614178036; cv=none; d=zohomail.com; s=zohoarc; b=fJ56E0nlZxDcv5FcfohnNyUJsy7UKf35lY0SnApgYRm37X4NXFhHswu+MvoZB3sKfSuwZZMAb80qVZkgwOrTY60gcfWmzV4WJ/df3d4ZcNj6/ZzS7Z4q1HIUCY79E5BfgjMzVjeUlA6Nqd1U/+aZ9LlFWliBX8hLjhPrVRyWR9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614178036; 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=JWt5y93RVZ4A9pZUMPGGSlmewnIoDraYpgmd3tt4XmU=; b=OrJK67b+7wgiD909lozzMKvIR1mmw68zCPAZGDwjRkptKlyYkoLcqFf/QLAfd9suZu0GNgl62lCScCsxmp5wX6o9kM+xUWbawWcmOASwRZV1zClkOy9o3QWBkRS8fyC69yfc7c2grcJn35dtHCjTay4NgteJJo/Cckiyl4cdQ30= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614178035993266.28430906746587; Wed, 24 Feb 2021 06:47:15 -0800 (PST) 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-246-zNMrN4dZNvmF3gSOXJCLQA-1; Wed, 24 Feb 2021 09:47:12 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D2BDB119F4AC; Wed, 24 Feb 2021 13:56:39 +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 AA1279CA0; Wed, 24 Feb 2021 13:56:39 +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 24F4118095CD; Wed, 24 Feb 2021 13:56:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODucib017158 for ; Wed, 24 Feb 2021 08:56:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4AADC62A25; Wed, 24 Feb 2021 13:56:38 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A10E5D6AD; Wed, 24 Feb 2021 13:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614178034; 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=JWt5y93RVZ4A9pZUMPGGSlmewnIoDraYpgmd3tt4XmU=; b=NCrBzrCWSLuinKWS5EYDIg5r6bhPhr9KaD4c+yRUva9P9NNdQeVpcf5lPYQteo7vZwUkwY EVIlY8qWr/sLxq84Be/UrLBVfGNEJyM+MX7Fh+RFNtQwVg051er0GOwuU0rKe1KTRS8kKB QP+eQf0rgsw2AgcbG9RKQkN2eCgX6R0= X-MC-Unique: zNMrN4dZNvmF3gSOXJCLQA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 29/31] qom: Add user_creatable_parse_str() Date: Wed, 24 Feb 2021 14:52:53 +0100 Message-Id: <20210224135255.253837-30-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.11 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) Content-Type: text/plain; charset="utf-8" The system emulator has a more complicated way of handling command line options in that it reorders options before it processes them. This means that parsing object options and creating the object happen at two different points. Split the parsing part into a separate function that can be reused by the system emulator command line. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- include/qom/object_interfaces.h | 15 +++++++++++++++ qom/object_interfaces.c | 20 ++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/include/qom/object_interfaces.h b/include/qom/object_interface= s.h index 07511e6cff..fb32330901 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -144,6 +144,21 @@ typedef bool (*user_creatable_add_opts_predicate)(cons= t char *type); int user_creatable_add_opts_foreach(void *opaque, QemuOpts *opts, Error **errp); =20 +/** + * user_creatable_parse_str: + * @optarg: the object definition string as passed on the command line + * @errp: if an error occurs, a pointer to an area to store the error + * + * Parses the option for the user creatable object with a keyval parser and + * implicit key 'qom-type', converting the result to ObjectOptions. + * + * If a help option is given, print help instead. + * + * Returns: ObjectOptions on success, NULL when an error occurred (*errp i= s set + * then) or help was printed (*errp is not set). + */ +ObjectOptions *user_creatable_parse_str(const char *optarg, Error **errp); + /** * user_creatable_add_from_str: * @optarg: the object definition string as passed on the command line diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index c4982dd7a0..1c29f45b41 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -283,7 +283,7 @@ static void user_creatable_print_help_from_qdict(QDict = *args) } } =20 -bool user_creatable_add_from_str(const char *optarg, Error **errp) +ObjectOptions *user_creatable_parse_str(const char *optarg, Error **errp) { ERRP_GUARD(); QDict *args; @@ -293,12 +293,12 @@ bool user_creatable_add_from_str(const char *optarg, = Error **errp) =20 args =3D keyval_parse(optarg, "qom-type", &help, errp); if (*errp) { - return false; + return NULL; } if (help) { user_creatable_print_help_from_qdict(args); qobject_unref(args); - return false; + return NULL; } =20 v =3D qobject_input_visitor_new_keyval(QOBJECT(args)); @@ -306,12 +306,20 @@ bool user_creatable_add_from_str(const char *optarg, = Error **errp) visit_free(v); qobject_unref(args); =20 - if (*errp) { - goto out; + return options; +} + +bool user_creatable_add_from_str(const char *optarg, Error **errp) +{ + ERRP_GUARD(); + ObjectOptions *options; + + options =3D user_creatable_parse_str(optarg, errp); + if (!options) { + return false; } =20 user_creatable_add_qapi(options, errp); -out: qapi_free_ObjectOptions(options); return !*errp; } --=20 2.29.2 From nobody Sun May 19 02:38:08 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=1614178022; cv=none; d=zohomail.com; s=zohoarc; b=VXB34fY3+ENKrNEMcJS+OpHXdRWGoJNjzgMj2uJOfKALV7p7FLyJg3XZiXDArYoNTk6VCbttHN2z/Gkf8p5CtXpuOYq5Qd68CPYeLNMXFjebCFV+DNsxS4iOoCb9T4dtUbZenMgdm5IAEG+MrSrzMvjXu6df2hNNegV54FJm9D0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614178022; 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=faV1fytnu9kfTicVOySI1fjQDibiqsL8dnlFfQwFpTg=; b=V5h67anZMfvflgAKAW9bsU2DCiIkoGrcSA098ZOHntQjTDOFPWuraou5CZTfd9DjUFvoH6gPc13gNel26uKmNkG+DOahJRk8ceFvsIJQP42YOeqpaTANYgvQhy4uCvcbDta0ZDFbNb1TnQx0YaIp9UtfA7su1FOE6YxSTN7HHts= 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) header.from= 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 161417802203790.95247116301005; Wed, 24 Feb 2021 06:47:02 -0800 (PST) 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-167-QaFm7I2LPsS2YZ7sJtGj-g-1; Wed, 24 Feb 2021 09:46:57 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 93098A6B63; Wed, 24 Feb 2021 13:56:43 +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 625F25D9D7; Wed, 24 Feb 2021 13:56:43 +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 103BC58074; Wed, 24 Feb 2021 13:56:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODufFL017177 for ; Wed, 24 Feb 2021 08:56:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 82A405D6D3; Wed, 24 Feb 2021 13:56:41 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 946855D6AD; Wed, 24 Feb 2021 13:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614178021; 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=faV1fytnu9kfTicVOySI1fjQDibiqsL8dnlFfQwFpTg=; b=NDczfJiK6u1tZpvjfvR91/Fjgs0033LL3+F5cbARSlPr5tK0PU/o4qkv/4Tq4KOpLPBSlB k3dGmuh4nQoZykjRrq6vZeNTp8qEOFvGCCPjKvFICs7dhboVBZKWC8QdlS7hCMylRCao3O o7cJAFuCgUpywUcinjayMHPaFidRElE= X-MC-Unique: QaFm7I2LPsS2YZ7sJtGj-g-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 30/31] vl: QAPIfy -object Date: Wed, 24 Feb 2021 14:52:54 +0100 Message-Id: <20210224135255.253837-31-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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.14 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) Content-Type: text/plain; charset="utf-8" This switches the system emulator from a QemuOpts-based parser for -object to user_creatable_parse_str() which uses a keyval parser and enforces the QAPI schema. Apart from being a cleanup, this makes non-scalar properties accessible. This adopts a similar model as -blockdev uses: When parsing the option, create the ObjectOptions and queue them. At the later point where we used to create objects for the collected QemuOpts, the ObjectOptions queue is processed instead. A complication compared to -blockdev is that object definitions are supported in -readconfig and -writeconfig. After this patch, -readconfig still works, though it still goes through the QemuOpts parser, which means that improvements like non-scalar properties are still not available in config files. -writeconfig stops working for -object. Tough luck. It has never supported all options (not even the common ones), so supporting one less isn't the end of the world. As object definitions from -readconfig still go through QemuOpts, they are still included in -writeconfig output, which at least prevents destroying your existing configuration when you just wanted to add another option. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- softmmu/vl.c | 109 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 84 insertions(+), 25 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index b219ce1f35..205c254542 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -113,6 +113,7 @@ #include "sysemu/replay.h" #include "qapi/qapi-events-run-state.h" #include "qapi/qapi-visit-block-core.h" +#include "qapi/qapi-visit-qom.h" #include "qapi/qapi-visit-ui.h" #include "qapi/qapi-commands-block-core.h" #include "qapi/qapi-commands-migration.h" @@ -132,6 +133,14 @@ typedef struct BlockdevOptionsQueueEntry { =20 typedef QSIMPLEQ_HEAD(, BlockdevOptionsQueueEntry) BlockdevOptionsQueue; =20 +typedef struct ObjectOptionsQueueEntry { + ObjectOptions *options; + Location loc; + QTAILQ_ENTRY(ObjectOptionsQueueEntry) next; +} ObjectOptionsQueueEntry; + +typedef QTAILQ_HEAD(, ObjectOptionsQueueEntry) ObjectOptionsQueue; + static const char *cpu_option; static const char *mem_path; static const char *incoming; @@ -143,6 +152,7 @@ static int snapshot; static bool preconfig_requested; static QemuPluginList plugin_list =3D QTAILQ_HEAD_INITIALIZER(plugin_list); static BlockdevOptionsQueue bdo_queue =3D QSIMPLEQ_HEAD_INITIALIZER(bdo_qu= eue); +static ObjectOptionsQueue obj_queue =3D QTAILQ_HEAD_INITIALIZER(obj_queue); static bool nographic =3D false; static int mem_prealloc; /* force preallocation of physical target memory = */ static ram_addr_t ram_size; @@ -1691,12 +1701,9 @@ static int machine_set_property(void *opaque, * cannot be created here, as it depends on the chardev * already existing. */ -static bool object_create_early(const char *type, QemuOpts *opts) +static bool object_create_early(ObjectOptions *options) { - if (user_creatable_print_help(type, opts)) { - exit(0); - } - + const char *type =3D ObjectType_str(options->qom_type); /* * Objects should not be made "delayed" without a reason. If you * add one, state the reason in a comment! @@ -1744,6 +1751,56 @@ static bool object_create_early(const char *type, Qe= muOpts *opts) return true; } =20 +static void object_queue_create(bool early) +{ + ObjectOptionsQueueEntry *entry, *next; + + QTAILQ_FOREACH_SAFE(entry, &obj_queue, next, next) { + if (early !=3D object_create_early(entry->options)) { + continue; + } + QTAILQ_REMOVE(&obj_queue, entry, next); + loc_push_restore(&entry->loc); + user_creatable_add_qapi(entry->options, &error_fatal); + loc_pop(&entry->loc); + qapi_free_ObjectOptions(entry->options); + g_free(entry); + } +} + +/* + * -readconfig still parses things into QemuOpts. Convert any such + * configurations to an ObjectOptionsQueueEntry. + * + * This is more restricted than the normal -object parser because QemuOpts + * parsed things, so no support for non-scalar properties. Help is also n= ot + * supported (but this shouldn't be requested in a config file anyway). + */ +static int object_readconfig_to_qapi(void *opaque, QemuOpts *opts, Error *= *errp) +{ + ERRP_GUARD(); + ObjectOptionsQueueEntry *entry; + ObjectOptions *options; + QDict *args =3D qemu_opts_to_qdict(opts, NULL); + Visitor *v; + + v =3D qobject_input_visitor_new_keyval(QOBJECT(args)); + visit_type_ObjectOptions(v, NULL, &options, errp); + visit_free(v); + qobject_unref(args); + + if (*errp) { + return -1; + } + + entry =3D g_new0(ObjectOptionsQueueEntry, 1); + entry->options =3D options; + loc_save(&entry->loc); + QTAILQ_INSERT_TAIL(&obj_queue, entry, next); + + return 0; +} + static void qemu_apply_machine_options(void) { MachineClass *machine_class =3D MACHINE_GET_CLASS(current_machine); @@ -1816,8 +1873,8 @@ static void qemu_create_early_backends(void) } =20 qemu_opts_foreach(qemu_find_opts("object"), - user_creatable_add_opts_foreach, - object_create_early, &error_fatal); + object_readconfig_to_qapi, NULL, &error_fatal); + object_queue_create(true); =20 /* spice needs the timers to be initialized by this point */ /* spice must initialize before audio as it changes the default auiode= v */ @@ -1841,16 +1898,6 @@ static void qemu_create_early_backends(void) audio_init_audiodevs(); } =20 - -/* - * The remainder of object creation happens after the - * creation of chardev, fsdev, net clients and device data types. - */ -static bool object_create_late(const char *type, QemuOpts *opts) -{ - return !object_create_early(type, opts); -} - static void qemu_create_late_backends(void) { if (qtest_chrdev) { @@ -1859,9 +1906,11 @@ static void qemu_create_late_backends(void) =20 net_init_clients(&error_fatal); =20 - qemu_opts_foreach(qemu_find_opts("object"), - user_creatable_add_opts_foreach, - object_create_late, &error_fatal); + /* + * The remainder of object creation happens after the + * creation of chardev, fsdev, net clients and device data types. + */ + object_queue_create(false); =20 if (tpm_init() < 0) { exit(1); @@ -3407,12 +3456,22 @@ void qemu_init(int argc, char **argv, char **envp) #endif break; case QEMU_OPTION_object: - opts =3D qemu_opts_parse_noisily(qemu_find_opts("object"), - optarg, true); - if (!opts) { - exit(1); + { + ObjectOptionsQueueEntry *entry; + ObjectOptions *options; + + options =3D user_creatable_parse_str(optarg, &error_fa= tal); + if (!options) { + /* Help was printed */ + exit(EXIT_SUCCESS); + } + + entry =3D g_new0(ObjectOptionsQueueEntry, 1); + entry->options =3D options; + loc_save(&entry->loc); + QTAILQ_INSERT_TAIL(&obj_queue, entry, next); + break; } - break; case QEMU_OPTION_overcommit: opts =3D qemu_opts_parse_noisily(qemu_find_opts("overcommi= t"), optarg, false); --=20 2.29.2 From nobody Sun May 19 02:38:08 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=1614178014; cv=none; d=zohomail.com; s=zohoarc; b=jC1ashlp+Z66Dz9lxm8ihlr9miScYY0pFZFBx1cBNk61RpKmVzd4AP/DCe8GN2Eq+uwisF5lhXY6XKiynO/PSz4aqz6DaPJl6HDtD6Ow97IpV1t9ZVJOlbp2bPFZNCAhZHxhPpS2TgGLtZbOJvqsSlGxJra+OZqhxp5aZ6eL1J0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614178014; 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=MzUuseB0orTMjpC4G1G61zMm36iFjlyj36C+eFM4CHE=; b=fKi3RqkYNTSfwj/PSEHF/gEc5ri5ToTac2yiSA6mIlGLpkwdLNJ9tGisKLNAgZKHPIidYO9ZsQVFJarbGzw5iG3k0EoAyca63WKinjZAZi4ZPfJn0xk3G+IdEaQmJwyMpEStdrDtMG9Wjj/5sC0E84Vp08fOutzAJopsB3GVPuk= 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) header.from= 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 1614178014821422.06468802706877; Wed, 24 Feb 2021 06:46:54 -0800 (PST) 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-213-PfY4P3gDPA2bGwIZ0SYq4A-1; Wed, 24 Feb 2021 09:46:51 -0500 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 AEBC9A4D639; Wed, 24 Feb 2021 13:56:46 +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 7949160C5B; Wed, 24 Feb 2021 13:56:46 +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 EFB5958075; Wed, 24 Feb 2021 13:56:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ODui0U017191 for ; Wed, 24 Feb 2021 08:56:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id BBD9D1865D; Wed, 24 Feb 2021 13:56:44 +0000 (UTC) Received: from merkur.redhat.com (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id CED115D6AD; Wed, 24 Feb 2021 13:56:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614178013; 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=MzUuseB0orTMjpC4G1G61zMm36iFjlyj36C+eFM4CHE=; b=T/LlXdrqn7NlCvj5vhyEKFQhJJ5O7hQO9jzCyJF2c+8F5n8C+d1uZOVkfl39zBGGHlI6BF fn2Aanpc3OuZb/qgUkYMv4la7XRLbiLSIkaAiOBEw2oqmnS1wbKAyYkhaK73oxyMBJpFEo icBl4wZK5GU57jSrXFcFYz4PvRll2Pw= X-MC-Unique: PfY4P3gDPA2bGwIZ0SYq4A-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 31/31] qom: Drop QemuOpts based interfaces Date: Wed, 24 Feb 2021 14:52:55 +0100 Message-Id: <20210224135255.253837-32-kwolf@redhat.com> In-Reply-To: <20210224135255.253837-1-kwolf@redhat.com> References: <20210224135255.253837-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jasowang@redhat.com, mreitz@redhat.com, kraxel@redhat.com, pbonzini@redhat.com, dgilbert@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) Content-Type: text/plain; charset="utf-8" user_creatable_add_opts() has only a single user left, which is a test case. Rewrite the test to use user_creatable_add_type() instead (which is the remaining function that doesn't require a QAPI schema) and drop the QemuOpts related functions. Signed-off-by: Kevin Wolf ACKed-by: Peter Krempa Reviewed-by: Eric Blake --- include/qom/object_interfaces.h | 59 ------------------------ qom/object_interfaces.c | 81 --------------------------------- tests/check-qom-proplist.c | 42 ++++++++--------- 3 files changed, 20 insertions(+), 162 deletions(-) diff --git a/include/qom/object_interfaces.h b/include/qom/object_interface= s.h index fb32330901..ac6c33ceac 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -99,51 +99,6 @@ Object *user_creatable_add_type(const char *type, const = char *id, */ void user_creatable_add_qapi(ObjectOptions *options, Error **errp); =20 -/** - * user_creatable_add_opts: - * @opts: the object definition - * @errp: if an error occurs, a pointer to an area to store the error - * - * Create an instance of the user creatable object whose type - * is defined in @opts by the 'qom-type' option, placing it - * in the object composition tree with name provided by the - * 'id' field. The remaining options in @opts are used to - * initialize the object properties. - * - * Returns: the newly created object or NULL on error - */ -Object *user_creatable_add_opts(QemuOpts *opts, Error **errp); - - -/** - * user_creatable_add_opts_predicate: - * @type: the QOM type to be added - * - * A callback function to determine whether an object - * of type @type should be created. Instances of this - * callback should be passed to user_creatable_add_opts_foreach - */ -typedef bool (*user_creatable_add_opts_predicate)(const char *type); - -/** - * user_creatable_add_opts_foreach: - * @opaque: a user_creatable_add_opts_predicate callback or NULL - * @opts: options to create - * @errp: unused - * - * An iterator callback to be used in conjunction with - * the qemu_opts_foreach() method for creating a list of - * objects from a set of QemuOpts - * - * The @opaque parameter can be passed a user_creatable_add_opts_predicate - * callback to filter which types of object are created during iteration. - * When it fails, report the error. - * - * Returns: 0 on success, -1 when an error was reported. - */ -int user_creatable_add_opts_foreach(void *opaque, - QemuOpts *opts, Error **errp); - /** * user_creatable_parse_str: * @optarg: the object definition string as passed on the command line @@ -190,20 +145,6 @@ bool user_creatable_add_from_str(const char *optarg, E= rror **errp); */ void user_creatable_process_cmdline(const char *optarg); =20 -/** - * user_creatable_print_help: - * @type: the QOM type to be added - * @opts: options to create - * - * Prints help if requested in @type or @opts. Note that if @type is neith= er - * "help"/"?" nor a valid user creatable type, no help will be printed - * regardless of @opts. - * - * Returns: true if a help option was found and help was printed, false - * otherwise. - */ -bool user_creatable_print_help(const char *type, QemuOpts *opts); - /** * user_creatable_del: * @id: the unique ID for the object diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 1c29f45b41..25cc54fcd7 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -10,12 +10,9 @@ #include "qapi/qobject-input-visitor.h" #include "qapi/qobject-output-visitor.h" #include "qom/object_interfaces.h" -#include "qemu/help_option.h" #include "qemu/module.h" #include "qemu/option.h" #include "qemu/qemu-print.h" -#include "qapi/opts-visitor.h" -#include "qemu/config-file.h" =20 bool user_creatable_complete(UserCreatable *uc, Error **errp) { @@ -131,60 +128,6 @@ void user_creatable_add_qapi(ObjectOptions *options, E= rror **errp) visit_free(v); } =20 -Object *user_creatable_add_opts(QemuOpts *opts, Error **errp) -{ - Visitor *v; - QDict *pdict; - Object *obj; - const char *id =3D qemu_opts_id(opts); - char *type =3D qemu_opt_get_del(opts, "qom-type"); - - if (!type) { - error_setg(errp, QERR_MISSING_PARAMETER, "qom-type"); - return NULL; - } - if (!id) { - error_setg(errp, QERR_MISSING_PARAMETER, "id"); - qemu_opt_set(opts, "qom-type", type, &error_abort); - g_free(type); - return NULL; - } - - qemu_opts_set_id(opts, NULL); - pdict =3D qemu_opts_to_qdict(opts, NULL); - - v =3D opts_visitor_new(opts); - obj =3D user_creatable_add_type(type, id, pdict, v, errp); - visit_free(v); - - qemu_opts_set_id(opts, (char *) id); - qemu_opt_set(opts, "qom-type", type, &error_abort); - g_free(type); - qobject_unref(pdict); - return obj; -} - - -int user_creatable_add_opts_foreach(void *opaque, QemuOpts *opts, Error **= errp) -{ - bool (*type_opt_predicate)(const char *, QemuOpts *) =3D opaque; - Object *obj =3D NULL; - const char *type; - - type =3D qemu_opt_get(opts, "qom-type"); - if (type && type_opt_predicate && - !type_opt_predicate(type, opts)) { - return 0; - } - - obj =3D user_creatable_add_opts(opts, errp); - if (!obj) { - return -1; - } - object_unref(obj); - return 0; -} - char *object_property_help(const char *name, const char *type, QObject *defval, const char *description) { @@ -260,20 +203,6 @@ static bool user_creatable_print_type_properites(const= char *type) return true; } =20 -bool user_creatable_print_help(const char *type, QemuOpts *opts) -{ - if (is_help_option(type)) { - user_creatable_print_types(); - return true; - } - - if (qemu_opt_has_help_opt(opts)) { - return user_creatable_print_type_properites(type); - } - - return false; -} - static void user_creatable_print_help_from_qdict(QDict *args) { const char *type =3D qdict_get_try_str(args, "qom-type"); @@ -334,7 +263,6 @@ void user_creatable_process_cmdline(const char *optarg) =20 bool user_creatable_del(const char *id, Error **errp) { - QemuOptsList *opts_list; Object *container; Object *obj; =20 @@ -350,15 +278,6 @@ bool user_creatable_del(const char *id, Error **errp) return false; } =20 - /* - * if object was defined on the command-line, remove its corresponding - * option group entry - */ - opts_list =3D qemu_find_opts_err("object", NULL); - if (opts_list) { - qemu_opts_del(qemu_opts_find(opts_list, id)); - } - object_unparent(obj); return true; } diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c index 1b76581980..3bf208ba8b 100644 --- a/tests/check-qom-proplist.c +++ b/tests/check-qom-proplist.c @@ -21,6 +21,8 @@ #include "qemu/osdep.h" =20 #include "qapi/error.h" +#include "qapi/qmp/qdict.h" +#include "qapi/qobject-input-visitor.h" #include "qom/object.h" #include "qemu/module.h" #include "qemu/option.h" @@ -400,20 +402,30 @@ static void test_dummy_createlist(void) =20 static void test_dummy_createcmdl(void) { - QemuOpts *opts; DummyObject *dobj; - Error *err =3D NULL; + QDict *args; + Visitor *v; + g_autofree const char *qom_type =3D NULL; + g_autofree const char *id =3D NULL; const char *params =3D TYPE_DUMMY \ ",id=3Ddev0," \ "bv=3Dyes,sv=3DHiss hiss hiss,av=3Dplatypus"; =20 - qemu_add_opts(&qemu_object_opts); - opts =3D qemu_opts_parse(&qemu_object_opts, params, true, &err); - g_assert(err =3D=3D NULL); - g_assert(opts); + args =3D keyval_parse(params, "qom-type", NULL, &error_abort); + + qom_type =3D g_strdup(qdict_get_str(args, "qom-type")); + qdict_del(args, "qom-type"); + g_assert(!strcmp(qom_type, TYPE_DUMMY)); + + id =3D g_strdup(qdict_get_str(args, "id")); + qdict_del(args, "id"); + g_assert(!strcmp(id, "dev0")); + + v =3D qobject_input_visitor_new_keyval(QOBJECT(args)); + dobj =3D DUMMY_OBJECT(user_creatable_add_type(TYPE_DUMMY, id, args, v, + &error_abort)); + visit_free(v); =20 - dobj =3D DUMMY_OBJECT(user_creatable_add_opts(opts, &err)); - g_assert(err =3D=3D NULL); g_assert(dobj); g_assert_cmpstr(dobj->sv, =3D=3D, "Hiss hiss hiss"); g_assert(dobj->bv =3D=3D true); @@ -422,20 +434,6 @@ static void test_dummy_createcmdl(void) user_creatable_del("dev0", &error_abort); =20 object_unref(OBJECT(dobj)); - - /* - * cmdline-parsing via qemu_opts_parse() results in a QemuOpts entry - * corresponding to the Object's ID to be added to the QemuOptsList - * for objects. To avoid having this entry conflict with future - * Objects using the same ID (which can happen in cases where - * qemu_opts_parse() is used to parse the object params, such as - * with hmp_object_add() at the time of this comment), we need to - * check for this in user_creatable_del() and remove the QemuOpts if - * it is present. - * - * The below check ensures this works as expected. - */ - g_assert_null(qemu_opts_find(&qemu_object_opts, "dev0")); } =20 static void test_dummy_badenum(void) --=20 2.29.2