From nobody Sun May 19 03:38:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553797798449921.5105896996472; Thu, 28 Mar 2019 11:29:58 -0700 (PDT) Received: from localhost ([127.0.0.1]:40347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9Zml-0007Gp-HJ for importer@patchew.org; Thu, 28 Mar 2019 14:29:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9ZlM-0006Wb-4t for qemu-devel@nongnu.org; Thu, 28 Mar 2019 14:28:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9ZlK-0004jH-P1 for qemu-devel@nongnu.org; Thu, 28 Mar 2019 14:28:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35542) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h9ZlF-0004hR-KQ; Thu, 28 Mar 2019 14:28:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D4996C057F4F; Thu, 28 Mar 2019 18:28:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-148.ams2.redhat.com [10.36.116.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C46560C70; Thu, 28 Mar 2019 18:28:19 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 28 Mar 2019 19:28:09 +0100 Message-Id: <20190328182810.21497-2-kwolf@redhat.com> In-Reply-To: <20190328182810.21497-1-kwolf@redhat.com> References: <20190328182810.21497-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 28 Mar 2019 18:28:20 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/2] qmp: Add query-qemu-features X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, armbru@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Stefan Hajnoczi QMP clients can usually detect the presence of features via schema introspection. There are rare features that do not involve schema changes and are therefore impossible to detect with schema introspection. This patch adds the query-qemu-features command. It returns a struct containing booleans for each feature that QEMU can support. The decision to make this a command rather than something statically defined in the schema is intentional. It allows QEMU to decide which features are available at runtime, if necessary. Signed-off-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- qapi/misc.json | 23 +++++++++++++++++++++++ qmp.c | 10 ++++++++++ 2 files changed, 33 insertions(+) diff --git a/qapi/misc.json b/qapi/misc.json index 8b3ca4fdd3..d892f37633 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -3051,3 +3051,26 @@ 'data': 'NumaOptions', 'allow-preconfig': true } + +## +# @QemuFeatures: +# +# Information about support for QEMU features that isn't available through +# schema introspection. +# +# Since: 4.0 +## +{ 'struct': 'QemuFeatures', + 'data': { } } + +## +# @query-qemu-features: +# +# Return the features supported by this QEMU. Most features can be detected +# via schema introspection but some are not observable from the schema. Th= is +# command offers a way to check for the presence of such features. +# +# Since: 4.0 +## +{ 'command': 'query-qemu-features', + 'returns': 'QemuFeatures' } diff --git a/qmp.c b/qmp.c index b92d62cd5f..0aad533eca 100644 --- a/qmp.c +++ b/qmp.c @@ -717,3 +717,13 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp) =20 return mem_info; } + +QemuFeatures *qmp_query_qemu_features(Error **errp) +{ + QemuFeatures *caps =3D g_new(QemuFeatures, 1); + + *caps =3D (QemuFeatures) { + }; + + return caps; +} --=20 2.20.1 From nobody Sun May 19 03:38:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553797945922723.1577618807079; Thu, 28 Mar 2019 11:32:25 -0700 (PDT) Received: from localhost ([127.0.0.1]:40400 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9Zp9-0000qT-0K for importer@patchew.org; Thu, 28 Mar 2019 14:32:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9ZlM-0006Wc-4w for qemu-devel@nongnu.org; Thu, 28 Mar 2019 14:28:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9ZlK-0004jM-RE for qemu-devel@nongnu.org; Thu, 28 Mar 2019 14:28:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35110) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h9ZlH-0004i9-A3; Thu, 28 Mar 2019 14:28:23 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 944B83078AAC; Thu, 28 Mar 2019 18:28:22 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-148.ams2.redhat.com [10.36.116.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C5786107F; Thu, 28 Mar 2019 18:28:21 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 28 Mar 2019 19:28:10 +0100 Message-Id: <20190328182810.21497-3-kwolf@redhat.com> In-Reply-To: <20190328182810.21497-1-kwolf@redhat.com> References: <20190328182810.21497-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 28 Mar 2019 18:28:22 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/2] Add file-posix-dynamic-auto-read-only feature X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, armbru@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" auto-read-only=3Don changed its behaviour in file-posix for the 4.0 release. This change cannot be detected through the usual mechanisms like schema introspection. Add a new feature to query-qemu-features to allow libvirt to detect the presence of the new behaviour. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- qapi/misc.json | 7 ++++++- qmp.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/qapi/misc.json b/qapi/misc.json index d892f37633..df23c54a65 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -3058,10 +3058,15 @@ # Information about support for QEMU features that isn't available through # schema introspection. # +# @file-posix-dynamic-auto-read-only: +# true if auto-read-only=3Don means that the image file is dynamically r= eopened +# read-only or read-write depending on whether any writers are attached = to +# the node. +# # Since: 4.0 ## { 'struct': 'QemuFeatures', - 'data': { } } + 'data': { 'file-posix-dynamic-auto-read-only': 'bool' } } =20 ## # @query-qemu-features: diff --git a/qmp.c b/qmp.c index 0aad533eca..2a887c1e7d 100644 --- a/qmp.c +++ b/qmp.c @@ -723,6 +723,7 @@ QemuFeatures *qmp_query_qemu_features(Error **errp) QemuFeatures *caps =3D g_new(QemuFeatures, 1); =20 *caps =3D (QemuFeatures) { + .file_posix_dynamic_auto_read_only =3D true, }; =20 return caps; --=20 2.20.1