From nobody Sat May 4 20:55:08 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=1615222522; cv=none; d=zohomail.com; s=zohoarc; b=LcGz1F/5XlHoUemRsPNRo36FjFCpfw7zWXmN2+rMtcy4X0c9ZePFQDZyWoKPSqbbiu/BhmfMwDjLMGwPSis/EBF5R8tZ/NmmOh1UOo4yTT/n7yIqO1n4piznbA8L75BuC5cbEVEDr5rxJAHEesijsFFSnFQUNQU8bLP7QCP47Bo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222522; 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=m9ZHXKFQ/xoHucHAn50KmDdpnS24lgxf7JR0zgVAWvM=; b=nrkrhOLSkmx6NLc1UHfNY6GZd3SOkIo1Fi1y6UzIbW9obpug7Nk5vYr+gS8KtNWQsYZpK6ZtCo80K9MzfOOR9WR8rXjl3IlHcMWitwvvphYVWjaxlgdZWVbQi5TdEho7H7GtOWioJah/y1GNzLd3XvaySX8+TntHRgvy3pmD/+0= 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 1615222522637823.3852095613578; Mon, 8 Mar 2021 08:55: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-30-YDjjphHpPN2jXre_QLygHA-1; Mon, 08 Mar 2021 11:55: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 EBC20193F563; Mon, 8 Mar 2021 16:55:13 +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 876D36085A; Mon, 8 Mar 2021 16:55:13 +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 1FAA357DC2; Mon, 8 Mar 2021 16:55:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GtBQd022538 for ; Mon, 8 Mar 2021 11:55:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id A494E29559; Mon, 8 Mar 2021 16:55:11 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 655255D9E3; Mon, 8 Mar 2021 16:55:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222521; 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=m9ZHXKFQ/xoHucHAn50KmDdpnS24lgxf7JR0zgVAWvM=; b=SJuSyXX+v6JKZ+KzNGRiHA2G3EQjeAor6lmZ1aVr9FPS1fZk84WsTpdI1YyJ2CbzWwlANA wTpEMe58Z+lfi4bpom03+DvJWZwZnfzcV8cSUP7ZarnaB4T+a9Ldpn9x0yy6v8jPpYMsjK 545ALxWooaTPhehArjlrSj0+LbvR0Ag= X-MC-Unique: YDjjphHpPN2jXre_QLygHA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 01/30] qapi/qom: Drop deprecated 'props' from object-add Date: Mon, 8 Mar 2021 17:54:11 +0100 Message-Id: <20210308165440.386489-2-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 561c916da2..893f3e8579 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -206,11 +206,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 Sat May 4 20:55: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=1615222534; cv=none; d=zohomail.com; s=zohoarc; b=ed8Gm+uMN+bVKPZ2U0C5Jj6ew6HL2nqkCNngSqwrbNuvXcjK5OP2FmBcpp8pKsrRkSEJwMPKN9r+8YhlvoX4psrgdCQZhXKglCDU915kiRjdSm4I3TxBjX7e3R9PQJncFzmDVHYTVqg0+INWr7E4YsFZlevPS+IEp7EjqSSXSaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222534; 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=SEjAru+LWL/KmRb7csSucQINEMDf7VfKnetd0CGWEx4=; b=EWJ1wJlCqYQVtVlxjaghKcb5mkT9ru/ILTIRh2EU75jDEEohpNNvtT0OoMhicd9hqOn7YfXvmCunmDiBBt3rG9ZZIt2llDJ61z1zGv0vRRyk0ZMkZZkq2yTc8hcZ/ZSwIOSq5+khsoEmandIXhhSzgjBsUboMTMZG5ALnuMKYBE= 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 1615222534399830.3896320442404; Mon, 8 Mar 2021 08:55:34 -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-63-e8sWZxWIMfycZL0GvKVUYQ-1; Mon, 08 Mar 2021 11:55:30 -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 9049E801814; Mon, 8 Mar 2021 16:55: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 6773419D9D; Mon, 8 Mar 2021 16:55: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 26BFC1809C8B; Mon, 8 Mar 2021 16:55:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GtEZ2022553 for ; Mon, 8 Mar 2021 11:55:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id E011C4EF6C; Mon, 8 Mar 2021 16:55:14 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id F17105D9E3; Mon, 8 Mar 2021 16:55:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222533; 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=SEjAru+LWL/KmRb7csSucQINEMDf7VfKnetd0CGWEx4=; b=QRPpLYkj9syw7dRtIqAifVadW3ZfaXKFDSm35PfvNaQQS7+nbNMhP+x2ti7FZs+pO3NG69 u+hxuh9t+/k3hdnOveNsMygtN9nKz5FX5z1CP+sJJZf3K13eNg6QsrRVYjGsiz7PInAEf7 Kg+e1EYYR/WAkkcUvvKzF8ROtuvSg9M= X-MC-Unique: e8sWZxWIMfycZL0GvKVUYQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 02/30] qapi/qom: Add ObjectOptions for iothread Date: Mon, 8 Mar 2021 17:54:12 +0100 Message-Id: <20210308165440.386489-3-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 Sat May 4 20:55: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=1615222538; cv=none; d=zohomail.com; s=zohoarc; b=Bx/Dri/Df/OTqspb4UPZDbatwVV6I5hT6i01/E/UXSVQTLvRxmitCSowi62laHfDOKvJhMAz9JRnb42AJthaSELRa92KZlpEIuw3nPkVdfEXhr03StthVMw2HO3UTWwztVrKo1/TqUgiZC7yuvXn53h71Ke/H2SVD9g67tWXTWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222538; 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=4fKrSoN5LQPGwgzDOQHNyExlWDQc6c4cs2ig5IKjOWU=; b=H6R/BIf250JEc0h7dc8alAC9cdFdYnb9oeqPsuVim7CnxLqDF2MsyO7H/sxONvz8V7ZlidonD4GAKjRLLLejQOMXaSkDQPXVX+T88FXqaFKNVgFvlev51Uy32VjXjX/uSERMVEKLpVhyyfk5GpNPzd5ElB+jhuBiuz8EgsY9mBQ= 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 1615222538808349.85400654500904; Mon, 8 Mar 2021 08:55: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-408-YnyJZZnrP-ipydfVSF-W5w-1; Mon, 08 Mar 2021 11:55:35 -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 D554F100960D; Mon, 8 Mar 2021 16:55:29 +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 B4E8660854; Mon, 8 Mar 2021 16:55:29 +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 7CAF457DC0; Mon, 8 Mar 2021 16:55:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GtSSF022574 for ; Mon, 8 Mar 2021 11:55:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 005FB29401; Mon, 8 Mar 2021 16:55:28 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34B715D9E3; Mon, 8 Mar 2021 16:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222537; 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=4fKrSoN5LQPGwgzDOQHNyExlWDQc6c4cs2ig5IKjOWU=; b=jG70Kp2d7e+m8925z3pU5iqeRFFK26evHMq7uzxrPTWoBQ66/Rxqx+Vr39M9Lc0fO4+Yam 0Ay3X5U73gMwOQP4KefpQ2g1KMEya+rDq8wEtF21LLlrFUVIryUY3ynHyDzMw+4F9klTi8 3Yls1hKnkSIzzynnWk8AJNbc7cX0M/c= X-MC-Unique: YnyJZZnrP-ipydfVSF-W5w-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 03/30] qapi/qom: Add ObjectOptions for authz-* Date: Mon, 8 Mar 2021 17:54:13 +0100 Message-Id: <20210308165440.386489-4-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 authz-* objects. Signed-off-by: Kevin Wolf Acked-by: Peter Krempa Reviewed-by: Eric Blake Acked-by: Daniel P. Berrang=C3=A9 --- qapi/authz.json | 61 +++++++++++++++++++++++++--- qapi/qom.json | 10 +++++ storage-daemon/qapi/qapi-schema.json | 1 + 3 files changed, 67 insertions(+), 5 deletions(-) diff --git a/qapi/authz.json b/qapi/authz.json index 42afe752d1..51845e37cc 100644 --- a/qapi/authz.json +++ b/qapi/authz.json @@ -50,12 +50,63 @@ '*format': 'QAuthZListFormat'}} =20 ## -# @QAuthZListRuleListHack: +# @AuthZListProperties: # -# Not exposed via QMP; hack to generate QAuthZListRuleList -# for use internally by the code. +# 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': 'QAuthZListRuleListHack', - 'data': { 'unused': ['QAuthZListRule'] } } +{ '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 Sat May 4 20:55: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=1615222542; cv=none; d=zohomail.com; s=zohoarc; b=AmB/V0dJGTZHigTAydUA51tch7sIosPspf1qhB7sGsnNDnhkpFLOEr/XGnVGcUF+oqawjV0TKs0Azy2AiDDAKOjSB+GcEn8IJqitmqaUfCdxxXNRLVGwmbucz/klcGvaJp1T1bqejnxNYI2dSyS+twFFeuHgWcy68PK+4yx1Z/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222542; 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=rWTkUt8ItFufZC3kNth50Mpg8TcvjFChMjF/N1Af4dE=; b=gdqSCTbMV0C9axfWV+n4I09o3orQsjPVPvHkdvHyARLnNGdfqRuKnH6c/1SHOUYKdea3QPfOruzVsTT1/MwmHjeNpD2u2pTwdm+ZLR0T96YalAF1sNkY2I4cV9hrlPse717EWFzL6CUq/x2uvtP8MoVMlYgQVAYRq+q51z9ffAY= 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 1615222542857163.45450008709474; Mon, 8 Mar 2021 08:55:42 -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-368-cHXNYYQeN9yRfqjnNi9s9Q-1; Mon, 08 Mar 2021 11:55:38 -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 E4E1E8030D1; Mon, 8 Mar 2021 16:55:32 +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 B89EA80467; Mon, 8 Mar 2021 16:55:32 +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 7757457DC3; Mon, 8 Mar 2021 16:55:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GtVrV022597 for ; Mon, 8 Mar 2021 11:55:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2153F4EF69; Mon, 8 Mar 2021 16:55:31 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 487B25D9D3; Mon, 8 Mar 2021 16:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222541; 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=rWTkUt8ItFufZC3kNth50Mpg8TcvjFChMjF/N1Af4dE=; b=dLA6nlqZAvjtGarxTdFHmoL3JcgSxmgcrOADBlFW2hsKysu84eJMHEVOkoXYcTCoXOx+rj uPG882A8dTsQ5JQAB8C6YrxfWu0h4n9n/H9GKZhh7PJ/uh+z925GHAEUjXzn20MuyyAf1Z ZBXghcP6i+oQ1iBt0GsHkAfFQRsNhLo= X-MC-Unique: cHXNYYQeN9yRfqjnNi9s9Q-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 04/30] qapi/qom: Add ObjectOptions for cryptodev-* Date: Mon, 8 Mar 2021 17:54:14 +0100 Message-Id: <20210308165440.386489-5-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/qapi/qom.json b/qapi/qom.json index 30ed179bc1..46c2cdc6cf 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,10 @@ 'authz-listfile': 'AuthZListFileProperties', 'authz-pam': 'AuthZPAMProperties', 'authz-simple': 'AuthZSimpleProperties', + 'cryptodev-backend': 'CryptodevBackendProperties', + 'cryptodev-backend-builtin': 'CryptodevBackendProperties', + 'cryptodev-vhost-user': { 'type': 'CryptodevVhostUserPropertie= s', + 'if': 'defined(CONFIG_VIRTIO_CRYPTO)= && defined(CONFIG_VHOST_CRYPTO)' }, 'iothread': 'IothreadProperties' } } =20 --=20 2.29.2 From nobody Sat May 4 20:55: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=1615222683; cv=none; d=zohomail.com; s=zohoarc; b=hqL1IwMbfLHjGlmllpRttXWZlzAMmFKTY9+0spMyv1tLOJ6fw5GlGeYLAFIa8dnRjilQF5fopGe8Wx05wGH7xJ0wCRp67AkUxaeymeAYilRFFReVXqKdClhHWJcojfuxvgLreMz4Ce77fSH+kFB5AosrYQRDxRQhfJjkAH4fWOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222683; 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=abW4ev/LsJ17tNltHEjcxsI6MjqEQ6uvryWZxwBLKUg=; b=Q3BXU1y7ytPCX4bX3H6/N4rVrZRC1iczLFHmuSDsB+7xl61ppakXZlOpYgWG/yXol0009wYzMzX5e9XcL5zDNgP58RpSlb1hBTe4xNDgkXBxuReSbnjrvpBo3W6tp1xjsJOIIeIo0qDjb03h58dD1+g3ScRCMDO7mZ81JY1kolI= 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 1615222683048240.4953250925912; Mon, 8 Mar 2021 08:58:03 -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-332-AlsoKOXoOZWl4Qo4PAJBQQ-1; Mon, 08 Mar 2021 11:55:41 -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 66DDA83DD21; Mon, 8 Mar 2021 16:55:35 +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 40DBF5C5E1; Mon, 8 Mar 2021 16:55:35 +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 0B7A21809C86; Mon, 8 Mar 2021 16:55:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GtYMe022632 for ; Mon, 8 Mar 2021 11:55:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4F52D5D9DC; Mon, 8 Mar 2021 16:55:34 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 682705D9D3; Mon, 8 Mar 2021 16:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222682; 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=abW4ev/LsJ17tNltHEjcxsI6MjqEQ6uvryWZxwBLKUg=; b=aDPHsMFI2D1pNJeJiJQ9vj0ddBSDYXvCeERO8CbqHEMdrnczh0aK30yGPNWaAewAejq41g c5/NhiPfJJHTPrBCsMmG352Zg4teK237ysMyxnKSvlZFjb+juJwRbKWy4ZJozz7ftDGfyw AdTnC1wVWonlY5pnjMpymumO9x1UHYk= X-MC-Unique: AlsoKOXoOZWl4Qo4PAJBQQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 05/30] qapi/qom: Add ObjectOptions for dbus-vmstate Date: Mon, 8 Mar 2021 17:54:15 +0100 Message-Id: <20210308165440.386489-6-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 46c2cdc6cf..942654e05c 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 @@ -297,6 +314,7 @@ 'cryptodev-backend-builtin': 'CryptodevBackendProperties', 'cryptodev-vhost-user': { 'type': 'CryptodevVhostUserPropertie= s', 'if': 'defined(CONFIG_VIRTIO_CRYPTO)= && defined(CONFIG_VHOST_CRYPTO)' }, + 'dbus-vmstate': 'DBusVMStateProperties', 'iothread': 'IothreadProperties' } } =20 --=20 2.29.2 From nobody Sat May 4 20:55: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=1615222630; cv=none; d=zohomail.com; s=zohoarc; b=mw24aZ2NM+AcJP9SvbFaJUnorBbl6n1hJqXeVaOmtDeS0IYptJlBcs+PLkqO8mJKOAyDxF+8U/8PWDWymCbfN6DdHGCBt6BuwGNnijJTUiXrOOEu/2FWtXvf1/esiM1BZR6U8h0CGASEb8nwlrvxw/KV5IuqF6DfSD3p4w8N/nM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222630; 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=rT4foOdK33IkQZC9xQtK7vwA0uT2WYZhLVCSR6IhHl0=; b=m6k7KXlK098twMKjUu8+V6nTWc8o9K9Bg4eAwFQhVAMl5CgiDaGWaBt94BzPW5g19HLwvJ5D588b3sR9beWBMo5p7ZV6tL0DXTkfQbgr86y/ZPjDZnS831B3DcVWxJH+0mwQbiYGfmZJqHFlYxajng1zmY8xaFP5mnnqdX4NyVw= 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 1615222630596284.0011015636961; Mon, 8 Mar 2021 08:57:10 -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-xh5Ex3qpPoW9g_fDm9EwZA-1; Mon, 08 Mar 2021 11:55:44 -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 A4C891966320; Mon, 8 Mar 2021 16:55:38 +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 8411F6085A; Mon, 8 Mar 2021 16:55:38 +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 485631809C86; Mon, 8 Mar 2021 16:55:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128Gtbwb022657 for ; Mon, 8 Mar 2021 11:55:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6FE945D9DC; Mon, 8 Mar 2021 16:55:37 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 866705D9D3; Mon, 8 Mar 2021 16:55:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222629; 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=rT4foOdK33IkQZC9xQtK7vwA0uT2WYZhLVCSR6IhHl0=; b=JWFcyG6QK/vMak9bO1QL7caXHKt3/n+ZsjYX28kiCIfRoADrlX61uHjMB6coS7IRSSZvmw Q7FEKAFQyxpVZ7Yc5yBqeJsYSbKnbo/Y89qXvOBtV78W3QpCwQdhOlk9UTy76DlkqDHueN ncyMASO3FlI+Ah8Ek/M/tBCYUQ4cMt0= X-MC-Unique: xh5Ex3qpPoW9g_fDm9EwZA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 06/30] qapi/qom: Add ObjectOptions for memory-backend-* Date: Mon, 8 Mar 2021 17:54:16 +0100 Message-Id: <20210308165440.386489-7-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 Reviewed-by: Eric Blake --- qapi/common.json | 20 ++++++++ qapi/machine.json | 22 +-------- qapi/qom.json | 121 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 141 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 942654e05c..8c0e06c198 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,115 @@ '*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. +# This option is considered stable +# despite the x- prefix. (default: +# false generally, but true for mac= hine +# 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)s @mem-path. Some +# backend stores specified by @mem-path require 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': { 'type': 'bool', 'if': 'defined(CONFIG_LIBPMEM)' }, + '*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 +397,10 @@ 'cryptodev-backend-builtin', 'cryptodev-vhost-user', 'dbus-vmstate', - 'iothread' + 'iothread', + 'memory-backend-file', + 'memory-backend-memfd', + 'memory-backend-ram' ] } =20 ## @@ -315,7 +428,11 @@ 'cryptodev-vhost-user': { 'type': 'CryptodevVhostUserPropertie= s', 'if': 'defined(CONFIG_VIRTIO_CRYPTO)= && defined(CONFIG_VHOST_CRYPTO)' }, 'dbus-vmstate': 'DBusVMStateProperties', - 'iothread': 'IothreadProperties' + 'iothread': 'IothreadProperties', + 'memory-backend-file': 'MemoryBackendFileProperties', + 'memory-backend-memfd': { 'type': 'MemoryBackendMemfdPropertie= s', + 'if': 'defined(CONFIG_LINUX)' }, + 'memory-backend-ram': 'MemoryBackendProperties' } } =20 ## --=20 2.29.2 From nobody Sat May 4 20:55: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=1615222560; cv=none; d=zohomail.com; s=zohoarc; b=dcWg1ro7mBJ9tspqJyJzcXdBZcLmR3gaF0iMl0mQjjTqSvwXNg5RQ7+TDf+gW+n/7vrhCI1PyFDeSa1R0hbG4II2PR6NDu/34WIiF19+MIgt6hU1k52XH0qHwEq+CchJqlt6ByddTPOIgffmCRUIRjAz24irz9Xr5aw1xjUmWDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222560; 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=zplTMilwm4Oqd/sBVhFB4AOzdaT1SOWzGDYsM/FrPfk=; b=HDylP1hnqYuT8zI6rBDudES6vzca+SuhcKcYuxuPLb7svscl/Y5wIdJ634Zka4ZElrWF1q1MMsTB81lmUg+iDT4Av4+UbdBPm5BT54B4DU7lXs0wy827w+C/3oEZbetBfU53UaiKQURO3MPTMgBF68E/fJtX0BnR5PGNg3wfWsM= 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 1615222560093502.11456286989494; Mon, 8 Mar 2021 08:56:00 -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-175-cf7KbMaFOZeKflSHXPCUdQ-1; Mon, 08 Mar 2021 11:55:56 -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 B1AA2E5763; Mon, 8 Mar 2021 16:55:49 +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 8D4F560854; Mon, 8 Mar 2021 16:55:49 +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 2A2B557DC3; Mon, 8 Mar 2021 16:55:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GtmPp022726 for ; Mon, 8 Mar 2021 11:55:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6C77E4EF69; Mon, 8 Mar 2021 16:55:48 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9F7E5D9D3; Mon, 8 Mar 2021 16:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222559; 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=zplTMilwm4Oqd/sBVhFB4AOzdaT1SOWzGDYsM/FrPfk=; b=dgqFL8n3bZEBKkvocsP3ei5Gff6kTjoBs7dpjmU5hf5lx0VpUY9eImHfyg2o+clug2wrbE 1uWlJiA9bz4xhYC+BUj9/zukaBfyOCXww+iPrK0uYhr/yKhZSSF3CkkVVCFbREka7MPpzS rX2+spNlfF9afc+qc5ZmvDkejRCBO64= X-MC-Unique: cf7KbMaFOZeKflSHXPCUdQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 07/30] qapi/qom: Add ObjectOptions for rng-*, deprecate 'opened' Date: Mon, 8 Mar 2021 17:54:17 +0100 Message-Id: <20210308165440.386489-8-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 8c0e06c198..6d3b8c4fe0 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -382,6 +382,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: # @@ -400,7 +446,10 @@ 'iothread', 'memory-backend-file', 'memory-backend-memfd', - 'memory-backend-ram' + 'memory-backend-ram', + 'rng-builtin', + 'rng-egd', + 'rng-random' ] } =20 ## @@ -432,7 +481,10 @@ 'memory-backend-file': 'MemoryBackendFileProperties', 'memory-backend-memfd': { 'type': 'MemoryBackendMemfdPropertie= s', 'if': 'defined(CONFIG_LINUX)' }, - '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 893f3e8579..3dac79f600 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -153,6 +153,15 @@ The ``-writeconfig`` option is not able to serialize t= he entire contents of the QEMU command line. It is thus considered a failed experiment and deprecated, with no current replacement. =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 Sat May 4 20:55: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=1615222570; cv=none; d=zohomail.com; s=zohoarc; b=H81t2btrFxxayAj6bdHLTcDL/kYpFJaevvZvx2c+9pYnzSUaraocsyfe4rgIO8JLg1oqcpJHR0fI76F0bJ4j4cQIua5Iy0hnb+wa/Z85TTXQ7PgsRNGjlF1Li/5M+FpwQz6XBS3FSxmTde3aGHcAOKT/usmKaexrlwSTQUjG/H8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222570; 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=ajounDvxokTFzoB9wvZR6L7evSaIXZBUIm+T+oqS00o=; b=lb2fyRMKgIiCzTqMy9+cpUdCxR4NwkE0nDsYEc38Qi0WvBooqwykn/QJBZBpQ92m1/3Qx5vVkoWHiGX+zAlypv5cZmu4W5Lf+YH82opmrtjrNia7jyIY3W2ZQM1FtF9FDtBN+YZWv+arZFoMdsmL8UYgVx79B0w/LwFFqQbZh6Q= 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 1615222570922245.94580353903837; Mon, 8 Mar 2021 08:56:10 -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-210-pRWyaF5UOO-lPU99VYcWWQ-1; Mon, 08 Mar 2021 11:55:59 -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 5DD4DE577A; Mon, 8 Mar 2021 16:55:52 +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 3BE346F125; Mon, 8 Mar 2021 16:55:52 +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 0637D57DC5; Mon, 8 Mar 2021 16:55:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128Gtp6a022743 for ; Mon, 8 Mar 2021 11:55:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8DAD022E53; Mon, 8 Mar 2021 16:55:51 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2AED5D9D3; Mon, 8 Mar 2021 16:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222570; 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=ajounDvxokTFzoB9wvZR6L7evSaIXZBUIm+T+oqS00o=; b=TZFwR8T+lRnesuIeS9SW0YQmbZrZEdrxbQgcnHvS7TnLSJH+2qp9phIfDrjQ2tLkmE30/w ps1kYFiuculLkLHLuxDBNKIg4nz49wj2FLbdRptr2kzfJNoebO0L0bl+c9GKt3wk3mlHpB b3F7YHHTzejdN5310mYOl2vGu1v7byA= X-MC-Unique: pRWyaF5UOO-lPU99VYcWWQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 08/30] qapi/qom: Add ObjectOptions for throttle-group Date: Mon, 8 Mar 2021 17:54:18 +0100 Message-Id: <20210308165440.386489-9-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 6d3b8c4fe0..0721a636f9 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 ## @@ -449,7 +450,8 @@ 'memory-backend-ram', 'rng-builtin', 'rng-egd', - 'rng-random' + 'rng-random', + 'throttle-group' ] } =20 ## @@ -484,7 +486,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 Sat May 4 20:55: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=1615222565; cv=none; d=zohomail.com; s=zohoarc; b=d3PPzI/Bt/bhKzCBWmwuhJM8HPW5UYTmjAGqUXAA/5LfOadIl+YtJ4bU1ywjuYJClbEP4zbOGL+kw3fLQGB6ZnYQBbnwEO0MB5zZH41Wm0unTVYNyWVWnIPAJME04zNnlhK5ncC+S8NxCE1T5cIBpwMz1DYByRzloOrdZ73+82A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222565; 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=pN/jGMxLsOBcWUJpXUI7YE/gp07yl+wpd2gxHprRbOw=; b=JO77K4ldP3CpEgaJOy0Ln6fyp67zTeILmYwhUrsMM5znfQlW9O2CzyipBqLFdtQ7MvDmL8ZBxvgGSAweCduN7JRuUeUEcje+RtKt3OAiFakkz/KXoZ4Ug8ITtnRrX97o/bLj+t/uBbgVnrPpJXaudxHX95pAhO/JQEqhbixfqKU= 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 1615222565505668.0829327614312; Mon, 8 Mar 2021 08:56:05 -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-263-woZ90IyHPwato96kZPfrNA-1; Mon, 08 Mar 2021 11:56:02 -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 AE27984BA68; Mon, 8 Mar 2021 16: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 8A7035944F; Mon, 8 Mar 2021 16: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 5325557DC5; Mon, 8 Mar 2021 16:55:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GtsqC022770 for ; Mon, 8 Mar 2021 11:55:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id A7E864278; Mon, 8 Mar 2021 16:55:54 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D502A5D9DC; Mon, 8 Mar 2021 16:55:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222564; 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=pN/jGMxLsOBcWUJpXUI7YE/gp07yl+wpd2gxHprRbOw=; b=XJkDEPNynCZs2P8ndZBdo2a+PtieoMC5BoRmjXs1JDFdsKzRPmVQEKNw0WlITi8M3wcs2+ PIXVnWMsSVFyqxt7mKp8A3FvkvvG24yktbLK9dzFC8G9W/Y3pHZXxf7mcjzWSQLNk3v1ez q+NIPaiRe4dpAE50wDz6UD2BxzS+0ww= X-MC-Unique: woZ90IyHPwato96kZPfrNA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 09/30] qapi/qom: Add ObjectOptions for secret*, deprecate 'loaded' Date: Mon, 8 Mar 2021 17:54:19 +0100 Message-Id: <20210308165440.386489-10-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 Acked-by: Daniel P. Berrang=C3=A9 --- 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 0721a636f9..e4bbddd986 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) @@ -451,6 +452,8 @@ 'rng-builtin', 'rng-egd', 'rng-random', + 'secret', + 'secret_keyring', 'throttle-group' ] } =20 @@ -487,6 +490,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 3dac79f600..f4e8226963 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -162,6 +162,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 Sat May 4 20:55: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=1615222568; cv=none; d=zohomail.com; s=zohoarc; b=MSw9FVyMgxeVR2SN5+3GS1xlBcl5iNQzp62wj6kJ0fVWFArdn59QuDxsoMsh9llh67hUGevuV7VdDynQKMFFFfA1sM4QBrLTHnzQL+eMdHU3dOOyVIUD1CLHpt1nAVkuBECgXuAeqWIKZbyCIWso5SJLj+3YadbppQ/piinc8lI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222568; 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=UDyhu5JKCp6bpoBXmThNkyaiwd+akBLxmCrRqJOdYOM=; b=G7QYXBXKjFW3uv6bF+1vBCOr+i7afqEOjHhKlHAkSJ/oY0/yJoNi0IED/0Eobs5+7oLTvQ0WyFsvSUeNwkgUvkKVFdUhmXdsxnSUgbEB8kL789OwXez49IOgEs0QNL1K3w6Aczl0AXHB0rNJdgg382yClMy9nWfVSlHWHVa5+gQ= 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 16152225684781001.9107321181552; Mon, 8 Mar 2021 08:56: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-590-zvkI_isNMwadOyo-FksA8g-1; Mon, 08 Mar 2021 11:56: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 A56E484BA43; Mon, 8 Mar 2021 16:55:59 +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 7D70B19D9D; Mon, 8 Mar 2021 16: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 1C2B21809C8B; Mon, 8 Mar 2021 16:55:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GtvXr022796 for ; Mon, 8 Mar 2021 11:55:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id C54664EF6B; Mon, 8 Mar 2021 16:55:57 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id F00D85D9DB; Mon, 8 Mar 2021 16:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222567; 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=UDyhu5JKCp6bpoBXmThNkyaiwd+akBLxmCrRqJOdYOM=; b=F5xRDU86jQ3gdEuWQfLoG6zupP7dyymK1HsnUO6CBkaZDZQGrX855XrTxIZtY5ffhVgTm7 Uu7IWt7aMn9C1mad3kAQ826/t2x0F5dTngaIfmOQ1LkgbhO76TmQK4p9InngH3al93y0BL wMAIfLoG2RxOubxB7TzrexCwG0n3Ikw= X-MC-Unique: zvkI_isNMwadOyo-FksA8g-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 10/30] qapi/qom: Add ObjectOptions for tls-*, deprecate 'loaded' Date: Mon, 8 Mar 2021 17:54:20 +0100 Message-Id: <20210308165440.386489-11-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 Acked-by: Daniel P. Berrang=C3=A9 --- 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 e4bbddd986..512d8fce12 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -454,7 +454,11 @@ 'rng-random', 'secret', 'secret_keyring', - 'throttle-group' + 'throttle-group', + 'tls-creds-anon', + 'tls-creds-psk', + 'tls-creds-x509', + 'tls-cipher-suites' ] } =20 ## @@ -492,7 +496,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 Sat May 4 20:55: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=1615222581; cv=none; d=zohomail.com; s=zohoarc; b=WP/k1dGkH9D5t1L1uKLOdBZYtdJvKwcZmkTXkF2+Usa26FTTBMJumc0GrEz5cggH7YHlxy9OBsSXWW+iqteZjqzzKLVy9sdmV+2494+3Zx4uhWyRxMnjWOE+ZF6eQlDY6XV+U4zdw+LPvvhlocuUeqInyLUu7p4J7ELI9ulkIv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222581; 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=K25rdyM1mbTdptadzKAHr7Z91UasWk99lVib5OlT9gU=; b=I9aoKx9qXG05zZ1F1+CnLhf+NvvLVMWp9cXL/A3a/Cvckp769ix5JIi1YsSygS20aYCt2d63latuOTxN1ggYITJXzibLZsaMoHor49VOSh3eJZIQtR3ab3W3MB2vZkvfsSlOfWLpqN5Iy+2TtuShavl40+kKE8L/RLs9CJky5n4= 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 1615222581944807.625382833422; Mon, 8 Mar 2021 08:56:21 -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-99-nxTRYSKeNwWiAlIEVgPNtA-1; Mon, 08 Mar 2021 11:56:18 -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 5591484BA43; Mon, 8 Mar 2021 16:56:11 +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 34FA750C0A; Mon, 8 Mar 2021 16:56:11 +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 F274357DC4; Mon, 8 Mar 2021 16:56:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128Gu9lm022877 for ; Mon, 8 Mar 2021 11:56:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id AC27A29401; Mon, 8 Mar 2021 16:56:09 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 161F85D9DB; Mon, 8 Mar 2021 16:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222580; 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=K25rdyM1mbTdptadzKAHr7Z91UasWk99lVib5OlT9gU=; b=P8dHRCNeXdvxKPyWlzK0xaGRv+h1j9RmcEJ1Cn+V/Li6qp7cVzpzYWXd1mExYdq11S7xiD Oul04mmlGQm404IFnhceHb9T4IKCx+hZLZ35QxJZOP4ZL1bm1Q4tPGFOlyWn6ktKMvqg/H 4rt/2fPuLQW7kkKlt7bnBno32O63mDo= X-MC-Unique: nxTRYSKeNwWiAlIEVgPNtA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 11/30] qapi/qom: Add ObjectOptions for can-* Date: Mon, 8 Mar 2021 17:54:21 +0100 Message-Id: <20210308165440.386489-12-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 512d8fce12..fd87896bca 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: # @@ -441,6 +456,8 @@ 'authz-listfile', 'authz-pam', 'authz-simple', + 'can-bus', + 'can-host-socketcan', 'cryptodev-backend', 'cryptodev-backend-builtin', 'cryptodev-vhost-user', @@ -481,6 +498,7 @@ 'authz-listfile': 'AuthZListFileProperties', 'authz-pam': 'AuthZPAMProperties', 'authz-simple': 'AuthZSimpleProperties', + 'can-host-socketcan': 'CanHostSocketcanProperties', 'cryptodev-backend': 'CryptodevBackendProperties', 'cryptodev-backend-builtin': 'CryptodevBackendProperties', 'cryptodev-vhost-user': { 'type': 'CryptodevVhostUserPropertie= s', --=20 2.29.2 From nobody Sat May 4 20:55: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=1615222582; cv=none; d=zohomail.com; s=zohoarc; b=m77nouPr2nagq06qKz/5UHWhT6ndhejXOHIHP/lQbTIcJZSxXH2OWpkcdVWTYu8JBUbWgy/PFPTD3//bjTIlSsdtD+YO/QOk2pZ+JJFqQoLltQoeEKfGZCMgg1ATSQTHjLH5N0fF84u95m/CT0J12euk1baZf0IniB+Nbwi+nDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222582; 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=WZhUdeQbA7PLw5tRHiipoeFCA0GoRvKjnCl2aUPKtQE=; b=bPSclQIdq3j8jTvTs/dPduoEll413ZURR3wnNk6XeD6POojqxCkdO1VYyc2LdRrS2uInVymGI2tjo7Qq/EN36D68jCMzIFgpAuSBwNi9j5MJWLl5mjrplp3X7VhWvt/LlHS7SgZm9Gr/NEnUNhYAuNyHSAJM3kPjBPHSMPwGW6Y= 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 1615222582720665.236594295794; Mon, 8 Mar 2021 08:56: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-284-FDxFLXo-MxK66i8AGbrZTg-1; Mon, 08 Mar 2021 11:56:19 -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 36247184215C; Mon, 8 Mar 2021 16:56:14 +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 1609E1ACBA; Mon, 8 Mar 2021 16:56:14 +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 D34CC1809C8B; Mon, 8 Mar 2021 16:56:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GuC9W022905 for ; Mon, 8 Mar 2021 11:56:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id D1B311B475; Mon, 8 Mar 2021 16:56:12 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0048F5D9DB; Mon, 8 Mar 2021 16:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222581; 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=WZhUdeQbA7PLw5tRHiipoeFCA0GoRvKjnCl2aUPKtQE=; b=YVzAVbR2bMi9eU1z2WG8YB/ZiHwCXvkB42HmL8tedSYXtHkuW6AiWvzjnqMuoRjaYLcLTn Cyn5q8Y7vH9CWF3GB8UCMPzW+sdgZh3+e/CZ7oo5W06Yfh/GrfMvKJ6DOZwNy037F9m2sC Py477w+K0OYyu8Wz/P4tD5i1GeXAAcY= X-MC-Unique: FDxFLXo-MxK66i8AGbrZTg-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 12/30] qapi/qom: Add ObjectOptions for colo-compare Date: Mon, 8 Mar 2021 17:54:22 +0100 Message-Id: <20210308165440.386489-13-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 fd87896bca..a34ae43cb9 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: # @@ -458,6 +505,7 @@ 'authz-simple', 'can-bus', 'can-host-socketcan', + 'colo-compare', 'cryptodev-backend', 'cryptodev-backend-builtin', 'cryptodev-vhost-user', @@ -499,6 +547,7 @@ 'authz-pam': 'AuthZPAMProperties', 'authz-simple': 'AuthZSimpleProperties', 'can-host-socketcan': 'CanHostSocketcanProperties', + 'colo-compare': 'ColoCompareProperties', 'cryptodev-backend': 'CryptodevBackendProperties', 'cryptodev-backend-builtin': 'CryptodevBackendProperties', 'cryptodev-vhost-user': { 'type': 'CryptodevVhostUserPropertie= s', --=20 2.29.2 From nobody Sat May 4 20:55: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=1615222589; cv=none; d=zohomail.com; s=zohoarc; b=UAU23TBg3eqzp3SOWtoaXU5RwcPoQy1zhHeUPx5m2gMMZPCCeSZfcILbJzSY3JF2NFdL0Z0AbCZswVqpzXNGWpB5keWD0GGC0AOwP8km6W2/75cRWB0djaYHrfyFBv4Ke+RYfEibwHD+7H0B2DuH3wcQK0oItR5I9Kr4uyoVZoY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222589; 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=EN4QvUbAh4F1RyvXaWITXd7zkhtxEAPwE2nARm9y9T8=; b=GTMm7vAd0TLIFjFfW5rcixBXa/cB4mb31qcUHFqKAoAUvB0RltDjFnS85aUW610Kq8H0aZokdPpB4VNG34ABJZZp/2J58xOMQXsmPiuOb+xLDB3ytGJLe9tBFumSMF1EySFGg0AsT0zhSZKS/4kSUej1V2IandcGhFS26ag5uLA= 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 1615222589734117.86682825190667; Mon, 8 Mar 2021 08:56: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-176-TWZgOQqkNciZ1i3ISUeSSQ-1; Mon, 08 Mar 2021 11:56: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 5A3611842148; Mon, 8 Mar 2021 16:56:18 +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 3345519D9D; Mon, 8 Mar 2021 16: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 ED33957DC5; Mon, 8 Mar 2021 16:56:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GuFWL022941 for ; Mon, 8 Mar 2021 11:56:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id F00344278; Mon, 8 Mar 2021 16:56:15 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 255575D9DB; Mon, 8 Mar 2021 16:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222588; 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=EN4QvUbAh4F1RyvXaWITXd7zkhtxEAPwE2nARm9y9T8=; b=iuAhOfSVlFkAwVgfIQ89+TSW81lexBLz1FFNkS/lwKg70JSrJXJgaBuMQs4Fju8vFydKHx U1S0VZaDVymSNCZU1eUrC90VBIiRR16ec6abk8ydY/HJcwtUnAbW5jduZGFhzPlBYvHDaI J6Z9Db5KHkLPLflShY7RI9RD8E0zui8= X-MC-Unique: TWZgOQqkNciZ1i3ISUeSSQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 13/30] qapi/qom: Add ObjectOptions for filter-* Date: Mon, 8 Mar 2021 17:54:23 +0100 Message-Id: <20210308165440.386489-14-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 a34ae43cb9..6fe775bd83 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: # @@ -510,6 +641,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', @@ -553,6 +690,12 @@ 'cryptodev-vhost-user': { 'type': 'CryptodevVhostUserPropertie= s', 'if': 'defined(CONFIG_VIRTIO_CRYPTO)= && defined(CONFIG_VHOST_CRYPTO)' }, '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': { 'type': 'MemoryBackendMemfdPropertie= s', --=20 2.29.2 From nobody Sat May 4 20:55: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=1615222766; cv=none; d=zohomail.com; s=zohoarc; b=TbjdGTuvBqieEwlmtv2nGic//dD1zsqzJTg0aZ7omhcZme55mPyr88y4HhAwbMpfCnpTbOQZ45axIJufdefNnPDPXYcz1vH9KRPhaL+Zjh/j4O7RcXQ6cddeYtChs/7Mp8jIn2gB2YHZJvcUyq4PQvrQEusBWAMH3QurY4IkR3g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222766; 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=6Nl8RFf8EAHNlAq+0ppc/JSVVYHnYUTrEVm4qCv3AMM=; b=FMEaeI2qfZYvtjGv1jtQo5ZOL9PF822iijswvaGaFhWaACQ23u328Qyhht1OIZ2G7ZLg94KYiAi/ai5nxfE9udpodYbUjIwDT/0sPWPswAAJq9685QivZg4TG/0tcgyspysGUny51A8ZKAgb1uak5pwRdwsZhV7DAF6Zo+yUIlY= 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 1615222766755911.9292628202219; Mon, 8 Mar 2021 08:59:26 -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-473-ArbeTGiUM9e3opeTWb9bMQ-1; Mon, 08 Mar 2021 11:56:28 -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 1968DE576F; Mon, 8 Mar 2021 16:56: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 EBF945944F; Mon, 8 Mar 2021 16:56: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 B6F5157DC7; Mon, 8 Mar 2021 16:56:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GuJC2022970 for ; Mon, 8 Mar 2021 11:56:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2A2391B475; Mon, 8 Mar 2021 16:56:19 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 453D95D9DB; Mon, 8 Mar 2021 16:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222765; 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=6Nl8RFf8EAHNlAq+0ppc/JSVVYHnYUTrEVm4qCv3AMM=; b=IKjTYutMFqw3ljspMnD6g1GLUhwVBGe7bzxqWS9EaeaIbAAlbJKgPziXUWIaAfg/NI1hHi qOAwPEAJAUaOJ4TpDLvoeqGAtt3cwZQALGXGgQdSfqDZCYDFOYsOjviXZwqGQslqvpC1xQ Ac4RVjTxyCOnVqFG9jJ/3ZgjDUNVKv0= X-MC-Unique: ArbeTGiUM9e3opeTWb9bMQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 14/30] qapi/qom: Add ObjectOptions for pr-manager-helper Date: Mon, 8 Mar 2021 17:54:24 +0100 Message-Id: <20210308165440.386489-15-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 6fe775bd83..6afac9169f 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -577,6 +577,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: # @@ -651,6 +663,7 @@ 'memory-backend-file', 'memory-backend-memfd', 'memory-backend-ram', + 'pr-manager-helper', 'rng-builtin', 'rng-egd', 'rng-random', @@ -701,6 +714,7 @@ 'memory-backend-memfd': { 'type': 'MemoryBackendMemfdPropertie= s', 'if': 'defined(CONFIG_LINUX)' }, 'memory-backend-ram': 'MemoryBackendProperties', + 'pr-manager-helper': 'PrManagerHelperProperties', 'rng-builtin': 'RngProperties', 'rng-egd': 'RngEgdProperties', 'rng-random': 'RngRandomProperties', --=20 2.29.2 From nobody Sat May 4 20:55: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=1615222605; cv=none; d=zohomail.com; s=zohoarc; b=RL5WLxGTB5Txn0WiBMS2IrnXB9+YMEwUn92DQXiIehX7XWj+bXDoY+EEUdN+Cs0v34iIUD7swpdXIGOcclDQ5vjexPXOSJh1w4VzbnSD7Rv9V5l9lwQUke4/CsroogWk8JCoFdxaH4fjPi0YaBw0u/TA6ORPQ99tELGEObC36EM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222605; 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=tNUIEDl9OWLmdNqi7esqEGhgchqfWPXysNQIQUOen9A=; b=Wn8YqK2VJR4AxBVcoEzQ37r5z5/XRPt0OmomSKZviz+TzFiRSAbAuPl+pEViDgysEM+3rb+2NgqkxsQVL6toEFOuVSxtnU/4OFPzXzSuegR3u46vHGu4Q65fPrbhj6pdrhBYhSsiygpulSHSMKqHUZqn3CN7VA2IkpOdTaXXsgM= 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 1615222605241878.906005134392; Mon, 8 Mar 2021 08:56:45 -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-195-a-LcaU89NpW29JMVqpnikg-1; Mon, 08 Mar 2021 11:56:41 -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 CA27E1842142; Mon, 8 Mar 2021 16:56:34 +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 9F1FE10023B2; Mon, 8 Mar 2021 16: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 661FF57DC2; Mon, 8 Mar 2021 16:56:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GuVrf023057 for ; Mon, 8 Mar 2021 11:56:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1C0BC4EF69; Mon, 8 Mar 2021 16:56:31 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 730A25D9DB; Mon, 8 Mar 2021 16:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222604; 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=tNUIEDl9OWLmdNqi7esqEGhgchqfWPXysNQIQUOen9A=; b=a32jxkNxmxkhK0nTjze34haVSZveO00FtSfm1kjz2VCULRvveCHAd1Kmlng+fZR+F0oQO+ DQ2rzL7hKf7qk45ja3kHCZtmCb9uFUN0qeeRoXQklPJiFTeAmTCdQbx2h0lsH9FQALvSwo dxjG97YOKStiYyCS9v3TyJ2WLUKv9L0= X-MC-Unique: a-LcaU89NpW29JMVqpnikg-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 15/30] qapi/qom: Add ObjectOptions for confidential-guest-support Date: Mon, 8 Mar 2021 17:54:25 +0100 Message-Id: <20210308165440.386489-16-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 6afac9169f..ad72dbdec2 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -635,6 +635,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: # @@ -663,12 +695,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', @@ -720,6 +755,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 Sat May 4 20:55: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=1615222608; cv=none; d=zohomail.com; s=zohoarc; b=oFif3vkeFoGmnmfCEPV+55IiLdluoVSO5kKexcVPOd9jK1SUo9jIl4Q9ZRrhQULGjwplCzG8ABvxl7ifW3w1yx0Hmxd46BiHTANzdVkGz63i75zJInR3bjUvjAL5rX2OCLhXRezGS08mEDseQjRggbuHg8YdDF+EnU/TcRNER+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222608; 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=dwL4gLVY8vn+pPFBNx3wAc+MAMmKtIr/okI9h3N/fi4=; b=ObqnGHJTj3q3L8Q4Adjnc1XIlRWLmmWMCwbfaQxdO5pZvuaSsxl7YYORBGOaAEegjUwTIjpy4Cp4Rp3pCy6bKEwHZUd1DyvfN1QQNSRloiwfTbcKzK4nj7hf/2WgpP8fXp1Yz8p1h4DTpdHANF/YImyC38NBzq46kCmLOxOByaM= 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 1615222608477812.8163796560472; Mon, 8 Mar 2021 08:56:48 -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-107-gD01TE2_OU253JKLTeSGQQ-1; Mon, 08 Mar 2021 11:56:44 -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 1B1411054F9B; Mon, 8 Mar 2021 16:56:38 +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 ECFA75C5E1; Mon, 8 Mar 2021 16:56: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 AF28F1809C86; Mon, 8 Mar 2021 16:56:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GuYnv023078 for ; Mon, 8 Mar 2021 11:56:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3B5104EF6B; Mon, 8 Mar 2021 16:56:34 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 632525D9DB; Mon, 8 Mar 2021 16:56:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222607; 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=dwL4gLVY8vn+pPFBNx3wAc+MAMmKtIr/okI9h3N/fi4=; b=V8rgAyZk63PkNkX7RhZaAtCnuFMZlCqxGyWHd2ndPcWee9zP1CeiIGPVr6Be8gmA/HrEKA 0DL9+IwEBYXv73EjzeDq/X0jYg8zfZYxTxB5yOAuvZ9ZQxklkMVOKK/2ubrxmuStC3B087 a8/0iucgzAjy0XcQSvTou0dktUxJQ+0= X-MC-Unique: gD01TE2_OU253JKLTeSGQQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 16/30] qapi/qom: Add ObjectOptions for input-* Date: Mon, 8 Mar 2021 17:54:26 +0100 Message-Id: <20210308165440.386489-17-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ qapi/ui.json | 13 +---------- 3 files changed, 72 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 ad72dbdec2..6b96e9b0b3 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -444,6 +444,61 @@ '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 the 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: # @@ -691,6 +746,8 @@ 'filter-redirector', 'filter-replay', 'filter-rewriter', + 'input-barrier', + 'input-linux', 'iothread', 'memory-backend-file', 'memory-backend-memfd', @@ -744,6 +801,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': { 'type': 'MemoryBackendMemfdPropertie= s', 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 Sat May 4 20:55: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=1615222612; cv=none; d=zohomail.com; s=zohoarc; b=eiFUuV3X8FD8RfGUEhQ7bqz/WxEILda7TWz9b6ZOdKFT6DzFjUnMEJ00p7RoT5siq6MDvHBE8P0nL2rhXHYLRHpnflOmg7SVYd1lfNs47zxdyT/5cb5M6XX4CfwHbxv7cjDNmaE/C65aHD1MGBdSLNBxw8L/l+Y8uIB5betmB98= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222612; 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=qpf0/LGlVWZrXNfSIKntH8xfgEa3khRnEoKJszUrak4=; b=BqGfqSRhLXjwki4HmW5zb7TKQy5NkvKvOvlOkCikYJlNjFFlw93ajGWIEbbQLavzjwmsVr4cKsYpKarnXvnIyeUqvtD5J0ZmdO5QppiVurp6EJKG8uTknoEo7AlDLOtypCamGYrNrUqHj+s65TkBBlb9kVIfwH6LQ0gVNpN/EO0= 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 1615222612838862.8568990155399; Mon, 8 Mar 2021 08:56:52 -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-454-0qvp1QzcNo2umXGhUGW6Vw-1; Mon, 08 Mar 2021 11:56:47 -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 235E1108BD08; Mon, 8 Mar 2021 16:56:41 +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 F2EBB2CFB0; Mon, 8 Mar 2021 16:56:40 +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 BA3BA180065A; Mon, 8 Mar 2021 16:56:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GubsB023101 for ; Mon, 8 Mar 2021 11:56:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5AF7B22E53; Mon, 8 Mar 2021 16:56:37 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 852BD5D9DB; Mon, 8 Mar 2021 16:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222611; 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=qpf0/LGlVWZrXNfSIKntH8xfgEa3khRnEoKJszUrak4=; b=ZqhOYha4ltcHEp9ekEZgFRnkGWaxhd2s8Luvd8WpgkrEFDbJA5NIwvUjLmH24Rq4ok7A5w yuEz9nwdzeabd8nzZNTH5m+Bm5xeOJyegifpazARjmoLjKeFvYpgLbJclq/Z23DraWXrVT zWHdqOTM6YefVIQOf5g56zVSHyr+HVY= X-MC-Unique: 0qvp1QzcNo2umXGhUGW6Vw-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 17/30] qapi/qom: Add ObjectOptions for x-remote-object Date: Mon, 8 Mar 2021 17:54:27 +0100 Message-Id: <20210308165440.386489-18-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 6b96e9b0b3..0fd8563693 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -644,6 +644,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: # @@ -765,7 +779,8 @@ 'tls-creds-anon', 'tls-creds-psk', 'tls-creds-x509', - 'tls-cipher-suites' + 'tls-cipher-suites', + 'x-remote-object' ] } =20 ## @@ -820,7 +835,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 Sat May 4 20:55: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=1615222762; cv=none; d=zohomail.com; s=zohoarc; b=YHiieAmpZaAizGHJhFqrwW2Mra1JP0e7hqtWMZim4dwb7XY79IztOWd9mH9GNRRLbsoLhwjzejncjnLRQEtGkXxu4x1GBmE7p/vftUwki5lq20Pml3QfdTNI2pVfrxj0YbNjPfGdNu2cdxEfC2ttD8E8/MXR/T3iejeSHi71iDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222762; 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=yaVzR3CIb/IhxKfm+tM3X0sgzc3ZsPckmXm8Sq23LFA=; b=nWi/G/Oq213+0QuA44AyQeOGYMoXmJm5SrHWhIGgsX71e0KMngYGfkt7iH6nT2PbwsWDD7vlm4Z3rAMRGzOOet3QlLZx2GV8fA520tdNVYkYgF5D1BqnEERax2TRA10COKQRwuP0BVW0lNdFiLH9PKODsUxaMrcb+R9XGFBuBX4= 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 1615222762247416.50109663751596; Mon, 8 Mar 2021 08:59: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-535-oNU3SK3EOiS-DLSJGP6jag-1; Mon, 08 Mar 2021 11:56:48 -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 ED2151054F97; Mon, 8 Mar 2021 16:56:41 +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 CBD7360C17; Mon, 8 Mar 2021 16:56:41 +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 9722C57DC9; Mon, 8 Mar 2021 16:56:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128Gue0T023136 for ; Mon, 8 Mar 2021 11:56:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id A0B354EF6B; Mon, 8 Mar 2021 16:56:40 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id AADE95D9DE; Mon, 8 Mar 2021 16:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222761; 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=yaVzR3CIb/IhxKfm+tM3X0sgzc3ZsPckmXm8Sq23LFA=; b=YSFXgDY0OuApWw6Ps9CoMCPuQ/Q02MzhBiDriFYE1xjLKvk9ETp+gu5Lg4+xi4ISJkgMvO u4lwzykUaZZ0f3fUvZId1AkB6DDHX+r/8Xv3dTd1/p/qaeNrm0+mbkMo2NU7OExMseQEHM AKc5KI1A6AcQnfQcozV1HD1pjYmdrmw= X-MC-Unique: oNU3SK3EOiS-DLSJGP6jag-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 18/30] qapi/qom: QAPIfy object-add Date: Mon, 8 Mar 2021 17:54:28 +0100 Message-Id: <20210308165440.386489-19-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 0fd8563693..5b8a5da16f 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -844,13 +844,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 # @@ -864,9 +857,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 23756fc8e5..a1bcbacf05 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -148,8 +148,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 Sat May 4 20:55: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=1615222620; cv=none; d=zohomail.com; s=zohoarc; b=iRaZ3EJuVLblj93WNwbuc3g6LK5UJ4NwglUaryGL4o+j8zSV8tjBLyYQNSjS53S0x5OsoUKMTD1lyhsWBX1NYW1nL1NVytWtCvtmcLGA4KQGTTbFxxxUQsQ33oalF+RaDBm9JCOv4OIbV5iQRIms4CVe93I1fu1zHsjg8MyJIQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222620; 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=kKC+TrTt90R6cKk0TkKVIXqMP1xZ6HoVtnrCMm19AdA=; b=OaDKyp2A2U/M5rIhk9l6tiPR9uj0PQPQEkHejgEtVUbpiMfTai/xrKSJNyb+uDCffMS1NwqINPxzcNC2dZ/+ja7dtk4IaA2VEShsm8nhA0MyC10XK7RxkLjBHJOHLX0bFGdcJNPjZOJ+lM6HhEXK1jYYYp9cuQ/SDoouls2FVBc= 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 1615222620769518.266854105892; Mon, 8 Mar 2021 08:57:00 -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-125-DUM22PTlMjGqhrL1vR6S5g-1; Mon, 08 Mar 2021 11:56:57 -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 1D3DA1842145; Mon, 8 Mar 2021 16:56:51 +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 E9DEE10074EF; Mon, 8 Mar 2021 16:56:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AEECC180065A; Mon, 8 Mar 2021 16:56:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128Guoge023177 for ; Mon, 8 Mar 2021 11:56:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1D81922E53; Mon, 8 Mar 2021 16:56:50 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5DDE5D9DB; Mon, 8 Mar 2021 16:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222619; 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=kKC+TrTt90R6cKk0TkKVIXqMP1xZ6HoVtnrCMm19AdA=; b=cf9zY6I/JgMggCl1NVIBaI14xxI89P+jCF3MZ5ZS+65AmaIHZRi1ekuc1edvIjQvPCPnFc p0FF27u5bkwD+0yzi8d0aM/kmwZiiQfQ8UI7UX32EsgTgjo7ShLaQJSIK812JWZK5H7dUZ Sv9O7q89LcYJsrs8TQv/Dj21HjDrHA4= X-MC-Unique: DUM22PTlMjGqhrL1vR6S5g-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 19/30] qom: Make "object" QemuOptsList optional Date: Mon, 8 Mar 2021 17:54:29 +0100 Message-Id: <20210308165440.386489-20-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 7661270b98..d4df2334b7 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -299,6 +299,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 @@ -318,8 +319,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 Sat May 4 20:55:08 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=1615222625; cv=none; d=zohomail.com; s=zohoarc; b=SqZzafNrqkZGrjFPixu7zxdXYz+LYz4bDDp4lmlvUwKd2EHsxRLKeltzzWr03OW/1i9eyGYnJ0c6XI7M632JEHuArEZfXgKomKml5nALyhxN1487kiPlthFKeDWyMPtdBKC2D/dzwCuWrkfaXSdAklY0sqAfI52RU5D5OQIIktY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222625; 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=EkuUd2LMCxrtdi0zEIrPb/8mJLjvo49VX/SxPFjWD7s=; b=lB6wLDeD/I7kM0XfSxUbwlcby8bsuAK8/pnyupV+VmFrUfBoVTfIGpITb+pR58mU3V3b0yKcqOmpMgIgkxzFmskQ9t1z4LSKXjMs+KA+mJ/1X09L0frl2NSC7lcfLUhZwIIj4gQs+btfnXAlhgaMlAJNz/OdxHAyMIs24sT0U1A= 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 1615222625928350.49497873475275; Mon, 8 Mar 2021 08:57:05 -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-56-TL0iM_DBP2-7pHbw2s-MDA-1; Mon, 08 Mar 2021 11:57:01 -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 08F77184214C; Mon, 8 Mar 2021 16:56: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 D02931F405; Mon, 8 Mar 2021 16:56:54 +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 926E857DC3; Mon, 8 Mar 2021 16:56:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GurQj023196 for ; Mon, 8 Mar 2021 11:56:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 39CFB5D9DE; Mon, 8 Mar 2021 16:56:53 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 657A05D9D3; Mon, 8 Mar 2021 16:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222624; 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=EkuUd2LMCxrtdi0zEIrPb/8mJLjvo49VX/SxPFjWD7s=; b=Xw+i2NYqClMYsjOKxwJ2NTTFQvLv5G+agaInK0AeyrOzp+iggbNsGnXmBrRwGmBBNcdH4q Fn8pi16JQZXQMHslQMaxaR5JHkVm+vGuHyCM5thP3gEFUdk5WDHKnAxjFQ97IbeplEEVGn IJtUxEv3plHjaPIlWV0sJ4b24LBzgbk= X-MC-Unique: TL0iM_DBP2-7pHbw2s-MDA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 20/30] qemu-storage-daemon: Implement --object with qmp_object_add() Date: Mon, 8 Mar 2021 17:54:30 +0100 Message-Id: <20210308165440.386489-21-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 a1bcbacf05..4ab7e73053 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" @@ -134,15 +135,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); @@ -282,14 +274,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; } case OPTION_PIDFILE: @@ -338,7 +338,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 Sat May 4 20:55: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=1615222628; cv=none; d=zohomail.com; s=zohoarc; b=A74kRYRmFwA/Snw584aTUFPs23RfHiPvT0T+41b1gf8aRwpJvI8WG8HN60AfEZ8ip9eVPEFK98AdeZ9EMpjhY+m585XA1mv46DGd+WKi1svDOhCgNpOX7pNpxnsNADwyOLg1n/Gtwn3hoYDrOlisolbzw/q/oCclEeOw3ZnCqy0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222628; 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=QK3+wvFIX6xtoJ+rW3QuK/UFcrE7WWNUGx5TZzjc3o4=; b=Um8AxSS3mqOl6Sr1Bk+RGaWT1EksYuYW2SMR4GS0HAoPaLG8Fwp/MlJpVsqSnAbw5uI3ifyMOZmqWzHwnFY7WO8eFSg2ArCbat53tNQldlSIyUa791tIEkoXI+f6OjoLv/dP+TH97mT/P0DBiSw3N2Eps1bVULPO/TBcvkyA2vA= 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 1615222628161199.4368965822539; Mon, 8 Mar 2021 08:57: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-589-L6vw5WYlOGOWTjFA7l0HUg-1; Mon, 08 Mar 2021 11:57:04 -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 25B1E814315; Mon, 8 Mar 2021 16:56:58 +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 F30C45D9DB; Mon, 8 Mar 2021 16:56:57 +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 AFB4B180100F; Mon, 8 Mar 2021 16:56:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GuujB023208 for ; Mon, 8 Mar 2021 11:56:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5F17D4EF68; Mon, 8 Mar 2021 16:56:56 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82BA45D9D3; Mon, 8 Mar 2021 16:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222627; 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=QK3+wvFIX6xtoJ+rW3QuK/UFcrE7WWNUGx5TZzjc3o4=; b=cTW5ZJebesCaYihp1T9Mri/eTUkhMFQMPhjWajt1z9Xb/BAADGCEkgqU2X1+h+GnK+j3GB B+YtC9CrK0ZHn6ZyxMjjGpDKJEhveYnuDexpRPdKXlBDorBXt5bioEtIiGWZm5Okq3yE+e v6LdrNJsnexIBg4XookjwCnC0W/cNMg= X-MC-Unique: L6vw5WYlOGOWTjFA7l0HUg-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 21/30] qom: Remove user_creatable_add_dict() Date: Mon, 8 Mar 2021 17:54:31 +0100 Message-Id: <20210308165440.386489-22-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 d4df2334b7..02c3934329 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -113,38 +113,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 Sat May 4 20:55: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=1615222633; cv=none; d=zohomail.com; s=zohoarc; b=UOgPO/oJEgQYfkNMKlse9a8JxM0XpViZ+UUvnnXCpZ4jhmT4eYnFMJ/beJkRGwu9i/9zud2L/sPaFK3gnIlDcqEKlsxBWFYMPs2HYD6NMDeh+eqHEtQQZtCHAEJAqw8VveOnwrjgZWZo7yBLEwhQDSNEQkuivj3bNEbpOLfVlVY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222633; 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=8Ja//W/Gt4gxi6aUofmMTr/hAxmtkhEOSxzKVDmqtfQ=; b=DD8Kq0R2A153MiTwpCPN8tzI8uGTewiQUlFP3tSLGjJvh5dMDzTUB6xlhEMZPP1UnpXk5TvjS+AMbg3/X8uNZmBCExOCGPg5dc3SifarFdvsHnYLpozxo2VxzWUF6M55t9LR/BWXS6qcZsF5cbp7dnceTYQmem2YDbSp1VFto0s= 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 1615222633168664.1396955771754; Mon, 8 Mar 2021 08:57: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-294-pl5eR-bEN8qGdYlTyZK7AQ-1; Mon, 08 Mar 2021 11:57:07 -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 1C37881431C; Mon, 8 Mar 2021 16:57:01 +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 E8C5160939; Mon, 8 Mar 2021 16:57: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 AADC21801017; Mon, 8 Mar 2021 16:57:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GuxPU023229 for ; Mon, 8 Mar 2021 11:56:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7DCB01B475; Mon, 8 Mar 2021 16:56:59 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A64C55D9D3; Mon, 8 Mar 2021 16:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222632; 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=8Ja//W/Gt4gxi6aUofmMTr/hAxmtkhEOSxzKVDmqtfQ=; b=GK8K8JkaoIkaI1mzbl+hton4te/u7/F7AmH9potwSY0JfudKekqgP6e96n1n57NugFLM5h KA6cr3iQH1mCvVJud+efS4lejVaX8NDGsy+TzjLa3qfMF1sn9su+U/Gtyqcf3IdEn6FrPX GcSc1HowIMpHDnMLtecfLyDsTC/ws0E= X-MC-Unique: pl5eR-bEN8qGdYlTyZK7AQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 22/30] qom: Factor out user_creatable_process_cmdline() Date: Mon, 8 Mar 2021 17:54:32 +0100 Message-Id: <20210308165440.386489-23-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 | 24 ++----------- 4 files changed, 80 insertions(+), 55 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 02c3934329..2eaf9971f5 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/id.h" @@ -113,6 +116,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; @@ -256,7 +282,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 @@ -265,6 +291,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 4ab7e73053..5341a494a6 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" @@ -271,27 +270,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); - break; - } + user_creatable_process_cmdline(optarg); + break; case OPTION_PIDFILE: pid_file =3D optarg; break; --=20 2.29.2 From nobody Sat May 4 20:55: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=1615222639; cv=none; d=zohomail.com; s=zohoarc; b=Tb+ELcPJb7kYJDJEULPfG98HLJtYtS8aemk0azTphVajVJeFHgRYAVLsEpQEBFI4D6GEV1uLxoUdTHNeAR7AZkD1BFswSnU/sE53SUj6dEncz0Xt5VWAcORwn9TzCusfTeOTuCmox/nMOV0hMeUm7qngQkpbjkxxP8PwwOMAho0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222639; 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=fDIbs5uQHuyfOCfukvdD7zDHBerAQWCKLrNHJGQGNrw=; b=Np7jvh1hJLsCkqMAm0oQ9LWrdLXIMTOB3BDiUkY3eSVP6TaicklSAsepP3WJJOA0tWmV6aTreYOCnIAVhxPCyGr91+vXDbGrCt7bWh2AwCXpoQ8yB14fIkOnKUZhqYUdI+3ep5bg4N5ivPuMFctw0pYyHyBLzFjJ2ydP8cv9gNk= 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 161522263955369.29992261692485; Mon, 8 Mar 2021 08:57:19 -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-552-QeTOta6lPeG-Sy3_1WgGTg-1; Mon, 08 Mar 2021 11:57:16 -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 1F8E184BA52; Mon, 8 Mar 2021 16:57:11 +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 F18605D756; Mon, 8 Mar 2021 16:57:10 +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 BA4A857DCA; Mon, 8 Mar 2021 16:57:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128Gv9cC023350 for ; Mon, 8 Mar 2021 11:57:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 869CB4EF6B; Mon, 8 Mar 2021 16:57:09 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4CFE5D9DB; Mon, 8 Mar 2021 16:56:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222638; 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=fDIbs5uQHuyfOCfukvdD7zDHBerAQWCKLrNHJGQGNrw=; b=eH2Wv3euEeYCLwOyPNb3QDH0QC56Km2Le/s8pbwEzW6ODnpyhQRoTdl3oDfO/9smBBaAkl 28vKNoWuUWfJ0mGKIDCRtwpg/GlXjef4R+4fxK6dVmQIbxdNdF8Rb1vMN5Wori2MAGtgOL qgF/xe/j6BORe46Tkv5SN8bt0OWbIQs= X-MC-Unique: QeTOta6lPeG-Sy3_1WgGTg-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 23/30] qemu-io: Use user_creatable_process_cmdline() for --object Date: Mon, 8 Mar 2021 17:54:33 +0100 Message-Id: <20210308165440.386489-24-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 Sat May 4 20:55:08 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=1615222649; cv=none; d=zohomail.com; s=zohoarc; b=XlrWT4tyAhup3f8W1L5LbXmkTTk7GEGUfYtBgJnPQlJAy6TCg92E44peVUqfkRAGbGnvimI6UvA0dOxIh+7IdBLBkveQTk0Ojn3HMJRSNuTAcKo+O2Il66zYxSWgrt1BB4PaX1C07U/JNrRybnyLRF3TLVCVSsKULiXEF905WVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222649; 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=7uzptcsSpRnK2BA5t93RO71hnGZLwADp8OucKjUMVE0=; b=ep73zQS1pTtrzej5Ck4T9KDV5eokaJQS58ZyritsNZb08PmG14V0kiUpObjVvv3XMJt0tztJnzokxSCiBGIrZu/kjH/8kJIZ7NsLkKTE8M3ez5LV2PjrjmS+laYXnxqNbvanYzPHc7vGOq7RVtByRri8yQcp+hb6+W2fWrAcI3Y= 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 1615222649598607.0490656981191; Mon, 8 Mar 2021 08:57: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-136-4v5-2cOvNAaverQrXKm0jw-1; Mon, 08 Mar 2021 11:57:20 -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 0364687A826; Mon, 8 Mar 2021 16:57:15 +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 D255F60C04; Mon, 8 Mar 2021 16:57:14 +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 9108E180065A; Mon, 8 Mar 2021 16:57:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GvDVk023387 for ; Mon, 8 Mar 2021 11:57:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id B69374EF68; Mon, 8 Mar 2021 16:57:13 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D05CE5D9DB; Mon, 8 Mar 2021 16:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222648; 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=7uzptcsSpRnK2BA5t93RO71hnGZLwADp8OucKjUMVE0=; b=Ol161Mi4x/b5j+CrCJyRPMtTf9zQRbZ/6kzJVZWyuHEmXo4q/O6qKqOZEZiROFtIZMDY8l VJ1JNLMeYui28Z1CaFA37sazJ88q3OvCCQSakxRQ4UKjlwG7/2vWbZBxXfF8CuP0ZYgDrl IjKBCOERiKpkBsWj2RiZYZpbtA0HV34= X-MC-Unique: 4v5-2cOvNAaverQrXKm0jw-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 24/30] qemu-nbd: Use user_creatable_process_cmdline() for --object Date: Mon, 8 Mar 2021 17:54:34 +0100 Message-Id: <20210308165440.386489-25-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 Sat May 4 20:55: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=1615222649; cv=none; d=zohomail.com; s=zohoarc; b=Hz/L154MZ759f9RDgoHD9eAqkXPpg9jPimeBSKnLvxyaj/y+cT1g4NWfKd08BqIuDtwysnz7Hn5Rvk6cRAZokoUaYjNu1zIg+LNpSYSwasiuN5A+jfyfbv55GFoKDcK6xo9rdfsk35IAzJ9yGuJNcbtbVzyBeSOLvUEv63WyCUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222649; 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=vr8VoZtFr/wcWW4bSPGG3rSKLlB5n8W4mFsvPa4ppyA=; b=WxBa9k9H6pEtKoEjT7p3Ose6thAYXy9nat4MZq2wBE+26Z0rJGd2qjW2jwREd1YNlml9Tbgbi5PcQwmigN34qFCjIYKXfCsHn2x0jLrizo/9i/LWvThAzUxooLhZEKCVB8Y3Yga3qRApVmRyeeisjuK5yNc37OQmNofM3/CNdio= 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 1615222649468606.801763174315; Mon, 8 Mar 2021 08:57: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-21-sIfTDwQPN56uOLl7LmMJow-1; Mon, 08 Mar 2021 11:57:26 -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 7B9BE184214B; Mon, 8 Mar 2021 16:57: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 2D6445D9DE; Mon, 8 Mar 2021 16:57: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 E69211803B33; Mon, 8 Mar 2021 16:57:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GvGWX023408 for ; Mon, 8 Mar 2021 11:57:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id E3F944EF6B; Mon, 8 Mar 2021 16:57:16 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A7875D9DB; Mon, 8 Mar 2021 16:57:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222648; 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=vr8VoZtFr/wcWW4bSPGG3rSKLlB5n8W4mFsvPa4ppyA=; b=De2SSrp0R86M00NVP0RZ8phsH9JMJeRcn1sju/iWamNtAGxHZjhuxTTYB2WvNvXJGL7kFU SKgaf1JDVbSyg3iHwhZ9kaKZsmfmDskJGoVPHBxGCVho7DUaqp8YC/qKpyOVtFaxNErY2/ HLlkPIMSQCtq7+va+nxKYsQX4UqqXNw= X-MC-Unique: sIfTDwQPN56uOLl7LmMJow-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 25/30] qom: Add user_creatable_add_from_str() Date: Mon, 8 Mar 2021 17:54:35 +0100 Message-Id: <20210308165440.386489-26-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 2eaf9971f5..bf9f8cd2c6 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -291,26 +291,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 Sat May 4 20:55: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=1615222653; cv=none; d=zohomail.com; s=zohoarc; b=Y/tFvYBD3kCk/zjjc/VcAKq7uHDGpNTaPvmMYoc8BSvnEUkHTcf61xw38na774952dNiaw38dD5zd5odbVnOWDp0v+ulYwoXDXDnaN0XvSdXoEt4IW0xItuO9om8/pnDEz8IgpWBCWpOLVS1F/1WTt9Aa+48YJjjjjnmp2/h51s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222653; 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=zVswTZKJvVeoKs8GPaK0rQr8n0QuukeZ5MMLklLAX28=; b=OxIseFn/efYNpmLgORTwUd+f4gxbAzLB826ZnpaRydTrcGI6FBXPfsnHEsyPy4jWE952jsJPJ0y+B6I8YcM5I05hR3L9X8BmKe5MKSroWyf55YE4828Jr/JdJFqXgUCZFtA6EcVkerf0yLPP0Lfj5mZGYS/tBH/bC+eG6g48uK0= 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 1615222653746942.3470912200202; Mon, 8 Mar 2021 08:57: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-303-8kcBjb3MNLWQGMbhHpB3nQ-1; Mon, 08 Mar 2021 11:57:29 -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 7DBEA84BA53; Mon, 8 Mar 2021 16:57: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 4ECB11F408; Mon, 8 Mar 2021 16:57: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 16D8457DC8; Mon, 8 Mar 2021 16:57:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GvKo1023487 for ; Mon, 8 Mar 2021 11:57:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 209BD4EF68; Mon, 8 Mar 2021 16:57:20 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3BCCC5D9DB; Mon, 8 Mar 2021 16:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222652; 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=zVswTZKJvVeoKs8GPaK0rQr8n0QuukeZ5MMLklLAX28=; b=HpvTKfI1zcNEEsfZJbIsNEU/1bK8DfbPDiGvdnmuQsedWLLn5kOG+HY20AwsBYgEnE1yB6 8wBgq44lJRiqiXSSoCFfcMe380liwoVFsP5Noy+fykfevwXejqyB12xMLSjAZUkl8L7v4W PD2JR/4F9z21Z/GmHQJqlTMZkqzY7kg= X-MC-Unique: 8kcBjb3MNLWQGMbhHpB3nQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 26/30] qemu-img: Use user_creatable_process_cmdline() for --object Date: Mon, 8 Mar 2021 17:54:36 +0100 Message-Id: <20210308165440.386489-27-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 Reviewed-by: Eric Blake --- qemu-img.c | 251 ++++++++++------------------------------------------- 1 file changed, 45 insertions(+), 206 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index e2952fe955..babb5573ab 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) { @@ -1353,7 +1303,7 @@ static int check_empty_sectors(BlockBackend *blk, int= 64_t offset, /* * Compares two images. Exit codes: * - * 0 - Images are identical + * 0 - Images are identical or the requested help was printed * 1 - Images differ * >1 - Error occurred */ @@ -1423,15 +1373,21 @@ 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; + case OPTION_OBJECT: + { + Error *local_err =3D NULL; + + if (!user_creatable_add_from_str(optarg, &local_err)) { + if (local_err) { + error_report_err(local_err); + exit(2); + } else { + /* Help was printed */ + exit(EXIT_SUCCESS); + } + } + break; } - } break; case OPTION_IMAGE_OPTS: image_opts =3D true; break; @@ -1450,13 +1406,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 +1590,6 @@ out2: blk_unref(blk1); out3: qemu_progress_end(); -out4: return ret; } =20 @@ -2342,15 +2290,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 +2320,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 +2907,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 +2929,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 +3138,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 +3160,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 +3298,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 +3312,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 +3445,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 +3469,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 +3859,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 +3883,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 +4062,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 +4077,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 +4629,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 +4637,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 +4894,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 +4941,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 +5161,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 +5191,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 +5330,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 Sat May 4 20:55:08 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=1615222683; cv=none; d=zohomail.com; s=zohoarc; b=eKBAlXTJgkSDO2Mrwy0vQd+19MxtgsNpsLTOAecs+Q7VzuTZ5IT5279HfGIsoHSd7IyAvxJPH+ORDAVB0TXhAvOSsiVBUeokU+iN99ep9CmQhocjD6YDKlFhHZfrXV7zM+WFqN1UQvB+YFdg7r3GS6e1MeBeiK0IEYopl1W0gu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222683; 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=Dd3Td0Xq/JcVavqBuvBYoBEy3ShLuRiPsgZQe5TP5vU=; b=hG4UwRsC75t8tMdy29C2Zvo9rG5h4WvbKmOUW4hfIX7PmzeJ2KMIqwouhNA7FHcmw6mOC0rp3Z0MxxZlAivXYMU8wfyFJWFRy6v9io2/dv7Mdf6QVzRnlhFE7zAG6noqfG53IH8/X4/am6Tf/sbJaU66wjTN3iic+wuGAWr7yNY= 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 1615222683971527.5305501416325; Mon, 8 Mar 2021 08:58:03 -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-14-vJgCj9S1O82Fp1-b-XaVnQ-1; Mon, 08 Mar 2021 11:58:00 -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 E68531085987; Mon, 8 Mar 2021 16:57:54 +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 BC79F1002EE6; Mon, 8 Mar 2021 16:57:54 +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 838D74BB40; Mon, 8 Mar 2021 16:57:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GvrK7023729 for ; Mon, 8 Mar 2021 11:57:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 683576C92D; Mon, 8 Mar 2021 16:57:53 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68CFF5D9DB; Mon, 8 Mar 2021 16:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222683; 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=Dd3Td0Xq/JcVavqBuvBYoBEy3ShLuRiPsgZQe5TP5vU=; b=Xo4CzijkddYoGE1q8a+TcEzXbaXtB8mWZHYMD8lYf2M0ML5Il1IEI9pSiK0uOvD7q/U4vL rXdARHXowWRDswCZzMAEkCGisG39eRzPwmCKwNxTqfHMey3iXxWjkv0SI3+xrw0h78/ufX zi+8K2xfGgtKUhjhBr+j9hhhs4ESySE= X-MC-Unique: vJgCj9S1O82Fp1-b-XaVnQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 27/30] hmp: QAPIfy object_add Date: Mon, 8 Mar 2021 17:54:37 +0100 Message-Id: <20210308165440.386489-28-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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: Eric Blake Reviewed-by: Dr. David Alan Gilbert --- 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 bf9f8cd2c6..6dcab60f09 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -14,6 +14,7 @@ #include "qemu/id.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 @@ -221,11 +222,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); } @@ -256,12 +257,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 Sat May 4 20:55: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=1615222747; cv=none; d=zohomail.com; s=zohoarc; b=PwgfJwRJ1VjiPhDQ5CcbM+27ehi4sWvXEMiYftuST0J0m3l+bPiIJYaGARiqsrjYQW1q76z0BuqiDWAgzVdlFDPusyU7Z1WFUELG375bjMcq8F3HTMNjn8jcnV+mtYF/709vOKH5x6iYNcYp7QRJIvCbDzftAaytp1dpEeixs1k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222747; 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=+NhKB09cltNik9nPFX/Lufn/xJNp2jwQ7EzFNhx4MLk=; b=LYybbXJ0qZL1F2IW/FxUxaaWPFa4yCUwbXgw3yO8fl7ykyVu7ukWG78jGVFVjFCKakAXbwp5OxxTPMj3a814Ye9cShx7wJMJBUJiqRYK3cSoqnl1WFETx1q7JVtAXeRMzdJdWCpZUdeTNlzgJMZIv//tG8rl1zC+VYHOkj1FOcM= 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 1615222747850511.538281889058; Mon, 8 Mar 2021 08:59: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-66-HgdP3jMhPDO6Ib9FoRoeyA-1; Mon, 08 Mar 2021 11:58:04 -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 0ECE2881290; Mon, 8 Mar 2021 16:57:58 +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 E06182BFEE; Mon, 8 Mar 2021 16:57:57 +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 A49E31809C8B; Mon, 8 Mar 2021 16:57:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128Gvubn023746 for ; Mon, 8 Mar 2021 11:57:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8A9344278; Mon, 8 Mar 2021 16:57:56 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A84A14EF6B; Mon, 8 Mar 2021 16:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222746; 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=+NhKB09cltNik9nPFX/Lufn/xJNp2jwQ7EzFNhx4MLk=; b=RmQ6A3H63/Dkzw0deRZ7zQIrEXcpHBjNX4JL+/2RWF7prpWTw7IWCglA4IK/7ivNwbSkOC bgw0DSQiMDK2QpgdvBRiA6vF3CA9zmby9VcQ44NaAuqVHWZE4gyhWsRzZlLFy+t8kBzJCe 4H+XZJGht/g8NggYUbL5hrAZq8zqSVo= X-MC-Unique: HgdP3jMhPDO6Ib9FoRoeyA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 28/30] qom: Add user_creatable_parse_str() Date: Mon, 8 Mar 2021 17:54:38 +0100 Message-Id: <20210308165440.386489-29-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 6dcab60f09..62d7db7629 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -292,7 +292,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; @@ -302,12 +302,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)); @@ -315,12 +315,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 Sat May 4 20:55:08 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=1615222690; cv=none; d=zohomail.com; s=zohoarc; b=kWZD2mn8DHBMtzC7fUrtNTinInMLrGYqs/5+uwmuMKhLCwDd9TLYhiB9vv40JP0jYB+td5d9PFe5HrcA3Je5wHZETju2mDvymjq+rreuPo9AsUO2Pljcdrm3z7LkgA0XYWAuoj6sMXjcs0jYahUwLX5gzCcXE5X9HUvRx8tRaWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222690; 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=U2lSnNsPwR0bJj2hS431ZPVo0xKvvYRSbNR2WdbqfM8=; b=IjfeFzpOwXR3nNOqCjIfGRpp0xme9mfDGEazheoQpu7KuMFM0c7M6Xlpd9/msntsvc0XOaZn8STOW1CQei5ZFvknMYKTcuRc91aIdtPnOlp6NttCzkIBo6P0uwX8zhMEkRG5qEnwlf9f7Gx79aXS2T6qvZhzhsxzSUUNB75+Ji0= 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 1615222690684360.79814080818016; Mon, 8 Mar 2021 08:58:10 -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-74-1Old-SxsMxePdPOKgE6k6Q-1; Mon, 08 Mar 2021 11:58:06 -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 7323D19253D5; Mon, 8 Mar 2021 16:58:01 +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 510892BFEE; Mon, 8 Mar 2021 16:58:01 +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 1870E1809C8B; Mon, 8 Mar 2021 16:58:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128GvxSh023759 for ; Mon, 8 Mar 2021 11:57:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id BA9085D9DE; Mon, 8 Mar 2021 16:57:59 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D51015D9D3; Mon, 8 Mar 2021 16:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222689; 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=U2lSnNsPwR0bJj2hS431ZPVo0xKvvYRSbNR2WdbqfM8=; b=QDzNknjx/YKc2unokMiu+2JPBR64VhB8cnR9pXsIFQkc4pSUY8KX81+wE1ItmhLv61WGwQ GgQHVtMvswVvbP1YUqLNU7xoNi/HNlvX0d5H2/l95vVJlSrvLKJugLDgfbB0Og5DwSXHmJ /4Syja3howNFQKTNUkkzyRtbIdeUKl0= X-MC-Unique: 1Old-SxsMxePdPOKgE6k6Q-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 29/30] vl: QAPIfy -object Date: Mon, 8 Mar 2021 17:54:39 +0100 Message-Id: <20210308165440.386489-30-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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 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 10bd8a10a3..deb061cc78 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); @@ -3408,12 +3457,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 Sat May 4 20:55: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=1615222692; cv=none; d=zohomail.com; s=zohoarc; b=RROtTigV/Vc+Zpvdo5taubiSUTKNukjwz3K0jOcUoIyX0HeXp/vMDLsBjYrsBJEyV9Z9Uy3D1f483Q/2hG4y2ynR7hsXGQkNAiUGSnZ/K3PTLEbMA2wTjEVU0BA15Y77zwF9V1l/zKBaaIvA+tlpJsYty+omTKaEAfVnxkQJOhI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615222692; 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=imZ7YjcXDzoMY8quRB7d3LxIRp/S2IADptLGUD4685o=; b=Q5aaUxfJBaK5m5tmmCHMDHVgqkdGFMkzPFUzE/nKkHuCMBSmjzz3R2JZ6JJgUGvlYxtThJq1UeAl/k0vMON1Hw4g2F48/Az6OSJ11X3b1XrKthlNK68ZdoJjvt4+E26uk/3pH721kZQcaZhG4NCROR+zFNi6RLvJPsMkeR2TRq4= 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 1615222692991305.9309754995106; Mon, 8 Mar 2021 08:58: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-410-t2wyAmAsPrG0X18uNBA-mQ-1; Mon, 08 Mar 2021 11:58:09 -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 5A1B010866A6; Mon, 8 Mar 2021 16:58: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 2A74B22E53; Mon, 8 Mar 2021 16:58: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 D78DF57DC2; Mon, 8 Mar 2021 16:58:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 128Gw2JW023777 for ; Mon, 8 Mar 2021 11:58:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id EAC901B580; Mon, 8 Mar 2021 16:58:02 +0000 (UTC) Received: from merkur.fritz.box (ovpn-112-100.ams2.redhat.com [10.36.112.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 104885D9D3; Mon, 8 Mar 2021 16:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615222691; 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=imZ7YjcXDzoMY8quRB7d3LxIRp/S2IADptLGUD4685o=; b=Pe3zf4/w3O6x1ohIML8daNmAhzCN+DOeHfX/JVMT67SrKfy5LEkp4UFD0JQH0T5OJxhSwG X39kfRjBDqOcT0A2rqf4MZ82bSWaaWf28a2kMp8MeLlfj2+VWWFAWBAdF/sxNR5dJvX1HK 7BptyYq/019fgGNbA/MPm/4ce4tlpAs= X-MC-Unique: t2wyAmAsPrG0X18uNBA-mQ-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v3 30/30] qom: Drop QemuOpts based interfaces Date: Mon, 8 Mar 2021 17:54:40 +0100 Message-Id: <20210308165440.386489-31-kwolf@redhat.com> In-Reply-To: <20210308165440.386489-1-kwolf@redhat.com> References: <20210308165440.386489-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, 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" 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 62d7db7629..61d6d74a26 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -10,13 +10,10 @@ #include "qapi/qobject-input-visitor.h" #include "qapi/qobject-output-visitor.h" #include "qom/object_interfaces.h" -#include "qemu/help_option.h" #include "qemu/id.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) { @@ -140,60 +137,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) { @@ -269,20 +212,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"); @@ -343,7 +272,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 @@ -359,15 +287,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