From nobody Wed Jun 24 21:39:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1781866382; cv=none; d=zohomail.com; s=zohoarc; b=bGAhlJE/O0tuk8BBv00ye02856/a4H5YyXEekmeTIFCCrOiEYOpaOCvofsqE97c8Q+8jOT2MCoS/gBa22Rvi0gT2BHY4leti7RfBvzWK+tzjSVP7/FA8n0Ic2r4dA/cdV8Kw4a50KmSIb1bmZ4/fdHCun4miV7qsRi8WcQgfHqA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781866382; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=dRUOID+G3hz2lHiptYIKA8QlyZ5Cky2uk951gryF3Xw=; b=gx7xfNs8wKT7bgxzQyujCIF2u/R74+5lkg5/cdW/HqGxO9lag+SRtkX+MaOulxR3vufKZciLU0lnrQGZ8tJABXshIdIsZ1Y4G3jZkUQe9QrFXunAAxwPtOyrzIOUFQfjcLLBzKWQHV+iqdbHwj5eYCL5lAe6mp9CjO2D8QV0Cow= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1781866382386537.6903774084556; Fri, 19 Jun 2026 03:53:02 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 0ED7C41D4F; Fri, 19 Jun 2026 06:53:01 -0400 (EDT) Received: from [172.19.199.7] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id A876141CE0; Fri, 19 Jun 2026 06:51:06 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 3EE8241C8C; Fri, 19 Jun 2026 06:50:50 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 8AAAB41BC7 for ; Fri, 19 Jun 2026 06:50:49 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-102-wfQOaCF8MQS0XASC6qzbFg-1; Fri, 19 Jun 2026 06:50:46 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AC1901955D99 for ; Fri, 19 Jun 2026 10:50:45 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.24.18]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D6B4018005B6 for ; Fri, 19 Jun 2026 10:50:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781866249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dRUOID+G3hz2lHiptYIKA8QlyZ5Cky2uk951gryF3Xw=; b=QA9JVYz1k2KVbQC9chZuJHiCa3iFF6j9c6LqJfGnZLtAcw470CmX7AISp22D5z3/W1/pNz fELDbrkyCdAG8vMjHzN0dwoEYM90gWU0parpm9J6dack8aVmircbPMMCXX2LwO5zTdHMMT 4PPCK/VU4aAjZRys0mChZ7m1+RLHwxI= X-MC-Unique: wfQOaCF8MQS0XASC6qzbFg-1 X-Mimecast-MFC-AGG-ID: wfQOaCF8MQS0XASC6qzbFg_1781866245 To: devel@lists.libvirt.org Subject: [PATCH v3 1/8] qemu: driver: Fix coding style after 'qemuDomainAnnounceInterface' Date: Fri, 19 Jun 2026 12:28:08 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ytcIoCRY3Xx7mVaU7AdmFzJu4iWTn4p1SYtEWJd6vxA_1781866245 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FHMCDT5AGOAWEJV2ZFVOWV4YFH5AODON X-Message-ID-Hash: FHMCDT5AGOAWEJV2ZFVOWV4YFH5AODON X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1781866383037158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Too many extra lines were added and the virHypervisorDriver entry was missing a trailing comma which would require patch adding an API to add it. Fixes: 7191d2932601ed500ad02de95dee05d622860584 Signed-off-by: Peter Krempa Reviewed-by: J\ufffd\ufffdn Tomko --- src/qemu/qemu_driver.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b4cc09c81a..6f8025be53 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20930,8 +20930,6 @@ qemuDomainDelThrottleGroup(virDomainPtr dom, } - - static int qemuDomainAnnounceInterface(virDomainPtr dom, const char *device, @@ -21262,7 +21260,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainSetAutostartOnce =3D qemuDomainSetAutostartOnce, /* 11.2.0 */ .domainSetThrottleGroup =3D qemuDomainSetThrottleGroup, /* 11.2.0 */ .domainDelThrottleGroup =3D qemuDomainDelThrottleGroup, /* 11.2.0 */ - .domainAnnounceInterface =3D qemuDomainAnnounceInterface /* 12.5.0 */ + .domainAnnounceInterface =3D qemuDomainAnnounceInterface, /* 12.5.0 */ }; --=20 2.54.0 From nobody Wed Jun 24 21:39:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1781866487; cv=none; d=zohomail.com; s=zohoarc; b=A4q1BF8s3raZoSimGI9EiQESFOHzAXcYR6gln26orzOshc72CBvanTK9p89lE78hkLyY0XAofeB6gDWf4l9NKmVRanTujhbIJws/6pk7aV8ptNvS+MbYdszraCVG0pdP7GFDqlCZ961JncZRxuxqax4Mohc1I6J8cbVadaCPnp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781866487; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=Zr0eJ+z0WrOvZPymcKCkM9OmKGXsXi+8IEy6BYg4ebI=; b=YK4pCdaHDbpRa82wecHemt4rMf3XXP9KOhyKxkx/xSuVnBWs6tKbNTv5Rlprcvo+t57njhzaJ8LP9c2q0op7f4fYB8GccQMK7hA0vFJ6wPVe1QcwvhxukPwnR6vlyVzmzvhp2dbksaqoT57I4o+q9lV6KLElcV9n4iwGRLcGwIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1781866487476513.3854489774275; Fri, 19 Jun 2026 03:54:47 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 2DE0A3F87A; Fri, 19 Jun 2026 06:54:46 -0400 (EDT) Received: from [172.19.199.7] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id A741B41DEA; Fri, 19 Jun 2026 06:51:15 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 4593E4196A; Fri, 19 Jun 2026 06:50:50 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 41BAC418F7 for ; Fri, 19 Jun 2026 06:50:49 -0400 (EDT) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-2-sEFSwK2ANU62SDBNiONk6Q-1; Fri, 19 Jun 2026 06:50:47 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CF52F1956060 for ; Fri, 19 Jun 2026 10:50:46 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.24.18]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2A96C18005B6 for ; Fri, 19 Jun 2026 10:50:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781866248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zr0eJ+z0WrOvZPymcKCkM9OmKGXsXi+8IEy6BYg4ebI=; b=fZrHsdlP+mgvK8jlm+gqwbb1bbzlh5aQ0T4UDAB3YOMM5/O8o7oXQMV5hKypjWdB1p3L0p +bmpVDi4SXD4K/bI3zXZbDB+jVhh7eQOxAo4st9Ax8FmFLtHzT6D6ulQUQvK9tr2BvBkls rpXMJDSqtDj7yHahTA4oomaT09cueKU= X-MC-Unique: sEFSwK2ANU62SDBNiONk6Q-1 X-Mimecast-MFC-AGG-ID: sEFSwK2ANU62SDBNiONk6Q_1781866247 To: devel@lists.libvirt.org Subject: [PATCH v3 2/8] API: Introduce 'virConnectGetIntrospection' Date: Fri, 19 Jun 2026 12:28:09 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: vkHEu3IHswbQgddw2UY0e2E04lfy6nTS9jsqSa76Yss_1781866247 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: WF4GC2OW2QGLYUCNXHAWF323BGCHIWH3 X-Message-ID-Hash: WF4GC2OW2QGLYUCNXHAWF323BGCHIWH3 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1781866489579158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The API will provide a central point to query for runtime information about support of APIs, flags, typed parameters and in future possibly other information for current connection object. The intofmation can be used to e.g. see which flags are supported for which API. Signed-off-by: Peter Krempa Reviewed-by: J\ufffd\ufffdn Tomko --- include/libvirt/libvirt-host.h | 5 ++++ src/driver-hypervisor.h | 7 +++++ src/libvirt-host.c | 48 ++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 1 + src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 21 ++++++++++++++- src/remote_protocol-structs | 11 ++++++++ src/rpc/gendispatch.pl | 4 ++- 8 files changed, 96 insertions(+), 2 deletions(-) diff --git a/include/libvirt/libvirt-host.h b/include/libvirt/libvirt-host.h index 5b448e7954..d2c038a2d3 100644 --- a/include/libvirt/libvirt-host.h +++ b/include/libvirt/libvirt-host.h @@ -1041,5 +1041,10 @@ int virNodeAllocPages(virConnectPtr conn, unsigned int cellCount, unsigned int flags); +char *virConnectGetIntrospection(virConnectPtr conn, + virTypedParameterPtr params, + int nparams, + unsigned int flags); + #endif /* LIBVIRT_HOST_H */ diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 0add95de96..9c90482f19 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1480,6 +1480,12 @@ typedef int int nparams, unsigned int flags); +typedef char * +(*virDrvConnectGetIntrospection)(virConnectPtr conn, + virTypedParameterPtr params, + int nparams, + unsigned int flags); + typedef struct _virHypervisorDriver virHypervisorDriver; /** @@ -1758,4 +1764,5 @@ struct _virHypervisorDriver { virDrvDomainSetThrottleGroup domainSetThrottleGroup; virDrvDomainDelThrottleGroup domainDelThrottleGroup; virDrvDomainAnnounceInterface domainAnnounceInterface; + virDrvConnectGetIntrospection connectGetIntrospection; }; diff --git a/src/libvirt-host.c b/src/libvirt-host.c index 6b4345b09d..951da4f89d 100644 --- a/src/libvirt-host.c +++ b/src/libvirt-host.c @@ -142,6 +142,54 @@ virConnectSupportsFeature(virConnectPtr conn, int feat= ure) } +/** + * virConnectGetIntrospection: + * @conn: pointer to the hypervisor connection + * @params: typed parameters (currently unused) + * @nparams: number of paramters in @params + * @flags: currently unused, pass 0 + * + * Request a XML containing introspection information for the current + * connection. The introspection XML contains information about supported = APIs, + * flags, and other information which depends on what the current driver + * associated with the connection supports. + * + * Additional information may be later passed in via @params, but it's cur= rently + * unused. + * + * Returns: XML string containing the introspection data. Caller is respon= sible + * for freeing the associated memory. On error NULL is returned. + * + * Since: 12.5.0 + */ +char * +virConnectGetIntrospection(virConnectPtr conn, + virTypedParameterPtr params, + int nparams, + unsigned int flags) +{ + VIR_DEBUG("conn=3D%p, flags=3D0x%x", conn, flags); + VIR_TYPED_PARAMS_DEBUG(params, nparams); + + virResetLastError(); + + virCheckConnectReturn(conn, NULL); + + if (conn->driver->connectGetIntrospection) { + char *ret =3D conn->driver->connectGetIntrospection(conn, params, = nparams, flags); + if (!ret) + goto error; + return ret; + } + + virReportUnsupportedError(); + + error: + virDispatchError(conn); + return NULL; +} + + /** * virConnectGetType: * @conn: pointer to the hypervisor connection diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index 64ed641b7f..5ce85bde76 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -959,6 +959,7 @@ LIBVIRT_11.2.0 { LIBVIRT_12.5.0 { global: virDomainAnnounceInterface; + virConnectGetIntrospection; } LIBVIRT_11.2.0; # .... define new API here using predicted next version number .... diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 5c358d58c4..43f194acde 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8027,6 +8027,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainSetThrottleGroup =3D remoteDomainSetThrottleGroup, /* 11.2.0 */ .domainDelThrottleGroup =3D remoteDomainDelThrottleGroup, /* 11.2.0 */ .domainAnnounceInterface =3D remoteDomainAnnounceInterface, /* 12.5.0 = */ + .connectGetIntrospection =3D remoteConnectGetIntrospection, /* 12.5.0 = */ }; static virNetworkDriver network_driver =3D { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 32185fde2f..8f113e8f17 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -298,6 +298,11 @@ const REMOTE_DOMAIN_MESSAGES_MAX =3D 2048; */ const REMOTE_DOMAIN_ANNOUNCE_INTERFACE_PARAMS_MAX =3D 16; +/* + * Upper limit on number of API introspection parameters + */ +const REMOTE_CONNECT_GET_INTROSPECTION_PARAMS_MAX =3D 16; + /* UUID. VIR_UUID_BUFLEN definition comes from libvirt.h */ typedef opaque remote_uuid[VIR_UUID_BUFLEN]; @@ -4034,6 +4039,14 @@ struct remote_domain_announce_interface_args { unsigned int flags; }; +struct remote_connect_get_introspection_args { + remote_typed_param params; + unsigned int flags; +}; + +struct remote_connect_get_introspection_ret { + remote_nonnull_string xml; +}; /*----- Protocol. -----*/ /* Define the program number, protocol version and procedure numbers here.= */ @@ -7163,5 +7176,11 @@ enum remote_procedure { * @generate: both * @acl: domain:write */ - REMOTE_PROC_DOMAIN_ANNOUNCE_INTERFACE =3D 456 + REMOTE_PROC_DOMAIN_ANNOUNCE_INTERFACE =3D 456, + + /** + * @generate: both + * @acl: connect:read + */ + REMOTE_PROC_CONNECT_GET_INTROSPECTION =3D 457 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 6093a85c98..de6031d71f 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -3358,6 +3358,16 @@ struct remote_domain_announce_interface_args { } params; u_int flags; }; +struct remote_connect_get_introspection_args { + struct { + u_int params_len; + remote_typed_param * params_val; + } params; + u_int flags; +}; +struct remote_connect_get_introspection_ret { + remote_nonnull_string xml; +}; enum remote_procedure { REMOTE_PROC_CONNECT_OPEN =3D 1, REMOTE_PROC_CONNECT_CLOSE =3D 2, @@ -3815,4 +3825,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_EVENT_VCPU_REMOVED =3D 454, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CHANNEL_LIFECYCLE =3D 455, REMOTE_PROC_DOMAIN_ANNOUNCE_INTERFACE =3D 456, + REMOTE_PROC_CONNECT_GET_INTROSPECTION =3D 457, }; diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 8cb7d7eda2..1d8d00b469 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -633,7 +633,9 @@ elsif ($mode eq "server") { # NB: if your new API starts with remote_typed_params,= enter it here if you need # the conn arg to be passed first! - if ($call->{ProcName} eq "NodeSetMemoryParameters" || = $call->{ProcName} eq "DomainRestoreParams") { + if ($call->{ProcName} eq "NodeSetMemoryParameters" || + $call->{ProcName} eq "DomainRestoreParams" || + $call->{ProcName} eq "ConnectGetIntrospection") { push(@args_list, $conn_var); } push(@args_list, "$1"); --=20 2.54.0 From nobody Wed Jun 24 21:39:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1781866563; cv=none; d=zohomail.com; s=zohoarc; b=kZJx13c2EzZaiEdTG6S3iRbMF1RbrqswY7H52Wb9U2PIBDUluo14wT2Hi8iJm41K4WbrRFEeCV82QRBadCcXXjdujLEfJ/rVciWL1/TnkEtkBWLJ2BREF/7IU/qHNbl6BwN1vVxKevM+2Z8R8zuOOGnAp15zwyrVkbs7Fs98D2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781866563; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=V+OiB7PNhp9PDXxiBvcufNiDlXZEIrJdT/ooSl/CvOs=; b=kDBh4vIp892m2K6jF81l1fsZBzuWjOuWysofs3rA5b3kbljPYJk6k9km49ZHFTf67s5gG46qpviM9oPbDSwf2gVuWUdZo8sR0NG22jOAkiw+cCrJSf3j4bDNi2b5CgYSSbhPnyWv95OKcrd9l2jyBw/QX+28mQzs1oVCD5GygHs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1781866563294170.66349930045817; Fri, 19 Jun 2026 03:56:03 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E4A433F952; Fri, 19 Jun 2026 06:56:01 -0400 (EDT) Received: from [172.19.199.7] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 106AA41E30; Fri, 19 Jun 2026 06:51:22 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 0B2483F8E5; Fri, 19 Jun 2026 06:50:51 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 673F7418F7 for ; Fri, 19 Jun 2026 06:50:50 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-138-g769GfKYO7WKWAnS28APZg-1; Fri, 19 Jun 2026 06:50:48 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1B02E1956080 for ; Fri, 19 Jun 2026 10:50:48 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.24.18]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4D3B118005B3 for ; Fri, 19 Jun 2026 10:50:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781866250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V+OiB7PNhp9PDXxiBvcufNiDlXZEIrJdT/ooSl/CvOs=; b=chKq/D/QIfa4pPqU+s43+O0vMPcgN4PQqq11hE30CsO2o2G+OMSvX3Ifk/qTX7uSGKpXez GmI7anUhAu4Nk9t0iGL7EI+ul+fElb5qo8GUfqhkWPkY8SYT5HscsxqdigNU89HQzi8zZb EaK1UI5hFJnqs3JWPaCBrZNaJO/xb7c= X-MC-Unique: g769GfKYO7WKWAnS28APZg-1 X-Mimecast-MFC-AGG-ID: g769GfKYO7WKWAnS28APZg_1781866248 To: devel@lists.libvirt.org Subject: [PATCH v3 3/8] virsh: Introduce 'introspection' command which uses 'virConnectGetIntrospection' Date: Fri, 19 Jun 2026 12:28:10 +0200 Message-ID: <434be40d45ab7d7e092510e491ee609087304002.1781864731.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Ga1LLJahgv4dFckQVQR-8Zkrv9B9E4j5j7JySGE4aiI_1781866248 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: M446YLZVDRT3OFMNLIKD3772LW2HD5LI X-Message-ID-Hash: M446YLZVDRT3OFMNLIKD3772LW2HD5LI X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1781866565821158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Signed-off-by: Peter Krempa Reviewed-by: J\ufffd\ufffdn Tomko --- docs/manpages/virsh.rst | 19 ++++++++++++++++++ tools/virsh-host.c | 43 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index a10d29e0ea..e5e5c98f44 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -1104,6 +1104,25 @@ on the host are reported. The option *--all* will re= port every CPU model known to the hypervisor, including ones that are not supported on the hypervisor= (e.g. newer generation models). +introspection +------------- + +**Syntax:** + +:: + + introspection [--xpath EXPRESSION] [--wrap] + +Output the libvirt connection feature introspection XML. + +If the **--xpath** argument provides an XPath expression, it will be +evaluated against the output XML and only those matching nodes will +be printed. The default behaviour is to print each matching node as +a standalone document, however, for ease of additional processing, +the **--wrap** argument will cause the matching node to be wrapped +in a common root node. + + DOMAIN COMMANDS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 0c18db67c4..f3fc26a875 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1871,6 +1871,43 @@ cmdHypervisorCPUModelNames(vshControl *ctl, } +static const vshCmdInfo info_introspection =3D { + .help =3D N_("get XML containing connection introspection data"), + .desc =3D N_("get XML containing connection introspection data"), +}; + +static const vshCmdOptDef opts_introspection[] =3D { + {.name =3D "xpath", + .type =3D VSH_OT_STRING, + .completer =3D vshCompleteEmpty, + .help =3D N_("xpath expression to filter the XML document") + }, + {.name =3D "wrap", + .type =3D VSH_OT_BOOL, + .help =3D N_("wrap xpath results in an common root element"), + }, + {.name =3D NULL} +}; + +static bool +cmdIntrospection(vshControl *ctl, + const vshCmd *cmd) +{ + g_autofree char *xml =3D NULL; + virshControl *priv =3D ctl->privData; + bool wrap =3D vshCommandOptBool(cmd, "wrap"); + const char *xpath =3D NULL; + + if (vshCommandOptStringQuiet(ctl, cmd, "xpath", &xpath) < 0) + return false; + + if (!(xml =3D virConnectGetIntrospection(priv->conn, NULL, 0, 0))) + return false; + + return virshDumpXML(ctl, xml, "domain", xpath, wrap); +} + + const vshCmdDef hostAndHypervisorCmds[] =3D { {.name =3D "allocpages", .handler =3D cmdAllocpages, @@ -2010,5 +2047,11 @@ const vshCmdDef hostAndHypervisorCmds[] =3D { .info =3D &info_version, .flags =3D 0 }, + {.name =3D "introspection", + .handler =3D cmdIntrospection, + .opts =3D opts_introspection, + .info =3D &info_introspection, + .flags =3D 0 + }, {.name =3D NULL} }; --=20 2.54.0 From nobody Wed Jun 24 21:39:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1781866688; cv=none; d=zohomail.com; s=zohoarc; b=QV3X2xutVTSf84/7Fb9wtMkQ01MnFeabwqehjkpMY3JBZ+vOLfmEKuR7MLu48K8ZGm0TowNC+rwggegEEdriy3IRyOEL2FaiQuB0jIoiv77oUEPOiJVEHbxMStjnoazjOmDXy023L6Sm+702z8k+auIEL6WD0IkRvO15QsbpQOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781866688; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=neB7rSj+XnVjttYsXZjQw2x46OKe7UIyfEEeLcra4NM=; b=EV0snUj/Xt1ik+AdaK1iiozii2rLigBtqqIKUwgTq/LED2ZZf6VwNAKlPTo0H9x3vXiSxaODQe9Zc6wNUy8BAo/Qhl908G+qjKUrirgWh/q2zO1Xpd84trTmmwoG8Xer7gMtvdFHjRoOA9M+oNMK69XrnyVvam21M08Y1dZVM7E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1781866688844667.621261914114; Fri, 19 Jun 2026 03:58:08 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 6DD1341856; Fri, 19 Jun 2026 06:58:07 -0400 (EDT) Received: from [172.19.199.7] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id A9326423D9; Fri, 19 Jun 2026 06:51:27 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D67FC41D1F; Fri, 19 Jun 2026 06:50:55 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 40DA6418F7 for ; Fri, 19 Jun 2026 06:50:52 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-161-rEC1Kzm_Oby6IC7-7f4Ipg-1; Fri, 19 Jun 2026 06:50:50 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 33850195606A for ; Fri, 19 Jun 2026 10:50:49 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.24.18]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 82EBB1800361 for ; Fri, 19 Jun 2026 10:50:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781866251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=neB7rSj+XnVjttYsXZjQw2x46OKe7UIyfEEeLcra4NM=; b=NhDBpqv1c4Bzhbd36KEI4xq4L6doNA89/Dx/xu5WrXrPu9iS8g7URzEHCJY+IyYrBq/72S cYiXIUKQJruSSYfIyljDIFatuGjJttZi4znxEhfrqdlvanHg6nvG6kew7V3ExGP9WHtwRY RMbdpGLANkNNfchjPgzR3Tvcywq9CT4= X-MC-Unique: rEC1Kzm_Oby6IC7-7f4Ipg-1 X-Mimecast-MFC-AGG-ID: rEC1Kzm_Oby6IC7-7f4Ipg_1781866249 To: devel@lists.libvirt.org Subject: [PATCH v3 4/8] scripts: Introduce 'getintrospection' script Date: Fri, 19 Jun 2026 12:28:11 +0200 Message-ID: <4d7eaffe8d22c66888a44d7c6219a299d5437048.1781864731.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: hxDW3m80JBCfLcoT0o2gJeQ_zbRnMxjwSY6Kwb1IfiE_1781866249 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: Y2DVASQPKELK5Z5AWGMVXMISHP5TQGJP X-Message-ID-Hash: Y2DVASQPKELK5Z5AWGMVXMISHP5TQGJP X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1781866690613158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The script analyzes the driver implementation source file and generates an include file which describes the analyzed driver in terms of: - supported APIs - flags supported for the API (by looking at virCheckFlags) The generated structure then will be used to generate the introspection XML. The script goes through the 'virHypervisorDriver' struct, finds all callbacks corresponding to public APIs and then goes through the functions finding the 'virCheckFlags' to collect supported flags per API. Since the migration APIs are public but use internal functions which don't map directly, the script tries to find the best matching internal API and then infers the flags for the public migration APIs from the detected flags. The script works only with the contemporary coding style for functions due to regex usage so any driver impl file needs to be modernized first. As first example, introspection of qemu driver is generated. An excerpt from the generated data (which is for internal use, and will be used to generate XML): static const virIntrospectionData driver_api_introspection[] =3D { { .api =3D "virConnectBaselineCPU", .flags_arg =3D true, .flags =3D VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | VIR_CONNECT= _BASELINE_CPU_MIGRATABLE, }, { .api =3D "virConnectBaselineHypervisorCPU", .flags_arg =3D true, .flags =3D VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | VIR_CONNECT= _BASELINE_CPU_MIGRATABLE | VIR_CONNECT_BASELINE_CPU_IGNORE_HOST, }, { .api =3D "virConnectClose", .flags_arg =3D false, }, Signed-off-by: Peter Krempa Reviewed-by: J\ufffd\ufffdn Tomko --- scripts/genintrospection.py | 220 ++++++++++++++++++++++++++++++++++++ scripts/meson.build | 1 + src/qemu/meson.build | 18 +++ 3 files changed, 239 insertions(+) create mode 100755 scripts/genintrospection.py diff --git a/scripts/genintrospection.py b/scripts/genintrospection.py new file mode 100755 index 0000000000..c3ac5c940a --- /dev/null +++ b/scripts/genintrospection.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: LGPL-2.1-or-later + +import argparse +import re +import sys + + +# driver callbacks needed to infer the introspection for public migration = APIs +# which do not map directly to any driver API callback. We need a represen= tative +# sample of APIs supporting typed parameters and flags +# The APIs are ordered acco +migration_driver_symbols =3D [ + "domainMigrateBegin3Params", + "domainMigrateBegin3", + "domainMigratePrepare2", + "domainMigratePrepare", +] + +migration_public_api =3D { + "virDomainMigrate": {}, + "virDomainMigrateToURI": {}, + "virDomainMigrate2": {}, + "virDomainMigrateToURI2": {}, + "virDomainMigrate3": {"params": True}, + "virDomainMigrateToURI3": {"params": True}, +} + + +def load_public_symbols(filename): + """load the public symbol file and return all APIs""" + symbols =3D [] + + with open(filename, "r") as symfile: + while True: + line =3D symfile.readline() + + if not line: + break + + m =3D re.match(r"\s+(?Pvir\w+);", line) + + if not m: + continue + + symbols.append(m.group("sym")) + + return symbols + + +def parse_api(filename, syms): + with open(filename, "r") as f: + content =3D f.read() + + # parse the definition of current driver's virHypervisorDriver str= uct + driverdef =3D re.search( + r"virHypervisorDriver.*?=3D\s+{(?P[^}]+)", + content, + flags=3Dre.DOTALL | re.MULTILINE, + ) + + # parse all functions + # requires that the input file is well formed: + # - types of return value are on separate line including pointer s= ymbol + # - function name starts on separate line followed by opening pare= nthesis for arguments + # - opening brace for body is on start of a separate line + # - closing brace for body is on start of a separate line + funciter =3D re.finditer( + r"^(?P\w+)\((?P[^)]*)\)\n^{(?P.*?)^}", + content, + flags=3Dre.DOTALL | re.MULTILINE, + ) + + if not driverdef: + raise Exception(f"'virHypervisorDriver' definition not found in '{= filename}'") + + # create mapping from public API names to local driver's callback names + apis =3D {} + # .connectOpen =3D qemuConnectOpen -> apis['qemuConnectOpen'] =3D 'vir= ConnectOpen' + for api in re.finditer( + r"\.(?P\w+)\s+=3D\s+(?P\w+)", driverdef.group("ap= is") + ): + # skip hypervisor driver name definition + if api.group("field") =3D=3D "name": + continue + + # skip APIs that have had their implementation removed + if api.group("callback") =3D=3D "NULL": + continue + + # connectOpen -> virConnectOpen + # for migration API we use the name in virHypervisorDriver + name =3D api.group("field") + apiname =3D None + + if name in migration_driver_symbols: + apis[api.group("callback")] =3D name + else: + apiname =3D "vir" + name[0:1].upper() + name[1:] + apis[api.group("callback")] =3D apiname + + flagmap =3D {} + migr_data =3D {} + # parse exported functions, presence of 'flags' argument and the 'virC= heckFlags' expression + for f in funciter: + apiname =3D apis.get(f.group("name"), None) + migrationapi =3D False + + # process exported public APIs or migration handlers; migration ha= ndlers + # will be at the end handled separately + if not apiname: + continue + + if apiname in migration_driver_symbols: + migrationapi =3D True + elif apiname not in syms: + continue + + data =3D { + "callback": f.group("name"), + "flags_arg": False, + "flags_supported": None, + } + + flagarg =3D re.search(r"\bflags\b", f.group("args")) + if flagarg: + data["flags_arg"] =3D True + + flagcheck =3D re.search( + r"virCheckFlags(?:Goto)?\((?P[^,]+),", + f.group("impl"), + flags=3Dre.DOTALL | re.MULTILINE, + ) + + if flagcheck: + data["flags_supported"] =3D re.sub(r"\s+", " ", flagcheck.= group("flags")) + + if migrationapi: + migr_data[apiname] =3D data + else: + flagmap[apiname] =3D data + + # populate migration API data. To do this we want to find which intern= al + # APIs are supported and then populate the list based on the detected + # information + for m in migration_driver_symbols: + if m in migr_data: + for apiname, pub in migration_public_api.items(): + data =3D migr_data[m].copy() + flagmap[apiname] =3D data + + break + + return flagmap + + +parser =3D argparse.ArgumentParser( + description=3D"Tool to generate data for 'virConnectIntrospect'" +) +parser.add_argument( + "--symfile", action=3D"append", required=3DTrue, help=3D"public symbol= file(s)" +) +parser.add_argument("--driverfile", required=3DTrue, help=3D"driver implem= entation file") +parser.add_argument("--output", required=3DTrue, help=3D"output file") +args =3D parser.parse_args() + +syms =3D [] +for sf in args.symfile: + syms +=3D load_public_symbols(sf) + +introspection =3D parse_api(args.driverfile, syms) + +fail =3D False + +with open(args.output, "w") as outfile: + outfile.write( + f"""/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * Generated data for introspection of '{args.driverfile}'. + * This file is generated by '{parser.prog}' + */ +""" + ) + + outfile.write( + """ +static const virIntrospectionData driver_api_introspection[] =3D +{ +""" + ) + + for api in sorted(introspection.keys()): + data =3D introspection[api] + + outfile.write(f' {{ .api =3D "{api}",\n') + if data.get("flags_arg", False): + outfile.write(" .flags_arg =3D true,\n") + outfile.write(f" .flags =3D {data.get('flags_supported', = 0)},\n") + else: + outfile.write(" .flags_arg =3D false,\n") + + outfile.write(" },\n") + + epilogue =3D """ { .api =3D NULL } +}; +""" + outfile.write(epilogue) + +for api, data in introspection.items(): + if ( + data.get("flags_arg", False) is True + and data.get("flags_supported", None) is None + ): + print(f"failed to parse flags for '{api}' in '{data.get('callback'= , '')}'") + fail =3D True + +if fail: + sys.exit(1) diff --git a/scripts/meson.build b/scripts/meson.build index 15a23e8738..bfb3eb7bf4 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -13,6 +13,7 @@ scripts =3D [ 'dtrace2systemtap.py', 'esx_vi_generator.py', 'genaclperms.py', + 'genintrospection.py', 'genpolkit.py', 'gensystemtap.py', 'group-qemu-caps.py', diff --git a/src/qemu/meson.build b/src/qemu/meson.build index a94bc4f9a8..4fdfc6c3e3 100644 --- a/src/qemu/meson.build +++ b/src/qemu/meson.build @@ -45,6 +45,23 @@ qemu_driver_sources =3D [ 'qemu_vnc.c', ] +introspection_files =3D custom_target( + 'qemu_introspection.inc.h', + output: 'qemu_introspection.inc.h', + input: [ + '../libvirt_public.syms', + '../libvirt_qemu.syms', + 'qemu_driver.c', + ], + command: [ + meson_python_prog, genintrospection_prog, + '--symfile', meson.project_source_root() / 'src' / 'libvirt_public.sym= s', + '--symfile', meson.project_source_root() / 'src' / 'libvirt_qemu.syms', + '--driverfile', meson.project_source_root() / 'src' / 'qemu' / 'qemu_d= river.c', + '--output', '@OUTPUT@' + ] +) + driver_source_files +=3D files(qemu_driver_sources) stateful_driver_source_files +=3D files(qemu_driver_sources) @@ -95,6 +112,7 @@ if conf.has('WITH_QEMU') [ qemu_driver_sources, qemu_dtrace_gen_headers, + introspection_files, ], dependencies: [ access_dep, --=20 2.54.0 From nobody Wed Jun 24 21:39:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1781866761; cv=none; d=zohomail.com; s=zohoarc; b=Zl14DBfTrVzx30nYy07mwPbJDSGCU9FnlTbFH/Sn+8LGyVxgib1whvJgIKSqqXQYbLZCwciroGpoOUkWAxzd46LQ9qbGKRVpiZdPXXqJh/NkP/zy+Y4fiua993yvDSQOYNwFmpV0SF+kcUxc5Ve8ZZsUSY6/nqrjq4w93QbXmQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781866761; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=OJhZzBUjQnY+/PJlpe9KuCsFwWD/ofy1Cu042uB9oaA=; b=myqiaJPoUk2yp3154tEfx9EFHV/VFuaRhFrHA0g0AWbDyfD5tFeYiuUScEE0mtQp8G7k1zTM0ZVNHDSQst57e7Xh5ZsMpggUlGsKVRdgXkAWUhU2gWqizreiO5n+g6f27nye2iX0y3RJ0DFVrO3lgoo90SXqJuMaQbRoswIRa70= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1781866761886172.51154524115384; Fri, 19 Jun 2026 03:59:21 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A25EA419D3; Fri, 19 Jun 2026 06:59:20 -0400 (EDT) Received: from [172.19.199.7] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id D12F441D9C; Fri, 19 Jun 2026 06:51:31 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 06A3A41CE6; Fri, 19 Jun 2026 06:51:06 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0471641CBF for ; Fri, 19 Jun 2026 06:50:52 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-652-n7exJNatPyqk4hBB0bR_iQ-1; Fri, 19 Jun 2026 06:50:51 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 49BDA180059A for ; Fri, 19 Jun 2026 10:50:50 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.24.18]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 98A9A180034F for ; Fri, 19 Jun 2026 10:50:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781866252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OJhZzBUjQnY+/PJlpe9KuCsFwWD/ofy1Cu042uB9oaA=; b=jA4rLRmqJkUFkQ0hMrxsiW+CYsp6dal2XukJKpxqM/GHJrLb1bSBeoE/2YxHWDDljz5pT+ xY0H/1+4sK0SsAo4P+JkyLtacIdeB5ibH5klurvfqvmkBVCMfwW4V1LqK+ApEbRUEmtCmS T/c/qgX53KCNvUFH7RThpFlU/cgRbLc= X-MC-Unique: n7exJNatPyqk4hBB0bR_iQ-1 X-Mimecast-MFC-AGG-ID: n7exJNatPyqk4hBB0bR_iQ_1781866250 To: devel@lists.libvirt.org Subject: [PATCH v3 5/8] qemu: Implement 'virConnectGetIntrospection' Date: Fri, 19 Jun 2026 12:28:12 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: SZzUlUCv1Pd2TBZZA2HpIkJFETLxMN8fXJ4X_o6zR1c_1781866250 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GOLVGTRRXT2XGCDAWKR2UHFNOI7XOZFR X-Message-ID-Hash: GOLVGTRRXT2XGCDAWKR2UHFNOI7XOZFR X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1781866762893158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Add general infrastructure for converting the generated introspection into XML which can be returned via 'virConnectGetIntrospection' and use it in the qemu driver. Example of the generated introspection XML: $ virsh introspection [...] The XML has the provisions to add introspection for sub-drivers as well as can be extended in the future with other dynamic parameters such as the names and types of virTypedParameter input fields. Signed-off-by: Peter Krempa Reviewed-by: J\ufffd\ufffdn Tomko --- src/libvirt_private.syms | 5 +++++ src/qemu/qemu_driver.c | 25 +++++++++++++++++++++++++ src/util/meson.build | 1 + src/util/virintrospection.c | 37 +++++++++++++++++++++++++++++++++++++ src/util/virintrospection.h | 17 +++++++++++++++++ 5 files changed, 85 insertions(+) create mode 100644 src/util/virintrospection.c create mode 100644 src/util/virintrospection.h diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c76e5cb08a..838feca8e8 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2700,6 +2700,11 @@ virInhibitorRelease; virInitctlFifos; virInitctlSetRunLevel; + +# util/virintrospection.h +virIntrospectionGetXML; + + # util/viriommufd.h virIOMMUFDOpenDevice; virIOMMUFDSupported; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6f8025be53..f8774d40e4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -106,6 +106,7 @@ #include "virdomaincheckpointobjlist.h" #include "virutil.h" #include "backup_conf.h" +#include "virintrospection.h" #define VIR_FROM_THIS VIR_FROM_QEMU @@ -21006,6 +21007,29 @@ qemuDomainAnnounceInterface(virDomainPtr dom, } +#include "qemu_introspection.inc.h" + +static char * +qemuConnectGetIntrospection(virConnectPtr conn G_GNUC_UNUSED, + virTypedParameterPtr params, + int nparams, + unsigned int flags) +{ + virCheckFlags(0, NULL); + + /* BEWARE: This function allows read-only connections. If typed parame= ters + * are ever introduced it must be ensured that they are properly inter= preted + * based on the connection permissions */ + if (virTypedParamsValidate(params, nparams, + NULL) < 0) + + if (virConnectGetIntrospectionEnsureACL(conn) < 0) + return NULL; + + return virIntrospectionGetXML(driver_api_introspection); +} + + static virHypervisorDriver qemuHypervisorDriver =3D { .name =3D QEMU_DRIVER_NAME, .connectURIProbe =3D qemuConnectURIProbe, @@ -21261,6 +21285,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainSetThrottleGroup =3D qemuDomainSetThrottleGroup, /* 11.2.0 */ .domainDelThrottleGroup =3D qemuDomainDelThrottleGroup, /* 11.2.0 */ .domainAnnounceInterface =3D qemuDomainAnnounceInterface, /* 12.5.0 */ + .connectGetIntrospection =3D qemuConnectGetIntrospection, /* 12.5.0 */ }; diff --git a/src/util/meson.build b/src/util/meson.build index 9fb0aa0fe7..542f8a1b9b 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -46,6 +46,7 @@ util_sources =3D [ 'viridentity.c', 'virinhibitor.c', 'virinitctl.c', + 'virintrospection.c', 'viriommufd.c', 'viriscsi.c', 'virjson.c', diff --git a/src/util/virintrospection.c b/src/util/virintrospection.c new file mode 100644 index 0000000000..b9fb5beda8 --- /dev/null +++ b/src/util/virintrospection.c @@ -0,0 +1,37 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#include + +#include "virintrospection.h" +#include "virxml.h" +#include "virbuffer.h" + +char * +virIntrospectionGetXML(const virIntrospectionData *d) +{ + g_auto(virBuffer) xml =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) sections =3D VIR_BUFFER_INIT_CHILD(&xml); + g_auto(virBuffer) apis =3D VIR_BUFFER_INIT_CHILD(§ions); + size_t i; + + for (i =3D 0; d[i].api !=3D NULL; i++) { + g_auto(virBuffer) api_attr =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) api_elem =3D VIR_BUFFER_INIT_CHILD(&apis); + + virBufferAsprintf(&api_attr, " name=3D'%s'", d[i].api); + + if (d[i].flags_arg) { + virBufferAsprintf(&api_elem, "= \n", + d[i].flags, d[i].flags); + } + + virXMLFormatElement(&apis, "api", &api_attr, &api_elem); + } + + virXMLFormatElement(§ions, "hypervisor", NULL, &apis); + virXMLFormatElementEmpty(&xml, "libvirt-introspection", NULL, §ion= s); + + return virBufferContentAndReset(&xml); +} diff --git a/src/util/virintrospection.h b/src/util/virintrospection.h new file mode 100644 index 0000000000..f996ce0f07 --- /dev/null +++ b/src/util/virintrospection.h @@ -0,0 +1,17 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#pragma once + +#include + +struct _virIntrospectionData { + const char *api; + bool flags_arg; + unsigned int flags; +}; +typedef struct _virIntrospectionData virIntrospectionData; + +char * +virIntrospectionGetXML(const virIntrospectionData *d); --=20 2.54.0 From nobody Wed Jun 24 21:39:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1781866862; cv=none; d=zohomail.com; s=zohoarc; b=XTiags5O2w10mi9yG1ROlPt7DZ6ip2t+g9wXgZHeITlnw2PVCu4BE9P7IuI0SYXfXE/bPWEYv4RU83LwNsWAgnaW+tkNNfgBEoEwmoETyAJFiXtRfjN2CcTXX9N252ts6IoAKSNfjFopX7RoGHBVDnZ+xaOh+/YJkNRncDBs/Jg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781866862; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=TJVj6yc3OQK4BVzzbVhEoTCA8tWJy3QKkzp/O0Jntx0=; b=IMxy8ecu+T50t3maG8Y9eQkIUifDt+W5zFESArRaUxtR3nYSwXH7glxMXY5ZyMifwdUJKIbAekjMf3+RsEq08Ur3pvgvtRT66MoYgI6EUUSxsIXhmfyLHjpUM8zsCdFPkMfGedcKZ5SW3ihSZAHAT5BktPzTE93O1LyXSG3NJJM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1781866862290326.41354247282743; Fri, 19 Jun 2026 04:01:02 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 75D1941CF5; Fri, 19 Jun 2026 07:01:00 -0400 (EDT) Received: from [172.19.199.7] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 40FE343E02; Fri, 19 Jun 2026 06:51:37 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 2557F41CFE; Fri, 19 Jun 2026 06:51:10 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D1A4E41CF6 for ; Fri, 19 Jun 2026 06:50:53 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-42-bdd6OeBxO5yOhNkrthHYdA-1; Fri, 19 Jun 2026 06:50:52 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 61CFC19541B0 for ; Fri, 19 Jun 2026 10:50:51 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.24.18]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B0E1D1800361 for ; Fri, 19 Jun 2026 10:50:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781866253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TJVj6yc3OQK4BVzzbVhEoTCA8tWJy3QKkzp/O0Jntx0=; b=CEFnjqey48w/gjMaW/uaq2J4CW1MiCm5Ms+AP4TRcDqtk+GN9LeETPNvP6/2m73gI7iu3o mEwtp2am4lN4wKL9ddzK5QK5HrxzmO7ta6a2VNrfKcDAxT4OPo8ayGRJcjl5JXHN6U90PH Lih7OZbPiKGu5z3uR1m2NkrGLZEK8zI= X-MC-Unique: bdd6OeBxO5yOhNkrthHYdA-1 X-Mimecast-MFC-AGG-ID: bdd6OeBxO5yOhNkrthHYdA_1781866251 To: devel@lists.libvirt.org Subject: [PATCH v3 6/8] introspection: Add introspection of input typed parameters Date: Fri, 19 Jun 2026 12:28:13 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ZwhxD6vh_h6jn6Jl5cgXL0Xi5B9xePSV57qwYVdX4Xo_1781866251 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 3GFKGT3L5CZWL47CVJDJ6QANEC6OZL3H X-Message-ID-Hash: 3GFKGT3L5CZWL47CVJDJ6QANEC6OZL3H X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1781866863831158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Extract information about typed parameters from calls to 'virTypedParamsValidate'/'virTypedParamsValidateTemplate' and expose them in the introspection XML: Migration APIs once again required special handling as some typed params are supported even if the backing APIs using typed parameters arend supported because they can be converted to legacy parameters for the lesser APIs. Signed-off-by: Peter Krempa Reviewed-by: J\ufffd\ufffdn Tomko --- scripts/genintrospection.py | 125 ++++++++++++++++++++++++++++++++++++ src/util/virintrospection.c | 45 +++++++++++++ src/util/virintrospection.h | 3 + 3 files changed, 173 insertions(+) diff --git a/scripts/genintrospection.py b/scripts/genintrospection.py index c3ac5c940a..95469fc15a 100755 --- a/scripts/genintrospection.py +++ b/scripts/genintrospection.py @@ -7,6 +7,21 @@ import re import sys +# APIs which fill a user-supplied virTypedParameter pointer -- use it as o= utput +input_params_exceptions =3D [ + "virDomainGetBlkioParameters", + "virDomainGetMemoryParameters", + "virDomainGetNumaParameters", + "virDomainGetSchedulerParametersFlags", + "virDomainGetSchedulerParameters", + "virDomainBlockStatsFlags", + "virDomainGetInterfaceParameters", + "virDomainGetBlockIoTune", + "virDomainGetCPUStats", + "virNodeGetMemoryParameters", +] + + # driver callbacks needed to infer the introspection for public migration = APIs # which do not map directly to any driver API callback. We need a represen= tative # sample of APIs supporting typed parameters and flags @@ -27,6 +42,15 @@ migration_public_api =3D { "virDomainMigrateToURI3": {"params": True}, } +# list of parameters supported by 'virDomainMigrate3'/'virDomainMigrateToU= RI3' +# if any migration protocol version is supported by extracting the paramet= ers +migration_public_api_fallback_params =3D [ + ("VIR_MIGRATE_PARAM_URI", "VIR_TYPED_PARAM_STRING"), + ("VIR_MIGRATE_PARAM_DEST_NAME", "VIR_TYPED_PARAM_STRING"), + ("VIR_MIGRATE_PARAM_DEST_XML", "VIR_TYPED_PARAM_STRING"), + ("VIR_MIGRATE_PARAM_BANDWIDTH", "VIR_TYPED_PARAM_ULLONG"), +] + def load_public_symbols(filename): """load the public symbol file and return all APIs""" @@ -121,8 +145,13 @@ def parse_api(filename, syms): "callback": f.group("name"), "flags_arg": False, "flags_supported": None, + "input_params": False, + "input_params_supported": None, + "input_params_template": None, } + # find APIs having 'flags' argument and find the corresponding + # virCheckFlags flagarg =3D re.search(r"\bflags\b", f.group("args")) if flagarg: data["flags_arg"] =3D True @@ -136,6 +165,54 @@ def parse_api(filename, syms): if flagcheck: data["flags_supported"] =3D re.sub(r"\s+", " ", flagcheck.= group("flags")) + # find APIs supporting typed parameters as input and find the + # corresponding supported flags by matching 'virTypedParamsValidat= e' + # We're looking for APIs which take typed parameters as input, whi= ch + # excludes any API taking a double-pointer. From the rest + # the 'input_params_exceptions' array has APIs which output typed + # parameters into a pre-allocated array and thus are excluded + paramarg =3D re.search( + r"virTypedParameter(?PPtr)?(?P[ *]+)", f.gro= up("args") + ) + param_nptrs =3D 0 + + if paramarg: + if paramarg.group("ptrtype"): + param_nptrs +=3D 1 + + for c in paramarg.group("ptrstar"): + if c =3D=3D "*": + param_nptrs +=3D 1 + + if param_nptrs =3D=3D 1 and apiname not in input_params_exceptions: + data["input_params"] =3D True + + paramscheck =3D re.search( + r"virTypedParamsValidate(?P