From nobody Wed Jun 10 17:27:23 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=1777549516; cv=none; d=zohomail.com; s=zohoarc; b=Zz+oUfEubjsxasd7JhW0PaSIe9yYnt8TEu2KGIq+Y6ymRYBKCLaGpq/o57WCaEytjilgWjuwZNPhiUPsh9BWsb9G/0VRkvW0zwbucEv4miUV02rtwL44o5FeSddpf778ywGtKh0rxCKJLyaZgsvBaFLYUy+SZYCMY8I3ybd9M28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777549516; 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=WfsrjLUca8K0j+DSe1a1Ov1VHELYls1dcHrNdf73P6A=; b=SK0xLNXD8xE8noAyiYrtEnQWJYhR+tvy4tsUln6oaL7kpf3r7RGczcrOa1bPatfyBAWPTrVkKNPjozWjt4DO72JsZxTylHuKb+4hCDPWWrCH4qXZ/CCttqkY2+3XnpTi1LZehj5nSSoSSHF0xtTxCeXf1zSOR7rzHX1Sn/MZWmI= 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 1777549516441833.9676211127004; Thu, 30 Apr 2026 04:45:16 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 2F71741864; Thu, 30 Apr 2026 07:45:15 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 7954F4194F; Thu, 30 Apr 2026 07:44:10 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 629F33F282; Thu, 30 Apr 2026 07:43:59 -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 4A26B3F282 for ; Thu, 30 Apr 2026 07:43:58 -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-78-Oj_K4v64Nwi4XLeLeixaGg-1; Thu, 30 Apr 2026 07:43:56 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 4CD771956089 for ; Thu, 30 Apr 2026 11:43:55 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 77729300019F for ; Thu, 30 Apr 2026 11:43:54 +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=1777549437; 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=WfsrjLUca8K0j+DSe1a1Ov1VHELYls1dcHrNdf73P6A=; b=AtpU5FHJkLxbcEWoJl6veDxrZEvqzkZxov/G5Ns9ZMeaTu585Y8DoYPGeFZ18MVsQ37HI2 WmFOgPLYZxAIMZXp2kfzSXDAzBE6dAEEjQ40IqJ8NmEZPHVH/AwZNK/detq9hk28OUJRkJ gdLPbQsQsqENv8dzPDCBRYWGzuYgf+U= X-MC-Unique: Oj_K4v64Nwi4XLeLeixaGg-1 X-Mimecast-MFC-AGG-ID: Oj_K4v64Nwi4XLeLeixaGg_1777549435 To: devel@lists.libvirt.org Subject: [PATCH v2 01/35] remote_protocol-structs: fix mis-aligned 'remote_domain_set_throttle_group_args' Date: Thu, 30 Apr 2026 13:43:17 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: WrHa0JrRk8XNvlCOpOYw4C74OJ0Kz10DBcV44tV2eVI_1777549435 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JIKZNJT7TJGA2AO5BIHT5MVY3EZ23PM6 X-Message-ID-Hash: JIKZNJT7TJGA2AO5BIHT5MVY3EZ23PM6 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: 1777549521046154102 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Fixes: a10b3ffebb6c498b357fd546c737d152cdf3e77d Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/remote_protocol-structs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 0f87d13a5a..d11a8f91a9 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -1051,13 +1051,13 @@ struct remote_domain_get_block_io_tune_ret { int nparams; }; struct remote_domain_set_throttle_group_args { - remote_nonnull_domain dom; - remote_nonnull_string group; - struct { - u_int params_len; - remote_typed_param * params_val; - } params; - u_int flags; + remote_nonnull_domain dom; + remote_nonnull_string group; + struct { + u_int params_len; + remote_typed_param * params_val; + } params; + u_int flags; }; struct remote_domain_del_throttle_group_args { remote_nonnull_domain dom; --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777549829; cv=none; d=zohomail.com; s=zohoarc; b=afmwbUcMzZWRA8dHePu0Wpg+FMhTQxN30PF/q5lctlXVGEMFpZWBGuaBXj3u41tXxG+GgA0/H/ZYIzzwa+Becq0I3jQX292+iKT/CdXOq7984LsusJUFhL2dUu3hCKx5KJ4DkWHL0nGn1WWvRDPbYjFY65Wg0HgVXAns+3USBzk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777549829; 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=BXjRZlaM1VUSsAwQBZalHO5u717lUlI5wFIf9Jnatsc=; b=GcnWkjZHSylWh09heQJoWKKHrFgrAp23Y2s6VRNL+H4CVjW+sQFZNj9xwqSGAOkThqkjW2m/i02VkROlfkDQcCVigQBWAOXMBKqYk7wJ8hUerp05vNYsJkvJMIostRqLDvOL+vB2UAG1fTYRhSc+U7NfvkLcc0pn1CvwWDVUzKI= 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 1777549829640394.49313202008; Thu, 30 Apr 2026 04:50:29 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 839B241A2F; Thu, 30 Apr 2026 07:50:28 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 65EA23F34D; Thu, 30 Apr 2026 07:44:28 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B2CA03F33C; Thu, 30 Apr 2026 07:44:00 -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 4253E3F349 for ; Thu, 30 Apr 2026 07:43:59 -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-684-qN4wSdGkNKSIgjC7e1cv-g-1; Thu, 30 Apr 2026 07:43:57 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 9AC9A195608F for ; Thu, 30 Apr 2026 11:43:56 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D5A3630001BE for ; Thu, 30 Apr 2026 11:43:55 +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=1777549438; 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=BXjRZlaM1VUSsAwQBZalHO5u717lUlI5wFIf9Jnatsc=; b=H2iqCxU/GyZy0i77126LHjmsDSDehPXEsh3uvsu7LFqA0PbS6KOMJi0eTIgcPoXikMbaox IxnL8M5C9RK6LDr4CDUX2n9YAQm5PuJYJMbIJKIKnur1jZME/QRe9byxNH4mCLjC1Mscx9 Z0OP5FL0VMbSKTibPQ2DyMW7VtBRa48= X-MC-Unique: qN4wSdGkNKSIgjC7e1cv-g-1 X-Mimecast-MFC-AGG-ID: qN4wSdGkNKSIgjC7e1cv-g_1777549436 To: devel@lists.libvirt.org Subject: [PATCH v2 02/35] qemu: driver: Unify coding style Date: Thu, 30 Apr 2026 13:43:18 +0200 Message-ID: <5ed848fcb1f89be4b324fb2fcd7ac5d52c9f009b.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: qYd5f8J3eqK8bYTJ9rDuV6CmcwtbuofBgO3RlzWaDzI_1777549436 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: RLCISP4HTN6YBXD5HZL67TGRYJAMOECZ X-Message-ID-Hash: RLCISP4HTN6YBXD5HZL67TGRYJAMOECZ 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: 1777549832234158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Reformat qemu_driver.c to use the contemporary coding style. It will help also for the upcoming script for generating list of supported flags for APIs. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 212 +++++++++++++++++++++++++++-------------- 1 file changed, 142 insertions(+), 70 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d227ac58cd..80b21d4650 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1078,10 +1078,11 @@ qemuConnectURIProbe(char **uri) return 0; } -static virDrvOpenStatus qemuConnectOpen(virConnectPtr conn, - virConnectAuthPtr auth G_GNUC_UNUS= ED, - virConf *conf G_GNUC_UNUSED, - unsigned int flags) +static virDrvOpenStatus +qemuConnectOpen(virConnectPtr conn, + virConnectAuthPtr auth G_GNUC_UNUSED, + virConf *conf G_GNUC_UNUSED, + unsigned int flags) { virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); @@ -1123,7 +1124,8 @@ static virDrvOpenStatus qemuConnectOpen(virConnectPtr= conn, return VIR_DRV_OPEN_SUCCESS; } -static int qemuConnectClose(virConnectPtr conn) +static int +qemuConnectClose(virConnectPtr conn) { virQEMUDriver *driver =3D conn->privateData; @@ -1172,7 +1174,9 @@ qemuConnectSupportsFeature(virConnectPtr conn, int fe= ature) } } -static const char *qemuConnectGetType(virConnectPtr conn) { +static const char * +qemuConnectGetType(virConnectPtr conn) +{ if (virConnectGetTypeEnsureACL(conn) < 0) return NULL; @@ -1180,19 +1184,22 @@ static const char *qemuConnectGetType(virConnectPtr= conn) { } -static int qemuConnectIsSecure(virConnectPtr conn G_GNUC_UNUSED) +static int +qemuConnectIsSecure(virConnectPtr conn G_GNUC_UNUSED) { /* Trivially secure, since always inside the daemon */ return 1; } -static int qemuConnectIsEncrypted(virConnectPtr conn G_GNUC_UNUSED) +static int +qemuConnectIsEncrypted(virConnectPtr conn G_GNUC_UNUSED) { /* Not encrypted, but remote driver takes care of that */ return 0; } -static int qemuConnectIsAlive(virConnectPtr conn G_GNUC_UNUSED) +static int +qemuConnectIsAlive(virConnectPtr conn G_GNUC_UNUSED) { return 1; } @@ -1221,7 +1228,8 @@ qemuConnectGetSysinfo(virConnectPtr conn, unsigned in= t flags) } static int -qemuConnectGetMaxVcpus(virConnectPtr conn G_GNUC_UNUSED, const char *type) +qemuConnectGetMaxVcpus(virConnectPtr conn G_GNUC_UNUSED, + const char *type) { if (virConnectGetMaxVcpusEnsureACL(conn) < 0) return -1; @@ -1241,7 +1249,9 @@ qemuConnectGetMaxVcpus(virConnectPtr conn G_GNUC_UNUS= ED, const char *type) } -static char *qemuConnectGetCapabilities(virConnectPtr conn) { +static char * +qemuConnectGetCapabilities(virConnectPtr conn) +{ virQEMUDriver *driver =3D conn->privateData; g_autoptr(virCaps) caps =3D NULL; @@ -1361,8 +1371,9 @@ qemuDomainHelperGetVcpus(virDomainObj *vm, } -static virDomainPtr qemuDomainLookupByID(virConnectPtr conn, - int id) +static virDomainPtr +qemuDomainLookupByID(virConnectPtr conn, + int id) { virQEMUDriver *driver =3D conn->privateData; virDomainObj *vm; @@ -1386,8 +1397,9 @@ static virDomainPtr qemuDomainLookupByID(virConnectPt= r conn, return dom; } -static virDomainPtr qemuDomainLookupByUUID(virConnectPtr conn, - const unsigned char *uuid) +static virDomainPtr +qemuDomainLookupByUUID(virConnectPtr conn, + const unsigned char *uuid) { virQEMUDriver *driver =3D conn->privateData; virDomainObj *vm; @@ -1413,8 +1425,9 @@ static virDomainPtr qemuDomainLookupByUUID(virConnect= Ptr conn, return dom; } -static virDomainPtr qemuDomainLookupByName(virConnectPtr conn, - const char *name) +static virDomainPtr +qemuDomainLookupByName(virConnectPtr conn, + const char *name) { virQEMUDriver *driver =3D conn->privateData; virDomainObj *vm; @@ -1439,7 +1452,8 @@ static virDomainPtr qemuDomainLookupByName(virConnect= Ptr conn, } -static int qemuDomainIsActive(virDomainPtr dom) +static int +qemuDomainIsActive(virDomainPtr dom) { virDomainObj *obj; int ret =3D -1; @@ -1457,7 +1471,8 @@ static int qemuDomainIsActive(virDomainPtr dom) return ret; } -static int qemuDomainIsPersistent(virDomainPtr dom) +static int +qemuDomainIsPersistent(virDomainPtr dom) { virDomainObj *obj; int ret =3D -1; @@ -1475,7 +1490,8 @@ static int qemuDomainIsPersistent(virDomainPtr dom) return ret; } -static int qemuDomainIsUpdated(virDomainPtr dom) +static int +qemuDomainIsUpdated(virDomainPtr dom) { virDomainObj *obj; int ret =3D -1; @@ -1493,7 +1509,9 @@ static int qemuDomainIsUpdated(virDomainPtr dom) return ret; } -static int qemuConnectGetVersion(virConnectPtr conn, unsigned long *versio= n) +static int +qemuConnectGetVersion(virConnectPtr conn, + unsigned long *version) { virQEMUDriver *driver =3D conn->privateData; unsigned int qemuVersion =3D 0; @@ -1515,7 +1533,8 @@ static int qemuConnectGetVersion(virConnectPtr conn, = unsigned long *version) } -static char *qemuConnectGetHostname(virConnectPtr conn) +static char * +qemuConnectGetHostname(virConnectPtr conn) { if (virConnectGetHostnameEnsureACL(conn) < 0) return NULL; @@ -1524,7 +1543,10 @@ static char *qemuConnectGetHostname(virConnectPtr co= nn) } -static int qemuConnectListDomains(virConnectPtr conn, int *ids, int nids) +static int +qemuConnectListDomains(virConnectPtr conn, + int *ids, + int nids) { virQEMUDriver *driver =3D conn->privateData; @@ -1535,7 +1557,9 @@ static int qemuConnectListDomains(virConnectPtr conn,= int *ids, int nids) virConnectListDomainsCheckACL, con= n); } -static int qemuConnectNumOfDomains(virConnectPtr conn) + +static int +qemuConnectNumOfDomains(virConnectPtr conn) { virQEMUDriver *driver =3D conn->privateData; @@ -1547,9 +1571,10 @@ static int qemuConnectNumOfDomains(virConnectPtr con= n) } -static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, - const char *xml, - unsigned int flags) +static virDomainPtr +qemuDomainCreateXML(virConnectPtr conn, + const char *xml, + unsigned int flags) { virQEMUDriver *driver =3D conn->privateData; g_autoptr(virDomainDef) def =3D NULL; @@ -1637,7 +1662,8 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr= conn, } -static int qemuDomainSuspend(virDomainPtr dom) +static int +qemuDomainSuspend(virDomainPtr dom) { virQEMUDriver *driver =3D dom->conn->privateData; virDomainObj *vm; @@ -1687,7 +1713,8 @@ static int qemuDomainSuspend(virDomainPtr dom) } -static int qemuDomainResume(virDomainPtr dom) +static int +qemuDomainResume(virDomainPtr dom) { virQEMUDriver *driver =3D dom->conn->privateData; virDomainObj *vm; @@ -1804,7 +1831,9 @@ qemuDomainShutdownFlagsMonitor(virDomainObj *vm, } -static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) +static int +qemuDomainShutdownFlags(virDomainPtr dom, + unsigned int flags) { virDomainObj *vm; int ret =3D -1; @@ -1862,7 +1891,9 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, = unsigned int flags) return ret; } -static int qemuDomainShutdown(virDomainPtr dom) + +static int +qemuDomainShutdown(virDomainPtr dom) { return qemuDomainShutdownFlags(dom, 0); } @@ -2112,7 +2143,10 @@ qemuDomainDestroy(virDomainPtr dom) return qemuDomainDestroyFlags(dom, 0); } -static char *qemuDomainGetOSType(virDomainPtr dom) { + +static char * +qemuDomainGetOSType(virDomainPtr dom) +{ virDomainObj *vm; char *type =3D NULL; @@ -2129,6 +2163,7 @@ static char *qemuDomainGetOSType(virDomainPtr dom) { return type; } + /* Returns max memory in kb, 0 if error */ static unsigned long long qemuDomainGetMaxMemory(virDomainPtr dom) @@ -2149,8 +2184,11 @@ qemuDomainGetMaxMemory(virDomainPtr dom) return ret; } -static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, - unsigned int flags) + +static int +qemuDomainSetMemoryFlags(virDomainPtr dom, + unsigned long newmem, + unsigned int flags) { virQEMUDriver *driver =3D dom->conn->privateData; qemuDomainObjPrivate *priv; @@ -2279,18 +2317,27 @@ static int qemuDomainSetMemoryFlags(virDomainPtr do= m, unsigned long newmem, return ret; } -static int qemuDomainSetMemory(virDomainPtr dom, unsigned long newmem) + +static int +qemuDomainSetMemory(virDomainPtr dom, + unsigned long newmem) { return qemuDomainSetMemoryFlags(dom, newmem, VIR_DOMAIN_AFFECT_LIVE); } -static int qemuDomainSetMaxMemory(virDomainPtr dom, unsigned long memory) + +static int +qemuDomainSetMaxMemory(virDomainPtr dom, + unsigned long memory) { return qemuDomainSetMemoryFlags(dom, memory, VIR_DOMAIN_MEM_MAXIMUM); } -static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, - unsigned int flags) + +static int +qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, + int period, + unsigned int flags) { virQEMUDriver *driver =3D dom->conn->privateData; qemuDomainObjPrivate *priv; @@ -2360,7 +2407,10 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainP= tr dom, int period, return ret; } -static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags) + +static int +qemuDomainInjectNMI(virDomainPtr domain, + unsigned int flags) { virDomainObj *vm =3D NULL; int ret =3D -1; @@ -2394,12 +2444,14 @@ static int qemuDomainInjectNMI(virDomainPtr domain,= unsigned int flags) return ret; } -static int qemuDomainSendKey(virDomainPtr domain, - unsigned int codeset, - unsigned int holdtime, - unsigned int *keycodes, - int nkeycodes, - unsigned int flags) + +static int +qemuDomainSendKey(virDomainPtr domain, + unsigned int codeset, + unsigned int holdtime, + unsigned int *keycodes, + int nkeycodes, + unsigned int flags) { virDomainObj *vm =3D NULL; int ret =3D -1; @@ -5641,7 +5693,9 @@ qemuDomainSetIOThreadParams(virDomainPtr dom, } -static int qemuDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPt= r seclabel) +static int +qemuDomainGetSecurityLabel(virDomainPtr dom, + virSecurityLabelPtr seclabel) { virQEMUDriver *driver =3D dom->conn->privateData; virDomainObj *vm; @@ -5682,8 +5736,10 @@ static int qemuDomainGetSecurityLabel(virDomainPtr d= om, virSecurityLabelPtr secl return ret; } -static int qemuDomainGetSecurityLabelList(virDomainPtr dom, - virSecurityLabelPtr* seclabels) + +static int +qemuDomainGetSecurityLabelList(virDomainPtr dom, + virSecurityLabelPtr* seclabels) { virQEMUDriver *driver =3D dom->conn->privateData; virDomainObj *vm; @@ -5744,8 +5800,9 @@ static int qemuDomainGetSecurityLabelList(virDomainPt= r dom, } -static int qemuNodeGetSecurityModel(virConnectPtr conn, - virSecurityModelPtr secmodel) +static int +qemuNodeGetSecurityModel(virConnectPtr conn, + virSecurityModelPtr secmodel) { virQEMUDriver *driver =3D conn->privateData; g_autoptr(virCaps) caps =3D NULL; @@ -6199,9 +6256,9 @@ qemuDomainManagedSaveDefineXML(virDomainPtr dom, cons= t char *dxml, } -static char -*qemuDomainGetXMLDesc(virDomainPtr dom, - unsigned int flags) +static char * +qemuDomainGetXMLDesc(virDomainPtr dom, + unsigned int flags) { virQEMUDriver *driver =3D dom->conn->privateData; virDomainObj *vm; @@ -6245,10 +6302,11 @@ static char } -static char *qemuConnectDomainXMLToNative(virConnectPtr conn, - const char *format, - const char *xmlData, - unsigned int flags) +static char * +qemuConnectDomainXMLToNative(virConnectPtr conn, + const char *format, + const char *xmlData, + unsigned int flags) { virQEMUDriver *driver =3D conn->privateData; g_autoptr(virDomainObj) vm =3D NULL; @@ -6308,8 +6366,11 @@ static char *qemuConnectDomainXMLToNative(virConnect= Ptr conn, } -static int qemuConnectListDefinedDomains(virConnectPtr conn, - char **const names, int nnames) { +static int +qemuConnectListDefinedDomains(virConnectPtr conn, + char **const names, + int nnames) +{ virQEMUDriver *driver =3D conn->privateData; if (virConnectListDefinedDomainsEnsureACL(conn) < 0) @@ -6320,7 +6381,9 @@ static int qemuConnectListDefinedDomains(virConnectPt= r conn, conn); } -static int qemuConnectNumOfDefinedDomains(virConnectPtr conn) + +static int +qemuConnectNumOfDefinedDomains(virConnectPtr conn) { virQEMUDriver *driver =3D conn->privateData; @@ -7794,14 +7857,18 @@ qemuDomainDetachDeviceAlias(virDomainPtr dom, } -static int qemuDomainDetachDevice(virDomainPtr dom, const char *xml) +static int +qemuDomainDetachDevice(virDomainPtr dom, + const char *xml) { return qemuDomainDetachDeviceFlags(dom, xml, VIR_DOMAIN_AFFECT_LIVE); } -static int qemuDomainGetAutostart(virDomainPtr dom, - int *autostart) + +static int +qemuDomainGetAutostart(virDomainPtr dom, + int *autostart) { virDomainObj *vm; int ret =3D -1; @@ -7820,8 +7887,10 @@ static int qemuDomainGetAutostart(virDomainPtr dom, return ret; } -static int qemuDomainSetAutostart(virDomainPtr dom, - int autostart) + +static int +qemuDomainSetAutostart(virDomainPtr dom, + int autostart) { virQEMUDriver *driver =3D dom->conn->privateData; virDomainObj *vm; @@ -7986,8 +8055,9 @@ qemuDomainSetAutostartOnce(virDomainPtr dom, } -static char *qemuDomainGetSchedulerType(virDomainPtr dom, - int *nparams) +static char * +qemuDomainGetSchedulerType(virDomainPtr dom, + int *nparams) { char *ret =3D NULL; virDomainObj *vm =3D NULL; @@ -18915,9 +18985,11 @@ qemuDomainRenameCallback(virDomainObj *vm, return ret; } -static int qemuDomainRename(virDomainPtr dom, - const char *new_name, - unsigned int flags) + +static int +qemuDomainRename(virDomainPtr dom, + const char *new_name, + unsigned int flags) { virQEMUDriver *driver =3D dom->conn->privateData; virDomainObj *vm =3D NULL; --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777549943; cv=none; d=zohomail.com; s=zohoarc; b=nam+yeR1Vh5VdJjX1bZG1qiH5xlco8slDiMJ5ClWUv/2Kkt/3XrveYVrokspLNC2fbX7EuZfnYq99PaOl9ku38LHTKfHOVNI2Ba+p4n0HIe6Oudv0orVQ3sTgt9vSlP9vWalxz0kAXuDwF+Y3YF8WlQMBEfoDl0PgANgphICye4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777549943; 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=2OC0pl+oJwU9XKqb8GZlMWIn3CPz3f9+Yr9/BjKSVfQ=; b=RCuFtq18YGG70VQWYSGMMCRCIp1jcXpNDJcWbFhZHkUiBOxpaMDPDHVXQ0yT9L57KAKUzzIXzAW8gsF+KXJ4IXaZf8HX37SpCKKmqb4gjVabu++lsRTnwBJpuaOCbgonbvRiHGWmb+daki4viR+0sgDhtlV9vMB3gMdiDsQMzjE= 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 1777549943326115.70995422277531; Thu, 30 Apr 2026 04:52:23 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 48A4841851; Thu, 30 Apr 2026 07:52:22 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 7E84A418E5; Thu, 30 Apr 2026 07:44:39 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 393B43F349; Thu, 30 Apr 2026 07:44:01 -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 40CB33F282 for ; Thu, 30 Apr 2026 07:44:00 -0400 (EDT) Received: from mx-prod-mc-08.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-240-7IIu3Z2pMA6inu-TwyUW9Q-1; Thu, 30 Apr 2026 07:43:58 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B9C671800378 for ; Thu, 30 Apr 2026 11:43:57 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 139DE300019F for ; Thu, 30 Apr 2026 11:43:56 +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=1777549439; 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=2OC0pl+oJwU9XKqb8GZlMWIn3CPz3f9+Yr9/BjKSVfQ=; b=AHYl8M5XIvCRQ0Z+MJhxXmfw75hIO7bpTqTZ0maTTr3j4i5YpnJUjI9D67FMH8FvsGISdh KMtqAJ+6BfeDu6N1T7Oxzv8dxNRTeSHzZofN5B72T+BE3Y8iT+4HXHas8U3siSLCcvzb+P PLY7wSLcq8QBuF9vJyFsz8f+iG8fMX4= X-MC-Unique: 7IIu3Z2pMA6inu-TwyUW9Q-1 X-Mimecast-MFC-AGG-ID: 7IIu3Z2pMA6inu-TwyUW9Q_1777549437 To: devel@lists.libvirt.org Subject: [PATCH v2 03/35] util: typedparam: Convert VIR_TYPED_PARAM_CHECK_TYPE into a function Date: Thu, 30 Apr 2026 13:43:19 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ykKxQYLJrB9IIO0_jDNwOZNjEDVHAsYhHlXKNtVOqBo_1777549437 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IS4QV6JI2IGX7MYRKVUQGKW33AUFG4KK X-Message-ID-Hash: IS4QV6JI2IGX7MYRKVUQGKW33AUFG4KK 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: 1777549944760158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Create 'virTypedParamValidateType' which will use the same logic encapsulated in a function. Use the error message wording from 'virTypedParamsValidate' as it contains less fluff. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virtypedparam-public.c | 54 +++++++++++++++++++++------------ src/util/virtypedparam.c | 27 +++++++++++++++++ src/util/virtypedparam.h | 4 +++ 3 files changed, 66 insertions(+), 19 deletions(-) diff --git a/src/util/virtypedparam-public.c b/src/util/virtypedparam-publi= c.c index 3486623a9c..8a953ed20f 100644 --- a/src/util/virtypedparam-public.c +++ b/src/util/virtypedparam-public.c @@ -147,18 +147,6 @@ virTypedParamsGet(virTypedParameterPtr params, } -#define VIR_TYPED_PARAM_CHECK_TYPE(check_type) \ - do { if (param->type !=3D check_type) { \ - virReportError(VIR_ERR_INVALID_ARG, \ - _("Invalid type '%1$s' requested for parameter '%2$= s', actual type is '%3$s'"), \ - virTypedParameterTypeToString(check_type), \ - name, \ - virTypedParameterTypeToString(param->type)); \ - virDispatchError(NULL); \ - return -1; \ - } } while (0) - - /** * virTypedParamsGetInt: * @params: array of typed parameters @@ -189,7 +177,11 @@ virTypedParamsGetInt(virTypedParameterPtr params, if (!(param =3D virTypedParamsGet(params, nparams, name))) return 0; - VIR_TYPED_PARAM_CHECK_TYPE(VIR_TYPED_PARAM_INT); + if (virTypedParamValidateType(param, VIR_TYPED_PARAM_INT) < 0) { + virDispatchError(NULL); + return -1; + } + if (value) *value =3D param->value.i; @@ -227,7 +219,11 @@ virTypedParamsGetUInt(virTypedParameterPtr params, if (!(param =3D virTypedParamsGet(params, nparams, name))) return 0; - VIR_TYPED_PARAM_CHECK_TYPE(VIR_TYPED_PARAM_UINT); + if (virTypedParamValidateType(param, VIR_TYPED_PARAM_UINT) < 0) { + virDispatchError(NULL); + return -1; + } + if (value) *value =3D param->value.ui; @@ -265,7 +261,11 @@ virTypedParamsGetLLong(virTypedParameterPtr params, if (!(param =3D virTypedParamsGet(params, nparams, name))) return 0; - VIR_TYPED_PARAM_CHECK_TYPE(VIR_TYPED_PARAM_LLONG); + if (virTypedParamValidateType(param, VIR_TYPED_PARAM_LLONG) < 0) { + virDispatchError(NULL); + return -1; + } + if (value) *value =3D param->value.l; @@ -303,7 +303,11 @@ virTypedParamsGetULLong(virTypedParameterPtr params, if (!(param =3D virTypedParamsGet(params, nparams, name))) return 0; - VIR_TYPED_PARAM_CHECK_TYPE(VIR_TYPED_PARAM_ULLONG); + if (virTypedParamValidateType(param, VIR_TYPED_PARAM_ULLONG) < 0) { + virDispatchError(NULL); + return -1; + } + if (value) *value =3D param->value.ul; @@ -341,7 +345,11 @@ virTypedParamsGetDouble(virTypedParameterPtr params, if (!(param =3D virTypedParamsGet(params, nparams, name))) return 0; - VIR_TYPED_PARAM_CHECK_TYPE(VIR_TYPED_PARAM_DOUBLE); + if (virTypedParamValidateType(param, VIR_TYPED_PARAM_DOUBLE) < 0) { + virDispatchError(NULL); + return -1; + } + if (value) *value =3D param->value.d; @@ -379,7 +387,11 @@ virTypedParamsGetBoolean(virTypedParameterPtr params, if (!(param =3D virTypedParamsGet(params, nparams, name))) return 0; - VIR_TYPED_PARAM_CHECK_TYPE(VIR_TYPED_PARAM_BOOLEAN); + if (virTypedParamValidateType(param, VIR_TYPED_PARAM_BOOLEAN) < 0) { + virDispatchError(NULL); + return -1; + } + if (value) *value =3D !!param->value.b; @@ -419,7 +431,11 @@ virTypedParamsGetString(virTypedParameterPtr params, if (!(param =3D virTypedParamsGet(params, nparams, name))) return 0; - VIR_TYPED_PARAM_CHECK_TYPE(VIR_TYPED_PARAM_STRING); + if (virTypedParamValidateType(param, VIR_TYPED_PARAM_STRING) < 0) { + virDispatchError(NULL); + return -1; + } + if (value) *value =3D param->value.s; diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index f25530a735..0b40c14f90 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -42,6 +42,33 @@ VIR_ENUM_IMPL(virTypedParameter, "string", ); + +/** + * virTypedParamValidateType: + * @param: typed parameter to validate + * @expected_type: type to look for + * + * Validates that @param is a parameter of @expected type. + * + * Returns 0 on success; -1 on error and reports an error. + */ +int +virTypedParamValidateType(virTypedParameterPtr param, + unsigned int expected_type) +{ + if (param->type !=3D expected_type) { + virReportError(VIR_ERR_INVALID_ARG, + _("invalid type '%1$s' for parameter '%2$s', expect= ed '%3$s'"), + virTypedParameterTypeToString(expected_type), + param->field, + virTypedParameterTypeToString(param->type)); + return -1; + } + + return 0; +} + + static int virTypedParamsSortName(const void *left, const void *right, diff --git a/src/util/virtypedparam.h b/src/util/virtypedparam.h index 774744244a..c1fc28c612 100644 --- a/src/util/virtypedparam.h +++ b/src/util/virtypedparam.h @@ -63,6 +63,10 @@ struct _virTypedParameterRemote { virTypedParameterRemoteValue value; }; +int +virTypedParamValidateType(virTypedParameterPtr param, + unsigned int expected_type) + G_GNUC_WARN_UNUSED_RESULT; int virTypedParamsValidate(virTypedParameterPtr params, --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777550010; cv=none; d=zohomail.com; s=zohoarc; b=lFMYjgdZJDLStLntyZ2gVxWrxOuew/QLdAe6OcDlx8bszl5FJ/2AI47gyzugJkdwayn03SudTadZez0NggeKMgj/eOfk0gnCWEOWlMFFUgKjmGEKcQIfe/brcC5VnBe1HNrw+mE5Hi/FeBkMzvYywBM6Hh90iWLizA8wqlgKYWo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777550010; 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=kWtchHFcOjpVLWnoZhzFHS8sUjCHu0nTV1E5Z4Tio5k=; b=IdXY7TsjCG1k2s6LfYaGcuYdM92V5yNhANXqx9LNTNiVp0sb5U/sDvJ2zsYQeXo+sfakity99Uib55Da41bDO7iEQHnF3SKwzKTV3Bn2H0SdprVlH/0zIlgJqnzpuf+D0FFYNlVGzd2W0avhNB44V+D7H4XS2eDQyn78STCA68E= 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 1777550010768268.4610185458413; Thu, 30 Apr 2026 04:53:30 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 106D44186F; Thu, 30 Apr 2026 07:53:29 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 4F0AD41B44; Thu, 30 Apr 2026 07:44:47 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 1C18B3F282; Thu, 30 Apr 2026 07:44:02 -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 8BAD93F2F2 for ; Thu, 30 Apr 2026 07:44:01 -0400 (EDT) Received: from mx-prod-mc-08.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-138-SKuo_xaAOdOkon-ZQnH0Qw-1; Thu, 30 Apr 2026 07:43:59 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0ADB21800370 for ; Thu, 30 Apr 2026 11:43:59 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3889B300019F for ; Thu, 30 Apr 2026 11:43:57 +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=1777549441; 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=kWtchHFcOjpVLWnoZhzFHS8sUjCHu0nTV1E5Z4Tio5k=; b=g4y5Z7qmdEtMgPwrRP5wDSg0VpLgtJHya/nsoxz3WJiatOUDk0TEYYM3/Zz4OI/FIWa8jU wwOPs1gCbS3+9CjMQC6sRX9jW+8BkLJh9EcAap3OPQkeNtQrzsBeDeVfNGBRDrFwcB20UC Ez6GxNqPSYKiGKMLSQo3V6li1CJLNE4= X-MC-Unique: SKuo_xaAOdOkon-ZQnH0Qw-1 X-Mimecast-MFC-AGG-ID: SKuo_xaAOdOkon-ZQnH0Qw_1777549439 To: devel@lists.libvirt.org Subject: [PATCH v2 04/35] util: virTypedParamValidateType: Don't report unknown typed parameter type as '(null)' Date: Thu, 30 Apr 2026 13:43:20 +0200 Message-ID: <60682b828e3fd15ddb9105227d241bec58d16167.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Oax3b2QGWkxJYB4bbBD25VNvKE8IJYOuyeVP_Mu4YSs_1777549439 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: VZGZC5BUBRPVJHVNV6QJWOYJ5JBXKWCM X-Message-ID-Hash: VZGZC5BUBRPVJHVNV6QJWOYJ5JBXKWCM 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: 1777550014064154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa If the actual type of the typed parameter is an invalid number the type checker would still attempt to convert it to a string resuling in an attempt to print a NULL string. libc saves us from the crash but the error message is still wrong. Fix it. Fixes: 54dd75fd97339dd49a54554e9327e5680c72132b Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virtypedparam.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index 0b40c14f90..6cfdd3276d 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -56,6 +56,13 @@ int virTypedParamValidateType(virTypedParameterPtr param, unsigned int expected_type) { + if (param->type <=3D 0 || param->type >=3D VIR_TYPED_PARAM_LAST) { + virReportError(VIR_ERR_INVALID_ARG, + _("unknown type ('%1$d') of parameter '%2$s'"), + param->type, param->field); + return -1; + } + if (param->type !=3D expected_type) { virReportError(VIR_ERR_INVALID_ARG, _("invalid type '%1$s' for parameter '%2$s', expect= ed '%3$s'"), --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777550129; cv=none; d=zohomail.com; s=zohoarc; b=YjXZNsalbDO1logF/txqzErXIgCcCGV3UP3Vf//DLYyoSn+4OnyFJx+PCXOkSqLBfgC4nkVXiKovyxY2kNoeaG094AdeeI4NOR4pVtfCLUjUiA3jYqyXCXzdZNiMOP4nNJuK34Km3cMuhyX3oe33f9VMD7IKO2uJ76Qr4XueNC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777550129; 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=L7MiqOFOgqiamR654DY4YiVM0R9wbxLoBw6yjC1WIu8=; b=KMyqiQgnITVGVfsz/EFgGHhvLb42tsbIRRzRG6J3sLgznRSXYtVHyWVPRSRj1CcmG7W5Noa7W4bMEQvAvRH5c+7fGFVCsQyCbhg2DQuzzNrNVVIjXfVEhSNFw5/p/5ISqhOpCbW+3LGvV7WmPXJmrH89FpZGl+rBB/jFm8toAiM= 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 1777550129719758.6744933003131; Thu, 30 Apr 2026 04:55:29 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id BEF3241AE0; Thu, 30 Apr 2026 07:55:28 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 9C6C041B86; Thu, 30 Apr 2026 07:44:55 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 0558D3F34D; Thu, 30 Apr 2026 07:44:03 -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 EF7D93F34D for ; Thu, 30 Apr 2026 07:44:02 -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-693-FuMVOpg4PNecx19uCVkpMA-1; Thu, 30 Apr 2026 07:44:01 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 43AB0180034A for ; Thu, 30 Apr 2026 11:44:00 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 888E3300019F for ; Thu, 30 Apr 2026 11:43:59 +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_H4, 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=1777549442; 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=L7MiqOFOgqiamR654DY4YiVM0R9wbxLoBw6yjC1WIu8=; b=SxTbIPGyx+ZKEt6yQ9zgKDemX9Qj8oNp4F+/2C46MTLsBNz1Ot9ex1xWYqgkqQTii/2oY6 nILW8doeKR7fTTV7EBsGean/MOY+x8vNBpVk7QMm6CSaHxLVQQ74xXhtJA/MFneXxBd65D D2iOy7wrTvEZIYbb0aqShvPNCKah0Eg= X-MC-Unique: FuMVOpg4PNecx19uCVkpMA-1 X-Mimecast-MFC-AGG-ID: FuMVOpg4PNecx19uCVkpMA_1777549440 To: devel@lists.libvirt.org Subject: [PATCH v2 05/35] util: Replace open-coded internals of VIR_TYPED_PARAMS_DEBUG with 'virTypedParamDebugstr' Date: Thu, 30 Apr 2026 13:43:21 +0200 Message-ID: <5d8205e1b0286d9aae60ad6bd460124377973447.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: yOcOvfAkditAkQ3v0A-Nz8b5M5nn4WGu1zKsDNLYe4A_1777549440 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: XLQSLVRAJRSDKFLLYTTCOK6ZH27FYFYF X-Message-ID-Hash: XLQSLVRAJRSDKFLLYTTCOK6ZH27FYFYF 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: 1777550134216154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Replace the internals of the macro by a function so that 'virTypedParameterToString' doesn't need to be exported as it also adds mappings for values which don't exist in the public API. This change also prevents a NULL to be passed to string formatters in case when the caller sends an unknown typed parameter type as we now also make sure that the type is in range. Fixes: 54dd75fd97339dd49a54554e9327e5680c72132b Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 + src/util/virtypedparam.c | 25 +++++++++++++++++++++++++ src/util/virtypedparam.h | 11 +++++------ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index cf0e71cc6a..9f02f74847 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3652,6 +3652,7 @@ virTPMSwtpmSetupFeatureTypeFromString; # util/virtypedparam.h +virTypedParamDebugstr; virTypedParameterAssign; virTypedParameterToString; virTypedParameterTypeFromString; diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index 6cfdd3276d..77c9279eff 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -1109,3 +1109,28 @@ virTypedParamListAddDouble(virTypedParamList *list, virTypedParamSetNameVPrintf(list, par, namefmt, ap); va_end(ap); } + + +/** + * virTypedParamDebugstr: + * @param: typed parameter + * + * Format @param into a string used for debug prints in public API handler= s. + * This must make sure to work on unknown typed parameter types. + * + * Returns the formatted string; caller must free it. + */ +char * +virTypedParamDebugstr(virTypedParameterPtr param) +{ + g_autofree char *value =3D virTypedParameterToString(param); + int type =3D param->type; + + if (type < 0 || type > VIR_TYPED_PARAM_LAST) + type =3D 0; + + return g_strdup_printf("params[\"%s\"]=3D(%s)%s", + param->field, + virTypedParameterTypeToString(type), + NULLSTR(value)); +} diff --git a/src/util/virtypedparam.h b/src/util/virtypedparam.h index c1fc28c612..3d6f6b999c 100644 --- a/src/util/virtypedparam.h +++ b/src/util/virtypedparam.h @@ -140,18 +140,17 @@ virTypedParamsSerialize(virTypedParameterPtr params, VIR_ENUM_DECL(virTypedParameter); +char * +virTypedParamDebugstr(virTypedParameterPtr param); + #define VIR_TYPED_PARAMS_DEBUG(params, nparams) \ do { \ int _i; \ if (!params) \ break; \ for (_i =3D 0; _i < (nparams); _i++) { \ - char *_value =3D virTypedParameterToString((params) + _i); \ - VIR_DEBUG("params[\"%s\"]=3D(%s)%s", \ - (params)[_i].field, \ - virTypedParameterTypeToString((params)[_i].type), \ - NULLSTR(_value)); \ - VIR_FREE(_value); \ + g_autofree char *_debugstr =3D virTypedParamDebugstr((params) = + _i); \ + VIR_DEBUG("%s", _debugstr); \ } \ } while (0) --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777550201; cv=none; d=zohomail.com; s=zohoarc; b=C/PyM/975E8Rv8n77eqPPLHM1o+IWeYweREUhqr9cENm5N5xsNTt8VYkVslDycrnjEJ5BJ9ZVI3IGxS58rHJXlm3Nc7Ypkc1a+2qErdY4jZ+6kS7i4F6OlUcrmafhujgiGWZPMs9fyVk9jZ+HLBNA3RhqpkfrJ90hMijZr3XuEc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777550201; 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=H66wGIM25qF301SlYd/aNA+W47deEk4KTYdS4zdmYDk=; b=FLdEjmqIg8WErhCSO3vPHi/bZbI4tachCJUcGqqJlk1+xv/nGlVZ+My58lTiEX2PbOmhrJNC2qJaX79tk0xQuXR7XGmbrpLbIvaEaumVTFu25NCU/JudKm1Ka4+0oXCcffWAWBNndKu4kXX8zMr6LEnOoa6lkZwODKU3YXPDq1Y= 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 1777550201818228.170447382538; Thu, 30 Apr 2026 04:56:41 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D862041919; Thu, 30 Apr 2026 07:56:40 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 9F8D641BCB; Thu, 30 Apr 2026 07:45:01 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8B1F24180B; Thu, 30 Apr 2026 07:44:13 -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 5C752417DE for ; Thu, 30 Apr 2026 07:44:04 -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-209-t6PeMnD4NCq_ul4wxM08xQ-1; Thu, 30 Apr 2026 07:44:02 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 64CE6195609D for ; Thu, 30 Apr 2026 11:44:01 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AC1E5300019F for ; Thu, 30 Apr 2026 11:44:00 +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_H4, 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=1777549443; 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=H66wGIM25qF301SlYd/aNA+W47deEk4KTYdS4zdmYDk=; b=SWIi8mk5+NVUJVqw30AJmvphZTzj527DwdtHekXzN1iX/q8YzQXf0Ii1hjWb+ztld5OkG7 T+imDAUJN1rR04if0Mls1XkUDmg7V9eRQhxrpAAaHd48UTTUxVhnE32X3NXLiwGwJHyjvj D/LCja83WxmXW7i5KyFNcljSqWf5JrQ= X-MC-Unique: t6PeMnD4NCq_ul4wxM08xQ-1 X-Mimecast-MFC-AGG-ID: t6PeMnD4NCq_ul4wxM08xQ_1777549441 To: devel@lists.libvirt.org Subject: [PATCH v2 06/35] util: typedparam: Unexport virTypedParameterTypeFromString/virTypedParameterTypeToString Date: Thu, 30 Apr 2026 13:43:22 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 1tW34pkIEQizd4MCKvkSCKMbzGepW6MfXzpdtwJLTOg_1777549441 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 2L72ETPA5LGQMHL5STRCVABMYPR266CB X-Message-ID-Hash: 2L72ETPA5LGQMHL5STRCVABMYPR266CB 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: 1777550204116158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The enum handler implementation has already some special values, upcoming patches will add more so keep the only internal to avoid surprises. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 2 -- src/util/virtypedparam.c | 2 ++ src/util/virtypedparam.h | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 9f02f74847..37c9c73d92 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3655,8 +3655,6 @@ virTPMSwtpmSetupFeatureTypeFromString; virTypedParamDebugstr; virTypedParameterAssign; virTypedParameterToString; -virTypedParameterTypeFromString; -virTypedParameterTypeToString; virTypedParamListAddBoolean; virTypedParamListAddDouble; virTypedParamListAddInt; diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index 77c9279eff..0b494e60fd 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -30,6 +30,8 @@ #define VIR_FROM_THIS VIR_FROM_NONE +VIR_ENUM_DECL(virTypedParameter); + VIR_ENUM_IMPL(virTypedParameter, VIR_TYPED_PARAM_LAST, "unknown", diff --git a/src/util/virtypedparam.h b/src/util/virtypedparam.h index 3d6f6b999c..819166ff1b 100644 --- a/src/util/virtypedparam.h +++ b/src/util/virtypedparam.h @@ -138,8 +138,6 @@ virTypedParamsSerialize(virTypedParameterPtr params, unsigned int *remote_params_len, unsigned int flags); -VIR_ENUM_DECL(virTypedParameter); - char * virTypedParamDebugstr(virTypedParameterPtr param); --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777550290; cv=none; d=zohomail.com; s=zohoarc; b=I4U4ex6n1rvnOvf/nnVwqdobx7PoxnjSkTgnfOtmwd3cab0qLgtVD+mRYbD/Sk4Q5Wc4x2lyyALCzUeElGLNI2rRYVtsqAqIkApdkAc7rws4LsS0/OkbhICX3PWbq+K9scAYVSLwowUDM4oLceNlNICGGmg4jAEkWg0M4Tm1Q3k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777550290; 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=jej3UJZUh+WkWHty6ui3SbFEiXHKrS/k9CBbqo06pI8=; b=nDkVqaZ1HSusSGjFSzFH5n4BFOoS2UFDy2fA3VrsPP/dZZOgb/v1wfL+vojCHXEMOCo3/UuBRqWO9qByB/XlM8+a7TYr1yi6yhF9ibRBBs9r7HH2ZVN3G0XtlYZLWZYPHibaFp620+XIWqIZaYQY7cBV3J8qoZ0wrGOqD+opK4g= 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 1777550290566253.19671691862595; Thu, 30 Apr 2026 04:58:10 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id C83014190B; Thu, 30 Apr 2026 07:58:09 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 04FEF41C4F; Thu, 30 Apr 2026 07:45:07 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 9EBF041825; Thu, 30 Apr 2026 07:44:22 -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 2B67141818 for ; Thu, 30 Apr 2026 07:44:05 -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-29-QrKUOdT-MsGaBr2uQrv1QQ-1; Thu, 30 Apr 2026 07:44:03 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 7CA8B1800451 for ; Thu, 30 Apr 2026 11:44:02 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C8F3C300019F for ; Thu, 30 Apr 2026 11:44:01 +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_H4, 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=1777549444; 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=jej3UJZUh+WkWHty6ui3SbFEiXHKrS/k9CBbqo06pI8=; b=Req2amHmFTPDOTJgx0PN7QDh0+fqI0HydJvRwsD/WHlBakfs+7kOGjKziizAtyCPk3k7Gu yL0q3f8FHnnlMtHY+qchF9FFeb5uFAdNjej4nVDc2Pa17WThL4X1NzyPw1KMhh+FlPj9p/ RLkmguTvHbGPL8nj/w3hDPw1RqbyqQc= X-MC-Unique: QrKUOdT-MsGaBr2uQrv1QQ-1 X-Mimecast-MFC-AGG-ID: QrKUOdT-MsGaBr2uQrv1QQ_1777549442 To: devel@lists.libvirt.org Subject: [PATCH v2 07/35] util: typedparam: Refactor and fix typed param validation Date: Thu, 30 Apr 2026 13:43:23 +0200 Message-ID: <7df7411a1650a0f8ac058e803d7b37ffe8d4683c.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: xMSAG5gXB2jKt1l8fWkSto6hcLdDZ5Z0epE0tFvdkZQ_1777549442 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 5PFNP7DPTTHMV252WM7NNQ6RLMFQHN6L X-Message-ID-Hash: 5PFNP7DPTTHMV252WM7NNQ6RLMFQHN6L 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: 1777550292100154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa 'virTypedParamsValidate' has special logic to handle the internal VIR_TYPED_PARAM_UNSIGNED type, but unfortunately the implementation of the error which is reported is flawed as it only updated the 'expecttype' string when the type actually matched. In cases when it didn't we'd report the following error: error: invalid argument: invalid type 'string' for parameter 'poll_shrink= ', expected '(null)' To fix it we can re-implement the validation part by using virTypedParamValidateType simply by adding the VIR_TYPED_PARAM_UNSIGNED to 'virTypedParameterTypeToString' handling which is now private and adding logic to allow either one of the unsigned types, which allows us to use the same function in both cases, simplifying the code. Fixes: 07652410a7af98ca03281c4bfe20415ced26a44a Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virtypedparam.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index 0b494e60fd..ec8046b998 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -33,7 +33,7 @@ VIR_ENUM_DECL(virTypedParameter); VIR_ENUM_IMPL(virTypedParameter, - VIR_TYPED_PARAM_LAST, + VIR_TYPED_PARAM_UNSIGNED + 1, "unknown", "int", "uint", @@ -42,6 +42,8 @@ VIR_ENUM_IMPL(virTypedParameter, "double", "boolean", "string", + "", /* VIR_TYPED_PARAM_LAST */ + "uint, ullong", /* VIR_TYPED_PARAM_UNSIGNED */ ); @@ -50,7 +52,9 @@ VIR_ENUM_IMPL(virTypedParameter, * @param: typed parameter to validate * @expected_type: type to look for * - * Validates that @param is a parameter of @expected type. + * Validates that @param is a parameter of @expected type. If @expected_ty= pe is + * VIR_TYPED_PARAM_UNSIGNED, both VIR_TYPED_PARAM_UINT and VIR_TYPED_PARAM= _ULLONG + * are accepted. * * Returns 0 on success; -1 on error and reports an error. */ @@ -65,7 +69,10 @@ virTypedParamValidateType(virTypedParameterPtr param, return -1; } - if (param->type !=3D expected_type) { + if (!(param->type =3D=3D expected_type || + (expected_type =3D=3D VIR_TYPED_PARAM_UNSIGNED && + (param->type =3D=3D VIR_TYPED_PARAM_UINT || + param->type =3D=3D VIR_TYPED_PARAM_ULLONG)))) { virReportError(VIR_ERR_INVALID_ARG, _("invalid type '%1$s' for parameter '%2$s', expect= ed '%3$s'"), virTypedParameterTypeToString(expected_type), @@ -147,9 +154,6 @@ virTypedParamsValidate(virTypedParameterPtr params, int= nparams, ...) if (STRNEQ(sorted[i].field, keys[j].field)) { j++; } else { - const char *expecttype =3D virTypedParameterTypeToString(keys[= j].type); - int type =3D sorted[i].type; - if (STREQ_NULLABLE(last_name, sorted[i].field) && !(keys[j].value.i & VIR_TYPED_PARAM_MULTIPLE)) { virReportError(VIR_ERR_INVALID_ARG, @@ -158,24 +162,9 @@ virTypedParamsValidate(virTypedParameterPtr params, in= t nparams, ...) return -1; } - if (keys[j].type =3D=3D VIR_TYPED_PARAM_UNSIGNED && - (type =3D=3D VIR_TYPED_PARAM_UINT || - type =3D=3D VIR_TYPED_PARAM_ULLONG)) { - type =3D VIR_TYPED_PARAM_UNSIGNED; - expecttype =3D "uint, ullong"; - } - - if (type !=3D keys[j].type) { - const char *badtype; - - badtype =3D virTypedParameterTypeToString(sorted[i].type); - if (!badtype) - badtype =3D virTypedParameterTypeToString(0); - virReportError(VIR_ERR_INVALID_ARG, - _("invalid type '%1$s' for parameter '%2$s'= , expected '%3$s'"), - badtype, sorted[i].field, expecttype); + if (virTypedParamValidateType(sorted + i, keys[j].type) < 0) return -1; - } + last_name =3D sorted[i].field; i++; } --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777550349; cv=none; d=zohomail.com; s=zohoarc; b=fASiByMxX5UPbsUbBQ+v46KW8qZzQMis01nkcEhd/b9TuF7a8o6IaMaCZxIlHZ9ahxS3yUkKKI8b+F1DSw3MHkeDXjNL8HXtKL+MehQVferq5UAzzRT7MPK3GMbNiBfLG5hJQPXcsVQtUNLlRTlmH//8wmDCOzcTMYRwjy1z0LI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777550349; 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=ElhveTMOpIRqL78DfTqsiD6hMvJmoibufoWZ8VL/LUQ=; b=PZ+sxK1Nxr7CJ5gen1nOh8UdC+5Z7NO6ri0WQFNZ5gNrTgQAV19pJFk/alLkGgnSOhs5KruewTcJeViOsIeHtRS3TyuiTGF71i8E/7MjxkktbbHfuDQt+oVKDumRxVGzm8eK7fVEfpTIF0TTUPybZfcIb6VA7PtBxI1a7P5fX/I= 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 1777550349412284.86324488762693; Thu, 30 Apr 2026 04:59:09 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 6892641907; Thu, 30 Apr 2026 07:59:08 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 4332A41CBC; Thu, 30 Apr 2026 07:45:14 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 5BFB3418E7; Thu, 30 Apr 2026 07:44:26 -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 A1DAE4189B for ; Thu, 30 Apr 2026 07:44:06 -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-343-rqrTCRSiOkel6fjzMs51rA-1; Thu, 30 Apr 2026 07:44:04 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 9C02119560A7 for ; Thu, 30 Apr 2026 11:44:03 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E0D42300019F for ; Thu, 30 Apr 2026 11:44:02 +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_H4, 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=1777549446; 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=ElhveTMOpIRqL78DfTqsiD6hMvJmoibufoWZ8VL/LUQ=; b=RZ0Iyw2Qj1XF3DgIflpT3lluZke71vOu927vgdlhiZake2L2qj23Eb29O8bvg7374STdMI iYlOIeYp50TufjMdKJd7fxseqlSzxQDef3zt8bTDEqaz2kryIBe/tYOWHuc9rSUXAtJBfC zdqnvPaXGSLMAhriu1IN2r4BtsDO8LU= X-MC-Unique: rqrTCRSiOkel6fjzMs51rA-1 X-Mimecast-MFC-AGG-ID: rqrTCRSiOkel6fjzMs51rA_1777549443 To: devel@lists.libvirt.org Subject: [PATCH v2 08/35] scripts: check-symfile: Allow also symbols in 'readonly' section Date: Thu, 30 Apr 2026 13:43:24 +0200 Message-ID: <61263a87dc55075f67428a2a8c459355b16f1b1d.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: pVcVMdgsddeLmiXN0fZY04YtxQ7eKcDjAWzFxALqd5g_1777549443 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IUEDRQIYQMQVRR3K3ATHKIS4SVR6RGYG X-Message-ID-Hash: IUEDRQIYQMQVRR3K3ATHKIS4SVR6RGYG 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: 1777550350367158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Validate also variables exported as 'extern' e.g. from the util submodule. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- scripts/check-symfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-symfile.py b/scripts/check-symfile.py index c2ee405118..e4149b771e 100755 --- a/scripts/check-symfile.py +++ b/scripts/check-symfile.py @@ -61,7 +61,7 @@ for elflib in elflibs: for line in nm: line =3D line.decode("utf-8") - symmatch =3D re.search(r'''^\S+\s(?:[TBSDG])\s(\S+)\s*$''', line) + symmatch =3D re.search(r'''^\S+\s(?:[TBSDGR])\s(\S+)\s*$''', line) if symmatch is None: continue --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777550542; cv=none; d=zohomail.com; s=zohoarc; b=kHA6EmgHvJ4MTm9VuaP85DwaBf+JiV+hmcbJRuVnQ7ik73EUQeG3UzqnCMRNTNeUDCtcnrxECmLBvHYBfoBNq8+/qh6pGand9eMKZZhB/9B3vKXG2X2a9DEcwIhXpvpxk1YwwSGHfPRHxUMSQ/q/x8m1i6oFwhE+dCjb566XA54= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777550542; 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=vnEFedf9kih/6UR6L2fA00DGNib56VwZIDO4QjJ8UYc=; b=ku67gI47iKTX6eLrpcyrja5n1r9Sy/aT68M4f72+v0ve2H6htwvCZ5Y9kxbBNlt09faFfjrudZ+yfmIFP/G4TN0IgL+6l8eWH7PT2xRd4ixHyOTJRAaPSiOf2L+B/C/4BY54mheTkCjszCUVQVIC744jxrk8BzXFJ7xdC3gg1wk= 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 177755054219781.95529738134451; Thu, 30 Apr 2026 05:02:22 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 104EB4189B; Thu, 30 Apr 2026 08:02:21 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id CE69141CF0; Thu, 30 Apr 2026 07:45:21 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 6A94F41903; Thu, 30 Apr 2026 07:44:30 -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 7DD4C3F282 for ; Thu, 30 Apr 2026 07:44:07 -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-141-4Z0JBBZRPqOPTsviXjlpfg-1; Thu, 30 Apr 2026 07:44:05 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 BFF61180049F for ; Thu, 30 Apr 2026 11:44:04 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 19FDE300019F for ; Thu, 30 Apr 2026 11:44:03 +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_H4, 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=1777549447; 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=vnEFedf9kih/6UR6L2fA00DGNib56VwZIDO4QjJ8UYc=; b=QtTiYlukuZKS3yZm9t3ebxREMI1vphxJRw+o2fT4uIwSRES5gZkUh/aHbwBq1sN3sdHIRd yinVqD0kXadn4dRaQMHowjV+E5aB1vckRh4x9Pid/AI5pL4dJI/gkLh0hHN3JPE3Zt3HBp sV/wfEiCToakS60uQY44zck3nBJvg9E= X-MC-Unique: 4Z0JBBZRPqOPTsviXjlpfg-1 X-Mimecast-MFC-AGG-ID: 4Z0JBBZRPqOPTsviXjlpfg_1777549444 To: devel@lists.libvirt.org Subject: [PATCH v2 09/35] virHostCPUGet(Map|Stats): Remove unused 'flags' Date: Thu, 30 Apr 2026 13:43:25 +0200 Message-ID: <8658e65c3ab48b48104ed9a5745275a0adabcdbe.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: FYYA1tiCs5buW_tmdxUu9USGj7qHZoA8IZKrSWOFEzA_1777549444 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NZKP6WNKDCKZUYZ7JDQ66AE27GGVRVBC X-Message-ID-Hash: NZKP6WNKDCKZUYZ7JDQ66AE27GGVRVBC 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: 1777550544427158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The utility functions which get CPU map and stats don't actually use the flags. Remove the argument and move the 'virCheckFlags' to driver implementation. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/bhyve/bhyve_driver.c | 8 ++++++-- src/ch/ch_driver.c | 7 +++++-- src/lxc/lxc_driver.c | 8 ++++++-- src/openvz/openvz_driver.c | 8 ++++++-- src/qemu/qemu_driver.c | 8 ++++++-- src/util/virhostcpu.c | 10 ++-------- src/util/virhostcpu.h | 6 ++---- src/vz/vz_driver.c | 8 ++++++-- tests/virhostcputest.c | 2 +- 9 files changed, 40 insertions(+), 25 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index c8dd1a728a..2718c074f3 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1145,10 +1145,12 @@ bhyveNodeGetCPUStats(virConnectPtr conn, int *nparams, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetCPUStatsEnsureACL(conn) < 0) return -1; - return virHostCPUGetStats(cpuNum, params, nparams, flags); + return virHostCPUGetStats(cpuNum, params, nparams); } static int @@ -1359,10 +1361,12 @@ bhyveNodeGetCPUMap(virConnectPtr conn, unsigned int *online, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetCPUMapEnsureACL(conn) < 0) return -1; - return virHostCPUGetMap(cpumap, online, flags); + return virHostCPUGetMap(cpumap, online); } static int diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 662857f88e..874fca2193 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -1642,12 +1642,15 @@ chDomainGetVcpuPinInfo(virDomain *dom, static int chNodeGetCPUMap(virConnectPtr conn, unsigned char **cpumap, - unsigned int *online, unsigned int flags) + unsigned int *online, + unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetCPUMapEnsureACL(conn) < 0) return -1; - return virHostCPUGetMap(cpumap, online, flags); + return virHostCPUGetMap(cpumap, online); } diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index c0a93c0444..db00288900 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -4785,10 +4785,12 @@ lxcNodeGetCPUStats(virConnectPtr conn, int *nparams, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetCPUStatsEnsureACL(conn) < 0) return -1; - return virHostCPUGetStats(cpuNum, params, nparams, flags); + return virHostCPUGetStats(cpuNum, params, nparams); } @@ -4866,10 +4868,12 @@ lxcNodeGetCPUMap(virConnectPtr conn, unsigned int *online, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetCPUMapEnsureACL(conn) < 0) return -1; - return virHostCPUGetMap(cpumap, online, flags); + return virHostCPUGetMap(cpumap, online); } diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 19bdfa37f2..60b8a9534b 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1849,7 +1849,9 @@ openvzNodeGetCPUStats(virConnectPtr conn G_GNUC_UNUSE= D, int *nparams, unsigned int flags) { - return virHostCPUGetStats(cpuNum, params, nparams, flags); + virCheckFlags(0, -1); + + return virHostCPUGetStats(cpuNum, params, nparams); } @@ -1890,7 +1892,9 @@ openvzNodeGetCPUMap(virConnectPtr conn G_GNUC_UNUSED, unsigned int *online, unsigned int flags) { - return virHostCPUGetMap(cpumap, online, flags); + virCheckFlags(0, -1); + + return virHostCPUGetMap(cpumap, online); } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 80b21d4650..52c6ce2f27 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16384,10 +16384,12 @@ qemuNodeGetCPUStats(virConnectPtr conn, int *nparams, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetCPUStatsEnsureACL(conn) < 0) return -1; - return virHostCPUGetStats(cpuNum, params, nparams, flags); + return virHostCPUGetStats(cpuNum, params, nparams); } @@ -16465,10 +16467,12 @@ qemuNodeGetCPUMap(virConnectPtr conn, unsigned int *online, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetCPUMapEnsureACL(conn) < 0) return -1; - return virHostCPUGetMap(cpumap, online, flags); + return virHostCPUGetMap(cpumap, online); } diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 870338edad..60743765a4 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -1043,11 +1043,8 @@ virHostCPUGetInfo(virArch hostarch G_GNUC_UNUSED, int virHostCPUGetStats(int cpuNum G_GNUC_UNUSED, virNodeCPUStatsPtr params G_GNUC_UNUSED, - int *nparams G_GNUC_UNUSED, - unsigned int flags) + int *nparams G_GNUC_UNUSED) { - virCheckFlags(0, -1); - #ifdef __linux__ { int ret; @@ -1144,14 +1141,11 @@ virHostCPUGetOnlineBitmap(void) int virHostCPUGetMap(unsigned char **cpumap, - unsigned int *online, - unsigned int flags) + unsigned int *online) { g_autoptr(virBitmap) cpus =3D NULL; int ncpus =3D virHostCPUGetCount(); - virCheckFlags(0, -1); - if (!cpumap && !online) return ncpus; diff --git a/src/util/virhostcpu.h b/src/util/virhostcpu.h index 289ae41439..238054ed34 100644 --- a/src/util/virhostcpu.h +++ b/src/util/virhostcpu.h @@ -36,8 +36,7 @@ struct _virHostCPUTscInfo { int virHostCPUGetStats(int cpuNum, virNodeCPUStatsPtr params, - int *nparams, - unsigned int flags); + int *nparams); bool virHostCPUHasBitmap(void); virBitmap *virHostCPUGetPresentBitmap(void); @@ -49,8 +48,7 @@ int virHostCPUGetCount(void); int virHostCPUGetThreadsPerSubcore(virArch arch) ATTRIBUTE_MOCKABLE; int virHostCPUGetMap(unsigned char **cpumap, - unsigned int *online, - unsigned int flags); + unsigned int *online); int virHostCPUGetInfo(virArch hostarch, unsigned int *cpus, unsigned int *mhz, diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 2d8878fe7f..f8193367c9 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -1000,10 +1000,12 @@ vzNodeGetCPUMap(virConnectPtr conn, unsigned int *online, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetCPUMapEnsureACL(conn) < 0) return -1; - return virHostCPUGetMap(cpumap, online, flags); + return virHostCPUGetMap(cpumap, online); } static int @@ -1964,10 +1966,12 @@ vzNodeGetCPUStats(virConnectPtr conn, int *nparams, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetCPUStatsEnsureACL(conn) < 0) return -1; - return virHostCPUGetStats(cpuNum, params, nparams, flags); + return virHostCPUGetStats(cpuNum, params, nparams); } static int diff --git a/tests/virhostcputest.c b/tests/virhostcputest.c index 4b31b79444..e362ee8d39 100644 --- a/tests/virhostcputest.c +++ b/tests/virhostcputest.c @@ -249,7 +249,7 @@ linuxTestHostCPUGetMap(const void *data G_GNUC_UNUSED) { g_autofree unsigned char *cpumap =3D NULL; - int ncpus =3D virHostCPUGetMap(&cpumap, NULL, 0); + int ncpus =3D virHostCPUGetMap(&cpumap, NULL); g_autoptr(virBitmap) actual =3D virBitmapNewData(cpumap, VIR_DIV_UP(nc= pus, 8)); g_autoptr(virBitmap) expected =3D NULL; --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777550738; cv=none; d=zohomail.com; s=zohoarc; b=BBm8ZGhYXGsCrxk6DmifHsz1bc0ZwDsBlwDxxHaB2i2c5K4F0Q0GcrWLVbLuIL8cN/yec/Dc3dk11WBzZU90AOSK7VXWlRGtm9x9K5nJCATaQfVpeP1dsMe2+97yvTSdTufh+3VuZcDwGfqlFu4k/AjMybbvuQOff31sKRh5Vy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777550738; 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=ZwqxL5msx5H8tSV4BfRobW/sbye3dhGG2Ub3KprYHvw=; b=g43omC9qnnIU0UhsRL+ameRZ8tU82SfTZnKdoTInSlFuHiVpsv1MVT7hY5uA3nedgIxs0Edf9MB86ENwSaW33BVx/2btrdF2ET9DP+NqX2RlRSEkqv5U0GZDwjv4yplRtNKoKRo0MYp//pTHJbjzazG/c0bCCTByOVeX5L7RHxQ= 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 1777550738334706.7329565686147; Thu, 30 Apr 2026 05:05:38 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 388EC418EE; Thu, 30 Apr 2026 08:05:37 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id ED80741D23; Thu, 30 Apr 2026 07:45:28 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 0F26A4185C; Thu, 30 Apr 2026 07:44:35 -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 786DA41855 for ; Thu, 30 Apr 2026 07:44:08 -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-462-CbM2mo3rO3iKOeX_oZ1EzA-1; Thu, 30 Apr 2026 07:44:06 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 DA2A1195609E for ; Thu, 30 Apr 2026 11:44:05 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 342EF300019F for ; Thu, 30 Apr 2026 11:44:04 +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=1777549448; 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=ZwqxL5msx5H8tSV4BfRobW/sbye3dhGG2Ub3KprYHvw=; b=jO1Cm3cznfFu9oM+m66Ei+ykAtQktKNgf68ajVdJO5mDWtJAVr/1TZun6o0slyfRu+dDoa TAXz6f7a3H06yeVMiAoYvRUkRPZwiSy4IOkEklBOjGChky0K2QO0Cw1hfE9CQmYFwRgW5C XmwefwRBV5kMbusRsz5G9SgRoympRtA= X-MC-Unique: CbM2mo3rO3iKOeX_oZ1EzA-1 X-Mimecast-MFC-AGG-ID: CbM2mo3rO3iKOeX_oZ1EzA_1777549446 To: devel@lists.libvirt.org Subject: [PATCH v2 10/35] virHostMemGet(Stats|Parameters): Remove unused 'flags' Date: Thu, 30 Apr 2026 13:43:26 +0200 Message-ID: <7d4e86504ea0ec145147c92ccc2aa91316f12c6e.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: fIwHEeuYNLhkaNnPOiPc3wRu9TvEEXkDZSAMky02neM_1777549446 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: CVIHAJVFZWTEE57W2CG434G2AC7Y4JRY X-Message-ID-Hash: CVIHAJVFZWTEE57W2CG434G2AC7Y4JRY 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: 1777550739521158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The utility functions which get memory stats don't actually use the flags. Remove the argument and move the 'virCheckFlags' to driver implementation. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/bhyve/bhyve_driver.c | 12 +++++++++--- src/ch/ch_driver.c | 4 +++- src/lxc/lxc_driver.c | 12 +++++++++--- src/openvz/openvz_driver.c | 4 +++- src/qemu/qemu_driver.c | 12 +++++++++--- src/util/virhostmem.c | 29 +++++++---------------------- src/util/virhostmem.h | 9 +++------ src/vz/vz_driver.c | 4 +++- 8 files changed, 46 insertions(+), 40 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 2718c074f3..8813413037 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1160,10 +1160,12 @@ bhyveNodeGetMemoryStats(virConnectPtr conn, int *nparams, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetMemoryStatsEnsureACL(conn) < 0) return -1; - return virHostMemGetStats(cellNum, params, nparams, flags); + return virHostMemGetStats(cellNum, params, nparams); } static int @@ -1375,10 +1377,12 @@ bhyveNodeGetMemoryParameters(virConnectPtr conn, int *nparams, unsigned int flags) { + virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); + if (virNodeGetMemoryParametersEnsureACL(conn) < 0) return -1; - return virHostMemGetParameters(params, nparams, flags); + return virHostMemGetParameters(params, nparams); } static int @@ -1387,10 +1391,12 @@ bhyveNodeSetMemoryParameters(virConnectPtr conn, int nparams, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeSetMemoryParametersEnsureACL(conn) < 0) return -1; - return virHostMemSetParameters(params, nparams, flags); + return virHostMemSetParameters(params, nparams); } static char * diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 874fca2193..ff3cb55c69 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -2304,10 +2304,12 @@ chNodeGetMemoryStats(virConnectPtr conn, int *nparams, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetMemoryStatsEnsureACL(conn) < 0) return -1; - return virHostMemGetStats(cellNum, params, nparams, flags); + return virHostMemGetStats(cellNum, params, nparams); } static int diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index db00288900..c51da98777 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -4801,10 +4801,12 @@ lxcNodeGetMemoryStats(virConnectPtr conn, int *nparams, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetMemoryStatsEnsureACL(conn) < 0) return -1; - return virHostMemGetStats(cellNum, params, nparams, flags); + return virHostMemGetStats(cellNum, params, nparams); } @@ -4842,10 +4844,12 @@ lxcNodeGetMemoryParameters(virConnectPtr conn, int *nparams, unsigned int flags) { + virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); + if (virNodeGetMemoryParametersEnsureACL(conn) < 0) return -1; - return virHostMemGetParameters(params, nparams, flags); + return virHostMemGetParameters(params, nparams); } @@ -4855,10 +4859,12 @@ lxcNodeSetMemoryParameters(virConnectPtr conn, int nparams, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeSetMemoryParametersEnsureACL(conn) < 0) return -1; - return virHostMemSetParameters(params, nparams, flags); + return virHostMemSetParameters(params, nparams); } diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 60b8a9534b..173ccfbe6e 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1862,7 +1862,9 @@ openvzNodeGetMemoryStats(virConnectPtr conn G_GNUC_UN= USED, int *nparams, unsigned int flags) { - return virHostMemGetStats(cellNum, params, nparams, flags); + virCheckFlags(0, -1); + + return virHostMemGetStats(cellNum, params, nparams); } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 52c6ce2f27..f121a0e788 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16400,10 +16400,12 @@ qemuNodeGetMemoryStats(virConnectPtr conn, int *nparams, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetMemoryStatsEnsureACL(conn) < 0) return -1; - return virHostMemGetStats(cellNum, params, nparams, flags); + return virHostMemGetStats(cellNum, params, nparams); } @@ -16441,10 +16443,12 @@ qemuNodeGetMemoryParameters(virConnectPtr conn, int *nparams, unsigned int flags) { + virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); + if (virNodeGetMemoryParametersEnsureACL(conn) < 0) return -1; - return virHostMemGetParameters(params, nparams, flags); + return virHostMemGetParameters(params, nparams); } @@ -16454,10 +16458,12 @@ qemuNodeSetMemoryParameters(virConnectPtr conn, int nparams, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeSetMemoryParametersEnsureACL(conn) < 0) return -1; - return virHostMemSetParameters(params, nparams, flags); + return virHostMemSetParameters(params, nparams); } diff --git a/src/util/virhostmem.c b/src/util/virhostmem.c index 09a322fdea..7d7deac34b 100644 --- a/src/util/virhostmem.c +++ b/src/util/virhostmem.c @@ -248,11 +248,8 @@ virHostMemGetStatsLinux(FILE *meminfo, int virHostMemGetStats(int cellNum G_GNUC_UNUSED, virNodeMemoryStatsPtr params G_GNUC_UNUSED, - int *nparams G_GNUC_UNUSED, - unsigned int flags) + int *nparams G_GNUC_UNUSED) { - virCheckFlags(0, -1); - #ifdef __linux__ { int ret; @@ -356,14 +353,11 @@ virHostMemParametersAreAllSupported(virTypedParameter= Ptr params, #ifdef __linux__ int -virHostMemSetParameters(virTypedParameterPtr params G_GNUC_UNUSED, - int nparams G_GNUC_UNUSED, - unsigned int flags) +virHostMemSetParameters(virTypedParameterPtr params, + int nparams) { size_t i; - virCheckFlags(0, -1); - if (virTypedParamsValidate(params, nparams, VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN, VIR_TYPED_PARAM_UINT, @@ -387,11 +381,8 @@ virHostMemSetParameters(virTypedParameterPtr params G_= GNUC_UNUSED, #else int virHostMemSetParameters(virTypedParameterPtr params G_GNUC_UNUSED, - int nparams G_GNUC_UNUSED, - unsigned int flags) + int nparams G_GNUC_UNUSED) { - virCheckFlags(0, -1); - virReportError(VIR_ERR_NO_SUPPORT, "%s", _("node set memory parameters not implemented on this p= latform")); return -1; @@ -443,9 +434,8 @@ virHostMemGetParameterValue(const char *field, #define NODE_MEMORY_PARAMETERS_NUM 8 #ifdef __linux__ int -virHostMemGetParameters(virTypedParameterPtr params G_GNUC_UNUSED, - int *nparams G_GNUC_UNUSED, - unsigned int flags) +virHostMemGetParameters(virTypedParameterPtr params, + int *nparams) { unsigned int pages_to_scan; unsigned int sleep_millisecs; @@ -458,8 +448,6 @@ virHostMemGetParameters(virTypedParameterPtr params G_G= NUC_UNUSED, size_t i; int ret; - virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); - if ((*nparams) =3D=3D 0) { *nparams =3D NODE_MEMORY_PARAMETERS_NUM; return 0; @@ -580,11 +568,8 @@ virHostMemGetParameters(virTypedParameterPtr params G_= GNUC_UNUSED, #else int virHostMemGetParameters(virTypedParameterPtr params G_GNUC_UNUSED, - int *nparams G_GNUC_UNUSED, - unsigned int flags) + int *nparams G_GNUC_UNUSED) { - virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); - virReportError(VIR_ERR_NO_SUPPORT, "%s", _("node get memory parameters not implemented on this p= latform")); return -1; diff --git a/src/util/virhostmem.h b/src/util/virhostmem.h index 5c8d46cfa4..4a0d692402 100644 --- a/src/util/virhostmem.h +++ b/src/util/virhostmem.h @@ -25,8 +25,7 @@ int virHostMemGetStats(int cellNum, virNodeMemoryStatsPtr params, - int *nparams, - unsigned int flags); + int *nparams); int virHostMemGetCellsFree(unsigned long long *freeMems, int startCell, int maxCells); @@ -34,12 +33,10 @@ int virHostMemGetInfo(unsigned long long *mem, unsigned long long *freeMem); int virHostMemGetParameters(virTypedParameterPtr params, - int *nparams, - unsigned int flags); + int *nparams); int virHostMemSetParameters(virTypedParameterPtr params, - int nparams, - unsigned int flags); + int nparams); int virHostMemGetFreePages(unsigned int npages, unsigned int *pages, diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index f8193367c9..3dea4d450d 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -1981,10 +1981,12 @@ vzNodeGetMemoryStats(virConnectPtr conn, int *nparams, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeGetMemoryStatsEnsureACL(conn) < 0) return -1; - return virHostMemGetStats(cellNum, params, nparams, flags); + return virHostMemGetStats(cellNum, params, nparams); } static int --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777550851; cv=none; d=zohomail.com; s=zohoarc; b=Sy1dbIFuo9+gK4e5np7OReBDD6oqjKLXiEBB3TdOM81C+RWGQsBY89AbkFod6dqzOhgFG3vs509RdaL8yrDsdmGOsJv5+Kfvmozj0kz4KsWE2U8xghEJIj7YrdCZdySFC5yJdvW1js+iPRvHd4fQduj40F10bmdFo+L0JAPDigA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777550851; 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=2OmmeTWGoi6SAQya505SfDtbHCN68TbQw9VHB0hu7Tw=; b=VOUY8q2DBxtZFqIPhMf0RSfdLAf1Y/31bbzDcp45fWi1GFy1LL9DLrgjxBKYm33/2bdtS9mFbZOhBUIhXdYadKn6GvA7ofxW6XMnmzyHlz8VJx3xOl5sabu3UsqUhCcEhGkUF7GusJeZQeQWQGfuP5njUhOT764AiKd+jeX+X7o= 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 1777550851788354.93331654229166; Thu, 30 Apr 2026 05:07:31 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 209DD41850; Thu, 30 Apr 2026 08:07:31 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id CCC2441D6C; Thu, 30 Apr 2026 07:45:35 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E63F341A17; Thu, 30 Apr 2026 07:44:45 -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 71C0A3F890 for ; Thu, 30 Apr 2026 07:44:09 -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-379-PJLntYkXMBiSU3z3zeniAg-1; Thu, 30 Apr 2026 07:44:07 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 011DF19560B7 for ; Thu, 30 Apr 2026 11:44:07 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4EA06300019F for ; Thu, 30 Apr 2026 11:44:06 +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_H4, 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=1777549449; 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=2OmmeTWGoi6SAQya505SfDtbHCN68TbQw9VHB0hu7Tw=; b=T1CwdKMwLXvU4DVmqkbEsXhQzpUGKOkJ3PWj8x/3g8vauneThXlpMofws7GEzmtjODr0fH xkLv7HIoVTjW1e0DKNEngfGIqDe9QwuqIeXIh58XNyDMj5L+S2u+c6zmDTMdWBZ0ZT6eb6 ovg6PRTQU+W8gqrsVZf8XJS8343Oo8U= X-MC-Unique: PJLntYkXMBiSU3z3zeniAg-1 X-Mimecast-MFC-AGG-ID: PJLntYkXMBiSU3z3zeniAg_1777549447 To: devel@lists.libvirt.org Subject: [PATCH v2 11/35] virNodeSuspend: Remove unused 'flags' Date: Thu, 30 Apr 2026 13:43:27 +0200 Message-ID: <1b6c132d67658e99a044aeb9b22d08dca577fd15.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ZHR_BIPkOBHKJvWytSPXoCorWhyX_UZEcCBKw3cllD0_1777549447 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BGC453T35LURFYXU7YEEVQBGBSSRBCKI X-Message-ID-Hash: BGC453T35LURFYXU7YEEVQBGBSSRBCKI 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: 1777550855023154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Remove the unused argument and bump the 'virCheckFlags' calls to the top level. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_driver.c | 4 +++- src/qemu/qemu_driver.c | 4 +++- src/util/virnodesuspend.c | 5 +---- src/util/virnodesuspend.h | 3 +-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index c51da98777..df8e4e06ec 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -4889,10 +4889,12 @@ lxcNodeSuspendForDuration(virConnectPtr conn, unsigned long long duration, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeSuspendForDurationEnsureACL(conn) < 0) return -1; - return virNodeSuspend(target, duration, flags); + return virNodeSuspend(target, duration); } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f121a0e788..558c22982d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16488,10 +16488,12 @@ qemuNodeSuspendForDuration(virConnectPtr conn, unsigned long long duration, unsigned int flags) { + virCheckFlags(0, -1); + if (virNodeSuspendForDurationEnsureACL(conn) < 0) return -1; - return virNodeSuspend(target, duration, flags); + return virNodeSuspend(target, duration); } static int diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c index 37659f13ad..5b65643d06 100644 --- a/src/util/virnodesuspend.c +++ b/src/util/virnodesuspend.c @@ -138,16 +138,13 @@ static void virNodeSuspendHelper(void *cmdString) * operation is still in progress. */ int virNodeSuspend(unsigned int target, - unsigned long long duration, - unsigned int flags) + unsigned long long duration) { static virThread thread; const char *cmdString =3D NULL; unsigned int supported; VIR_LOCK_GUARD lock =3D { NULL }; - virCheckFlags(0, -1); - if (virNodeSuspendGetTargetMask(&supported) < 0) return -1; diff --git a/src/util/virnodesuspend.h b/src/util/virnodesuspend.h index f767961bff..dc8324df1d 100644 --- a/src/util/virnodesuspend.h +++ b/src/util/virnodesuspend.h @@ -24,7 +24,6 @@ #include "internal.h" int virNodeSuspend(unsigned int target, - unsigned long long duration, - unsigned int flags); + unsigned long long duration); int virNodeSuspendGetTargetMask(unsigned int *bitmask); --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777550928; cv=none; d=zohomail.com; s=zohoarc; b=GBnnC2QTQm39bPAlaWkYabeWQtRqVVA4XzovlDUfgr8NWamz49xLY6OGVZ/xMMO9QGr+aZDj44Q1+9hYTkQMgu1dZ2xSlgaVNdyjK8elJ9UbUukPRoPDls5GGgIDzsyVGFPHe2HKa9Szote/r7Eg25oTxeCpoD6uPeki4CiLRqs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777550928; 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=tPdHvd/yzXZuhmzqWr6NO9nr35m311BMhcbWaybwh1U=; b=bcFaNmDcyu5WVuY/lAqWQDLA2LC8j4G/DaZ+Ew1K9M5NC4r558NoFHar06uGEOrPL2+qZLBVqQjL7Rv8d/dFdrv8ykoE2Qba6m6YGUwhs0XnKxEevhOUYz0g4sRy6GYcb4QfqrNgCo8JgeLOJvJMX7daf1xwl0RGOAVxmVx+v50= 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 1777550928638981.7031514810435; Thu, 30 Apr 2026 05:08:48 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8B3AF3F366; Thu, 30 Apr 2026 08:08:47 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 9AE0541DA5; Thu, 30 Apr 2026 07:45:43 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8BAEB41CBD; Thu, 30 Apr 2026 07:45:14 -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 6949B4194A for ; Thu, 30 Apr 2026 07:44:10 -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-548-lW7mUrWaP_Gw1A-SFmDaRw-1; Thu, 30 Apr 2026 07:44:08 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 1A4C8195609F for ; Thu, 30 Apr 2026 11:44:08 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 687DE300019F for ; Thu, 30 Apr 2026 11:44:07 +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=1777549450; 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=tPdHvd/yzXZuhmzqWr6NO9nr35m311BMhcbWaybwh1U=; b=E2BhdDz8xeUUEteL52KM2I3tObyMVnxFENbYpS3joQJ8NVTRO7SqxHaTEDHGBJ9Axp19D2 QXMHirxWDF0+QKRCQNcexogs2emVmspvDi6zf+sy6ylq7fkEE0MixRmoXooSz4jTDaNOQV K55E37gvjUN3b/NpuMsHrvb+IKz7ZDw= X-MC-Unique: lW7mUrWaP_Gw1A-SFmDaRw-1 X-Mimecast-MFC-AGG-ID: lW7mUrWaP_Gw1A-SFmDaRw_1777549448 To: devel@lists.libvirt.org Subject: [PATCH v2 12/35] qemu: backup: Move 'virCheckFlags' to top level functions Date: Thu, 30 Apr 2026 13:43:28 +0200 Message-ID: <562daa6e676cacfd3e6309ab3bbb7e80ddddcebc.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: SRSV3z2vk-WpXBbdrNFZY_vJDNig7jNtzKVYOdnODN8_1777549448 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: WN3XGPV7NIJGSFZTZCOLQQWK4B6HP7IB X-Message-ID-Hash: WN3XGPV7NIJGSFZTZCOLQQWK4B6HP7IB 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: 1777550930556158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Move the flag check to the top level to allow programatic introspection of supported flags. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_backup.c | 8 +------- src/qemu/qemu_backup.h | 3 +-- src/qemu/qemu_driver.c | 7 ++++++- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 65a083ea74..a0544c83dc 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -808,9 +808,6 @@ qemuBackupBegin(virDomainObj *vm, int ret =3D -1; g_autoptr(qemuFDPassDirect) fdpass =3D NULL; - virCheckFlags(VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL | - VIR_DOMAIN_BACKUP_BEGIN_PRESERVE_SHUTDOWN_DOMAIN, -1); - if (!(def =3D virDomainBackupDefParseString(backupXML, priv->driver->x= mlopt, 0))) return -1; @@ -986,16 +983,13 @@ qemuBackupBegin(virDomainObj *vm, char * -qemuBackupGetXMLDesc(virDomainObj *vm, - unsigned int flags) +qemuBackupGetXMLDesc(virDomainObj *vm) { qemuDomainObjPrivate *priv =3D vm->privateData; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; virDomainBackupDef *backup; - virCheckFlags(0, NULL); - if (!(backup =3D qemuDomainGetBackup(vm))) return NULL; diff --git a/src/qemu/qemu_backup.h b/src/qemu/qemu_backup.h index c259883bca..602a1e6a99 100644 --- a/src/qemu/qemu_backup.h +++ b/src/qemu/qemu_backup.h @@ -25,8 +25,7 @@ qemuBackupBegin(virDomainObj *vm, unsigned int flags); char * -qemuBackupGetXMLDesc(virDomainObj *vm, - unsigned int flags); +qemuBackupGetXMLDesc(virDomainObj *vm); void qemuBackupJobCancelBlockjobs(virDomainObj *vm, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 558c22982d..8027b5775e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13627,6 +13627,9 @@ qemuDomainBackupBegin(virDomainPtr domain, virDomainObj *vm =3D NULL; int ret =3D -1; + virCheckFlags(VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL | + VIR_DOMAIN_BACKUP_BEGIN_PRESERVE_SHUTDOWN_DOMAIN, -1); + if (!(vm =3D qemuDomainObjFromDomain(domain))) goto cleanup; @@ -13648,13 +13651,15 @@ qemuDomainBackupGetXMLDesc(virDomainPtr domain, virDomainObj *vm =3D NULL; char *ret =3D NULL; + virCheckFlags(0, NULL); + if (!(vm =3D qemuDomainObjFromDomain(domain))) return NULL; if (virDomainBackupGetXMLDescEnsureACL(domain->conn, vm->def) < 0) goto cleanup; - ret =3D qemuBackupGetXMLDesc(vm, flags); + ret =3D qemuBackupGetXMLDesc(vm); cleanup: virDomainObjEndAPI(&vm); --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777550997; cv=none; d=zohomail.com; s=zohoarc; b=RiaYp+OkkwbyCf3lZMr61LKy3oYFNM4vrgrwslSkrY2kcREs9f55w3pJkg6GKmTSNca1hMBzmQXF7Vr0qaq/aix2atG2ys8grRy8CbDiEi8jjlBHenz1K6twwEMgwpOdF7g420TeET1zw2oICg5tYV7M/FODGrPJIlhz0ZI+CAg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777550997; 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=5eIIPPRKiM1grGjSdcpSr3kXhLaKcGO9JsgOY5wn3A8=; b=DSa5c/tPd+QvNKVn7lPqEyWqCOwF1nYYtRz3UOxdN9di18i2Pb93vwKkbnwQ4NzqKkSiqfSM3Libzb4KHODERyKK+PAYHSpTCEV9nQXwv2/Z6/zzstX9OsWINOD1KT8Lv0B1uXZsdQ7jeMePf1yBsvQfgOHUx6KBvRspAuAGGpU= 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 1777550997055378.20699014582055; Thu, 30 Apr 2026 05:09:57 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 16AFA3F8B1; Thu, 30 Apr 2026 08:09:55 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id A4CCC41DDE; Thu, 30 Apr 2026 07:45:50 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 0455441D0F; Thu, 30 Apr 2026 07:45:26 -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 D171C41944 for ; Thu, 30 Apr 2026 07:44:11 -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-297-2nIt_ZlEP6muGLfEPRV8Gw-1; Thu, 30 Apr 2026 07:44:09 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 39C60180036E for ; Thu, 30 Apr 2026 11:44:09 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 82A77300019F for ; Thu, 30 Apr 2026 11:44:08 +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_H4, 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=1777549451; 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=5eIIPPRKiM1grGjSdcpSr3kXhLaKcGO9JsgOY5wn3A8=; b=LmweUjip1N7EEtDuP7lr2SdR3njMT9vwLupSwY2Niux8grus77A/ZhpqqUAy8lMvOyEO23 73Hh10vHiSbsnvZWK5cHBOfcsIUpEZtcP6HDhv3wtVtPDub8EibESTZwn7nfjsxcCz+pZn lGy4B/NKQJHeuwLkfmiQSY6UoO7lIOA= X-MC-Unique: 2nIt_ZlEP6muGLfEPRV8Gw-1 X-Mimecast-MFC-AGG-ID: 2nIt_ZlEP6muGLfEPRV8Gw_1777549449 To: devel@lists.libvirt.org Subject: [PATCH v2 13/35] qemu: attach/detach device: Move 'virCheckFlags' to top level functions Date: Thu, 30 Apr 2026 13:43:29 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: syukiRH89vIgTc-GCQsExxHfharZDoHUBk1txf7UiSE_1777549449 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 7UKMYWZ5RU6V2ITUGGA4ZTLXFWB5ZOC5 X-Message-ID-Hash: 7UKMYWZ5RU6V2ITUGGA4ZTLXFWB5ZOC5 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: 1777551000779158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Move the flag check to the top level to allow programatic introspection of supported flags. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8027b5775e..e6ad16f31b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7417,9 +7417,6 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObj *vm, unsigned int parse_flags =3D VIR_DOMAIN_DEF_PARSE_INACTIVE | VIR_DOMAIN_DEF_PARSE_ABI_UPDATE; - virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | - VIR_DOMAIN_AFFECT_CONFIG, -1); - cfg =3D virQEMUDriverGetConfig(driver); /* The config and live post processing address auto-generation algorit= hms @@ -7512,6 +7509,9 @@ qemuDomainAttachDeviceFlags(virDomainPtr dom, virDomainObj *vm =3D NULL; int ret =3D -1; + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + if (!(vm =3D qemuDomainObjFromDomain(dom))) goto cleanup; @@ -7660,9 +7660,6 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriver *dr= iver, unsigned int parse_flags =3D VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE; g_autoptr(virDomainDef) vmdef =3D NULL; - virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | - VIR_DOMAIN_AFFECT_CONFIG, -1); - cfg =3D virQEMUDriverGetConfig(driver); if ((flags & VIR_DOMAIN_AFFECT_CONFIG) && @@ -7796,6 +7793,9 @@ qemuDomainDetachDeviceFlags(virDomainPtr dom, virDomainObj *vm =3D NULL; int ret =3D -1; + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + if (!(vm =3D qemuDomainObjFromDomain(dom))) goto cleanup; --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777551064; cv=none; d=zohomail.com; s=zohoarc; b=WFOwe00EqPD4PHnSLp4YWZ5zNjENzJ009soOV9lEbnRDZtndgOTmMa0CufnGkO6yJeYAFdTRDr2wkqRIY6p4rMn79UyoWF0Zzoo0d8yzBy9SW9aSu8ASPMCax1UR8mcec2wc5EHO9J7vzXiWGK28wlgsoZx2ISoXoxWOYiggO+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777551064; 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=8wiP7dlzaonMdYCZtuGntYyY/m1+1CYJPvUGAx0hNl8=; b=VCAmfWOnDnvqM2oQQHOQTo882kqUqDJZYMB5w9qNkn3zRKr+/UmPEk8tbDtffJGePG80R+qdsIdpxHidQQ8fxG6OSoUEMgKo6SOfCo4zBfDmTjke71ZUDg1T0eQf2OOangxVuUwXLc3GB5xdaoFL7VMk5DPpkE4asrxXc9Jwiuo= 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 1777551064315895.9362395170145; Thu, 30 Apr 2026 05:11:04 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 4224241939; Thu, 30 Apr 2026 08:11:03 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 0CEC241E16; Thu, 30 Apr 2026 07:45:59 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 4C99A41C49; Thu, 30 Apr 2026 07:45:46 -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 6948041965 for ; Thu, 30 Apr 2026 07:44:13 -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-376-DezrUb-qPUSlycxyE6sjiw-1; Thu, 30 Apr 2026 07:44:11 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 55C5C18005A8 for ; Thu, 30 Apr 2026 11:44:10 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9EAF2300019F for ; Thu, 30 Apr 2026 11:44:09 +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=1777549453; 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=8wiP7dlzaonMdYCZtuGntYyY/m1+1CYJPvUGAx0hNl8=; b=RXy2es3SKoG5koMDu3LhE095ceBsJWP/qqsrMCJ7UNlq/+j3Dnm80YNTBTR9+kEWnbmkPL BO5qKh0YiBFHQ7zGBeEf5j/P08MgVGOURgTBT0kynq3OIBEzkb8o447KNssvaYpRSg6f5K WuKgV8W/WQb0G72DZB63uKmOaebJ8/g= X-MC-Unique: DezrUb-qPUSlycxyE6sjiw-1 X-Mimecast-MFC-AGG-ID: DezrUb-qPUSlycxyE6sjiw_1777549450 To: devel@lists.libvirt.org Subject: [PATCH v2 14/35] qemu: dump: Move 'virCheckFlags' to top level functions Date: Thu, 30 Apr 2026 13:43:30 +0200 Message-ID: <426ca515e5515ca2df3b180365a18791af607995.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 7dtCfqKnkW8JaUrIxMxXotSxSlxZqFoSnUfTF4cVmRk_1777549450 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: QKTXZD3KZVJZJAQLY5MA273KJ7PNHIFY X-Message-ID-Hash: QKTXZD3KZVJZJAQLY5MA273KJ7PNHIFY 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: 1777551065109158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Move the flag check to the top level to allow programatic introspection of supported flags. Extract the supported flags as a macro so that they can be reused in both coredump APIs. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e6ad16f31b..431b3b741e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3234,6 +3234,12 @@ doCoreDump(virQEMUDriver *driver, return ret; } +#define QEMU_DOMAIN_CORE_DUMP_FLAGS \ + VIR_DUMP_CRASH | \ + VIR_DUMP_BYPASS_CACHE | \ + VIR_DUMP_RESET | \ + VIR_DUMP_MEMORY_ONLY + static int qemuDomainCoreDumpWithFormat(virDomainPtr dom, @@ -3248,9 +3254,7 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom, int ret =3D -1; virObjectEvent *event =3D NULL; - virCheckFlags(VIR_DUMP_CRASH | - VIR_DUMP_BYPASS_CACHE | VIR_DUMP_RESET | - VIR_DUMP_MEMORY_ONLY, -1); + virCheckFlags(QEMU_DOMAIN_CORE_DUMP_FLAGS, -1); if (!(vm =3D qemuDomainObjFromDomain(dom))) return -1; @@ -3343,6 +3347,8 @@ qemuDomainCoreDump(virDomainPtr dom, const char *path, unsigned int flags) { + virCheckFlags(QEMU_DOMAIN_CORE_DUMP_FLAGS, -1); + return qemuDomainCoreDumpWithFormat(dom, path, VIR_DOMAIN_CORE_DUMP_FORMAT_RAW, flags); --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777551139; cv=none; d=zohomail.com; s=zohoarc; b=HPXYConHpThcV0KmeR4BBTReVsd2e+Z77LFbH6MeVdunYvVp6N2505DPaKZxVTgel/CKO3yXwbs9k/7+m6UqO6cVmVoHXbwo42ZBsbAIoylSneDQIZrjGQpXFeST6gbt5tdCeZ/22Rp9X88ZeE4t94gUemFSobxLJX3VDJezUXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777551139; 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=5DpunPwyfwpnVGuSPhJ3U1keV96QGcOyH8F0XlYXOFU=; b=I85Eld0YOFvHQvdFUMum+EXqf+lbS4beTpNNp+b0EUHpeq2o8rS4BpUcmkAevFkUSJ3K4XXZQtUD0hGXmqecXuwMgQVM4LhPe/Y3sMig7PSaMVFjKy+ih4y/TMMSu4+i6iRQJJ3XaRvVpcFZSOAk/wtKcDudMjhlyv3iOcJs+wY= 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 1777551139365603.5632348015275; Thu, 30 Apr 2026 05:12:19 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id BDAD4418E6; Thu, 30 Apr 2026 08:12:18 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 0EC0041E4D; Thu, 30 Apr 2026 07:46:09 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8079241DF4; Thu, 30 Apr 2026 07:45:56 -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 27F894196C for ; Thu, 30 Apr 2026 07:44:14 -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-433-F5tVstaKMFSiLnTLZrr0IA-1; Thu, 30 Apr 2026 07:44:12 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 6D01519560A7 for ; Thu, 30 Apr 2026 11:44:11 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BB81A300019F for ; Thu, 30 Apr 2026 11:44:10 +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_H4, 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=1777549453; 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=5DpunPwyfwpnVGuSPhJ3U1keV96QGcOyH8F0XlYXOFU=; b=QPyo4XkKs8UG3zJWknRZKbTpWBh232k9bJPnQ3MHJRh5nHhe7w7xEua17sRuV6MyoSD82Y 9VE80uTuYIMLuWshvpL8NTfP8stHiqJgDaX4tFaAlbljAWDNIY4wa+SkptSRUDjVRXFTzS eofh++d+ZpX3rP74Cwmv7MObf4IebWI= X-MC-Unique: F5tVstaKMFSiLnTLZrr0IA-1 X-Mimecast-MFC-AGG-ID: F5tVstaKMFSiLnTLZrr0IA_1777549451 To: devel@lists.libvirt.org Subject: [PATCH v2 15/35] qemu: checkpoint: Move 'virCheckFlags' to top level functions Date: Thu, 30 Apr 2026 13:43:31 +0200 Message-ID: <57fa3e68554ad03a7a61005d103df0c8a29dec42.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: tBdYs1P3othAN1Rg6yTUi3NuhrCCDJPqZCMz0eCypJs_1777549451 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NACAIY33TEECEKQWFKZI6RFXPMP7L6LE X-Message-ID-Hash: NACAIY33TEECEKQWFKZI6RFXPMP7L6LE 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: 1777551141388154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Move the flag check to the top level to allow programatic introspection of supported flags. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_checkpoint.c | 11 ----------- src/qemu/qemu_driver.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 193cf9a06a..f063b5a5c0 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -582,9 +582,6 @@ qemuCheckpointCreateXML(virDomainPtr domain, g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); g_autoptr(virDomainCheckpointDef) def =3D NULL; - virCheckFlags(VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE | - VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE_VALIDATE, NULL); - if (redefine) { parse_flags |=3D VIR_DOMAIN_CHECKPOINT_PARSE_REDEFINE; update_current =3D false; @@ -783,10 +780,6 @@ qemuCheckpointGetXMLDesc(virDomainObj *vm, virDomainCheckpointDef *chkdef; unsigned int format_flags; - virCheckFlags(VIR_DOMAIN_CHECKPOINT_XML_SECURE | - VIR_DOMAIN_CHECKPOINT_XML_NO_DOMAIN | - VIR_DOMAIN_CHECKPOINT_XML_SIZE, NULL); - if (!(chk =3D qemuCheckpointObjFromCheckpoint(vm, checkpoint))) return NULL; @@ -847,10 +840,6 @@ qemuCheckpointDelete(virDomainObj *vm, struct virQEMUCheckpointReparent rep; bool metadata_only =3D !!(flags & VIR_DOMAIN_CHECKPOINT_DELETE_METADAT= A_ONLY); - virCheckFlags(VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN | - VIR_DOMAIN_CHECKPOINT_DELETE_METADATA_ONLY | - VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN_ONLY, -1); - if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 431b3b741e..b0b5c12d47 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13448,6 +13448,9 @@ qemuDomainCheckpointCreateXML(virDomainPtr domain, virDomainObj *vm =3D NULL; virDomainCheckpointPtr checkpoint =3D NULL; + virCheckFlags(VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE | + VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE_VALIDATE, NULL); + if (!(vm =3D qemuDomainObjFromDomain(domain))) goto cleanup; @@ -13589,6 +13592,10 @@ qemuDomainCheckpointGetXMLDesc(virDomainCheckpoint= Ptr checkpoint, virDomainObj *vm =3D NULL; char *xml =3D NULL; + virCheckFlags(VIR_DOMAIN_CHECKPOINT_XML_SECURE | + VIR_DOMAIN_CHECKPOINT_XML_NO_DOMAIN | + VIR_DOMAIN_CHECKPOINT_XML_SIZE, NULL); + if (!(vm =3D qemuDomObjFromCheckpoint(checkpoint))) return NULL; @@ -13610,6 +13617,10 @@ qemuDomainCheckpointDelete(virDomainCheckpointPtr = checkpoint, virDomainObj *vm =3D NULL; int ret =3D -1; + virCheckFlags(VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN | + VIR_DOMAIN_CHECKPOINT_DELETE_METADATA_ONLY | + VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN_ONLY, -1); + if (!(vm =3D qemuDomObjFromCheckpoint(checkpoint))) return -1; --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777551234; cv=none; d=zohomail.com; s=zohoarc; b=ls4LQWtmyipvEMMiOj0IVKJB5nC13qJ/lWLX+TIvC34h1Bg2nOjUjwHAMKgkGo9Al9yIUOZUBqsRcw6rv2eRCRS8GlS0u7bNHqGIDm70/Up0MldQPYjpYXadn+6MvmI4xKEiOgoHZXz01s/yFhUjD2LRK16VspYFMi0fZRlJVTs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777551234; 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=9KYbBL1IJNm/wpCLNKkJ2YXgUR9QcUvC9AEAeHemvVc=; b=BHQAZa50XC4Wqr8qahjzVV+mdrtHd6UY5k6olHQHyNhKXEstBY3bX16EdhRw0QvSKUx7Xz5UuYXVYIe9+ERXWFIKAD+b2PiCVQYNvQnziGHwEo7E4ObrY933sPxX6Gu19jR7ZWZRa8m+xSYGOUYvb+UVeaPy9o8nrt7S3uUP+Sk= 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 177755123483768.9992863138151; Thu, 30 Apr 2026 05:13:54 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D84F041937; Thu, 30 Apr 2026 08:13:52 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id E9D1041D3E; Thu, 30 Apr 2026 07:46:18 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 1918B41E42; Thu, 30 Apr 2026 07:46:08 -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 1FDA741974 for ; Thu, 30 Apr 2026 07:44:15 -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-401-qACgBHB0OAS1y42Wk05o8Q-1; Thu, 30 Apr 2026 07:44:13 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 86CD81956096 for ; Thu, 30 Apr 2026 11:44:12 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D5EB6300019F for ; Thu, 30 Apr 2026 11:44:11 +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_H4, 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=1777549454; 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=9KYbBL1IJNm/wpCLNKkJ2YXgUR9QcUvC9AEAeHemvVc=; b=E3GpdU0i+kPUDvbRS6lKCXBj3SWaUNA0+jJF2O8ajO2d0smPngyQROIbbgzJpM5lfuLO3e NeNGlzuqV7r8g8v9/7Oas1Ik2uD2hu6GxLkGwR58b9GDENPk6QWTQPjjz81PAXLAnV8pan +DyFaG3ekEU0+iblbf2JHOq7/QALVJs= X-MC-Unique: qACgBHB0OAS1y42Wk05o8Q-1 X-Mimecast-MFC-AGG-ID: qACgBHB0OAS1y42Wk05o8Q_1777549452 To: devel@lists.libvirt.org Subject: [PATCH v2 16/35] qemuDomainRestore(Flags|Params): Refactor flag checking Date: Thu, 30 Apr 2026 13:43:32 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: bD2tFhTwqvt124cF6-nGHOwyUMXBa7h35Rwg6wY7mIk_1777549452 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 6CUS3AZS4XYZUST66U54ESFCH4NZ5N2W X-Message-ID-Hash: 6CUS3AZS4XYZUST66U54ESFCH4NZ5N2W 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: 1777551238748154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Create QEMU_DOMAIN_RESTORE_FLAGS define which collects all the flags used by either of the implementations of the 'Restore' API and move the flag checking into the implementation function so that it's available later for introspection. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b0b5c12d47..7f8958e45b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5843,6 +5843,11 @@ qemuNodeGetSecurityModel(virConnectPtr conn, return 0; } +#define QEMU_DOMAIN_RESTORE_FLAGS \ + VIR_DOMAIN_SAVE_BYPASS_CACHE | \ + VIR_DOMAIN_SAVE_RUNNING | \ + VIR_DOMAIN_SAVE_PAUSED | \ + VIR_DOMAIN_SAVE_RESET_NVRAM /** * qemuDomainRestoreInternal: @@ -5894,18 +5899,12 @@ qemuDomainRestoreInternal(virConnectPtr conn, virQEMUSaveData *data =3D NULL; virFileWrapperFd *wrapperFd =3D NULL; bool hook_taint =3D false; - bool reset_nvram =3D false; + bool reset_nvram =3D (flags & VIR_DOMAIN_SAVE_RESET_NVRAM) !=3D 0; bool sparse =3D false; bool bypass_cache =3D (flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) !=3D 0; g_autoptr(qemuMigrationParams) restoreParams =3D NULL; - virCheckFlags(VIR_DOMAIN_SAVE_BYPASS_CACHE | - VIR_DOMAIN_SAVE_RUNNING | - VIR_DOMAIN_SAVE_PAUSED | - VIR_DOMAIN_SAVE_RESET_NVRAM, -1); - - if (flags & VIR_DOMAIN_SAVE_RESET_NVRAM) - reset_nvram =3D true; + virCheckFlags(QEMU_DOMAIN_RESTORE_FLAGS, -1); if (qemuSaveImageGetMetadata(driver, NULL, path, ensureACL, conn, &def= , &data) < 0) { if (unlink_corrupt && @@ -6045,6 +6044,8 @@ qemuDomainRestoreFlags(virConnectPtr conn, const char *dxml, unsigned int flags) { + virCheckFlags(QEMU_DOMAIN_RESTORE_FLAGS, -1); + return qemuDomainRestoreInternal(conn, NULL, path, false, dxml, NULL, = 0, flags, virDomainRestoreFlagsEnsureACL, VIR_ASYNC_JOB_START); @@ -6068,6 +6069,8 @@ qemuDomainRestoreParams(virConnectPtr conn, const char *dxml =3D NULL; int ret =3D -1; + virCheckFlags(QEMU_DOMAIN_RESTORE_FLAGS, -1); + if (virTypedParamsValidate(params, nparams, VIR_DOMAIN_SAVE_PARAM_FILE, VIR_TYPED_PARAM= _STRING, VIR_DOMAIN_SAVE_PARAM_DXML, VIR_TYPED_PARAM= _STRING, --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777551317; cv=none; d=zohomail.com; s=zohoarc; b=kM0P1D19tusgPbwngCEb7+zJQ7VGBykln0sNav/PFJng7YZzImQVcTg/QGm4zOZ3whyA+xk5JS6eEZxOg4tJwLub/a2PEsg0mjjhIfdjN67t6zm0faQwNodQNQDeQLZR6WYsVPRJlne0N0yx7g3f5NpKhE2s/yDI4QVaN0/zx9g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777551317; 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=+IOyIr/c800sRKANvmZAWWtjj6Fn1PR2t/epDGBJa9k=; b=NH1GGEPSI5ZMO9AZvNbyL4wHOtbL42UvvhafVmDgoMa0qj9Tu0mC/c6Ke6ekQjhSRtu466EUzs6bcTm+dUL8hETz8r4+gj0aaA6KkEuASFYIKPRhnwK16Ryomg4s5yPgxq9hBaZ2pYFTiAHnRpKVXU2Bff3hkwTgYH7FBSa0rhs= 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 1777551317828331.6297833624169; Thu, 30 Apr 2026 05:15:17 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 129D641937; Thu, 30 Apr 2026 08:15:17 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 2D35843DC4; Thu, 30 Apr 2026 07:46:29 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id ECB8641D95; Thu, 30 Apr 2026 07:46:19 -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 4D7204182E for ; Thu, 30 Apr 2026 07:44:16 -0400 (EDT) Received: from mx-prod-mc-08.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-452-nOCxe4mwO86h0HTPRiYuhg-1; Thu, 30 Apr 2026 07:44:14 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A0F3A18003FC for ; Thu, 30 Apr 2026 11:44:13 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F0380300019F for ; Thu, 30 Apr 2026 11:44:12 +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,UPPERCASE_50_75 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=1777549455; 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=+IOyIr/c800sRKANvmZAWWtjj6Fn1PR2t/epDGBJa9k=; b=UaVb4zAffXzfcSNBlZer0xUbycu9pWmcdSbZR9tw/Lj4v8HlK9Gd/v+uM5XCxgPuYM20oj Oy1Cg59kg7KCeQBMfezOkAROJPxcuCKNlDoqCrgA24KrKf6h5l03m/t3TIYePrKPUYBrb/ ZJaMTFNmJRRHzoJ0PcrDtui9dzKQWDY= X-MC-Unique: nOCxe4mwO86h0HTPRiYuhg-1 X-Mimecast-MFC-AGG-ID: nOCxe4mwO86h0HTPRiYuhg_1777549453 To: devel@lists.libvirt.org Subject: [PATCH v2 17/35] qemu: snapshot: Move flag checks to top level functions Date: Thu, 30 Apr 2026 13:43:33 +0200 Message-ID: <3a552f55e293ea04aef1508c8a5f5a0911443aa0.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: YpZWz4YWsPuyrjmwTXP-YBp0Z0IDLSt2QRTjci40P18_1777549453 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JJISU7PWQUPUWC2ZRRVXWGIHUHVHHBQL X-Message-ID-Hash: JJISU7PWQUPUWC2ZRRVXWGIHUHVHHBQL 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: 1777551320026154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Move the 'virCheckFlags' invocations to the top level driver function so that they become available for introspection. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 27 +++++++++++++++++++++++++++ src/qemu/qemu_snapshot.c | 27 --------------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7f8958e45b..a2b5959e55 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13010,6 +13010,24 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, virDomainObj *vm =3D NULL; virDomainSnapshotPtr snapshot =3D NULL; + virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE | + VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT | + VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA | + VIR_DOMAIN_SNAPSHOT_CREATE_HALT | + VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY | + VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT | + VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE | + VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC | + VIR_DOMAIN_SNAPSHOT_CREATE_LIVE | + VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE, NULL); + + VIR_REQUIRE_FLAG_RET(VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE, + VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY, + NULL); + VIR_EXCLUSIVE_FLAGS_RET(VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, + VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, + NULL); + if (!(vm =3D qemuDomainObjFromDomain(domain))) goto cleanup; @@ -13408,6 +13426,11 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr sn= apshot, virDomainObj *vm =3D NULL; int ret =3D -1; + virCheckFlags(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | + VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED | + VIR_DOMAIN_SNAPSHOT_REVERT_FORCE | + VIR_DOMAIN_SNAPSHOT_REVERT_RESET_NVRAM, -1); + if (!(vm =3D qemuDomObjFromSnapshot(snapshot))) goto cleanup; @@ -13429,6 +13452,10 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snap= shot, virDomainObj *vm =3D NULL; int ret =3D -1; + virCheckFlags(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN | + VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY | + VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY, -1); + if (!(vm =3D qemuDomObjFromSnapshot(snapshot))) return -1; diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 82ae38ca29..07548ca62e 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2222,24 +2222,6 @@ qemuSnapshotCreateXML(virDomainPtr domain, g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); g_autoptr(virDomainSnapshotDef) def =3D NULL; - virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE | - VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT | - VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA | - VIR_DOMAIN_SNAPSHOT_CREATE_HALT | - VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY | - VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT | - VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE | - VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC | - VIR_DOMAIN_SNAPSHOT_CREATE_LIVE | - VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE, NULL); - - VIR_REQUIRE_FLAG_RET(VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE, - VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY, - NULL); - VIR_EXCLUSIVE_FLAGS_RET(VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, - VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, - NULL); - if (!vm->persistent && (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT)) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot halt after transient domain snapshot")); @@ -2950,11 +2932,6 @@ qemuSnapshotRevert(virDomainObj *vm, g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); unsigned int start_flags =3D VIR_QEMU_PROCESS_START_GEN_VMID; - virCheckFlags(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | - VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED | - VIR_DOMAIN_SNAPSHOT_REVERT_FORCE | - VIR_DOMAIN_SNAPSHOT_REVERT_RESET_NVRAM, -1); - if (flags & VIR_DOMAIN_SNAPSHOT_REVERT_RESET_NVRAM) start_flags |=3D VIR_QEMU_PROCESS_START_RESET_NVRAM; @@ -4489,10 +4466,6 @@ qemuSnapshotDelete(virDomainObj *vm, bool stop_qemu =3D false; g_autoslist(qemuSnapshotDeleteExternalData) externalData =3D NULL; - virCheckFlags(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN | - VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY | - VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY, -1); - if (virDomainObjBeginAsyncJob(vm, VIR_ASYNC_JOB_SNAPSHOT, VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_DELETE, flags) < 0) { --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777551385; cv=none; d=zohomail.com; s=zohoarc; b=ml3j027ttgpEuCKhSfAE9nq8CHGM+IX/MIJnlsJ0TSLZTd2VS5ImWsuJ42MmNuOZOrBHEdSYRJTz+DESjb/FRhrTWD5ngITqx5M1zM96vZIHuni7LgovGRPcG5o4aqY5iIgSKckc6dG1sPceCpewJ32LmJffDjxtdQEIOUcat40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777551385; 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=qXruz+7JZ4hU3d+UBm61ijmGxE3qsAHo5LBqh0MkhmQ=; b=JkNjKkuB+2053sA+zrnwJfm7cUTCjKkyAdCuRYRrNcoNl/uzLAlyA7XIV8ocTnKPLnmmdrMbF03ObxlPpiQgU3/VdqihNCFUbKpgSdOpek8zQQCFXW0OFUyWGkwDJwJt4M9Kf3wwHdDevPtlWr8LQ2g5YWqqVgBJag7KkCLVSmw= 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 1777551385831615.8060002398305; Thu, 30 Apr 2026 05:16:25 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id C28544181C; Thu, 30 Apr 2026 08:16:24 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 26BBD43DEF; Thu, 30 Apr 2026 07:46:48 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 7C3524180E; Thu, 30 Apr 2026 07:46:33 -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 C1C2841847 for ; Thu, 30 Apr 2026 07:44:17 -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-287-XvdAogwZNCWXm7ZBxWoM6w-1; Thu, 30 Apr 2026 07:44:15 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 C02CE19560B7 for ; Thu, 30 Apr 2026 11:44:14 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 16A14300019F for ; Thu, 30 Apr 2026 11:44:13 +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_H4, 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=1777549457; 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=qXruz+7JZ4hU3d+UBm61ijmGxE3qsAHo5LBqh0MkhmQ=; b=RTgO5o9aB1hIJMNrjWHH+pFtN2GCyoSwflqIujz8PlIhn9e2se5HuE8+aeGSgpXKAUDc+i mOztdrjNjr5o1RT5swuwNzrFjzBiDboej4KLWwes6g7VKAzGIH88h3ZFvL3VwpdAGO6mPw BAozc/7DG1q5pbwkZ3rQzgoUMgDkzMM= X-MC-Unique: XvdAogwZNCWXm7ZBxWoM6w-1 X-Mimecast-MFC-AGG-ID: XvdAogwZNCWXm7ZBxWoM6w_1777549454 To: devel@lists.libvirt.org Subject: [PATCH v2 18/35] qemuDomainGetLaunchSecurityInfo: Move flag check to top level Date: Thu, 30 Apr 2026 13:43:34 +0200 Message-ID: <0cc41af042c7f832dd4bfa79b01d30f5967e8bfd.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: LHtlbiUZ3VedYILWze1r-XHQkrdQnTY5PS0JBnkBPeQ_1777549454 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: RHX4NCL7RIZWHG7Y6PGGKBBH3PBXWRL5 X-Message-ID-Hash: RHX4NCL7RIZWHG7Y6PGGKBBH3PBXWRL5 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: 1777551387437158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The flag check inside 'qemuDomainGetSEVInfo' makes no sense because it only validates the 'VIR_TYPED_PARAM_STRING_OKAY' which is not actually used. Remove the 'flags parameter from 'qemuDomainGetSEVInfo' and validate flags at 'qemuDomainGetLaunchSecurityInfo' Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a2b5959e55..781efd612c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19668,16 +19668,13 @@ qemuNodeGetSEVInfo(virConnectPtr conn, static int qemuDomainGetSEVInfo(virDomainObj *vm, - virTypedParamList *list, - unsigned int flags) + virTypedParamList *list) { int ret =3D -1; int rv; g_autofree char *tmp =3D NULL; qemuMonitorSEVInfo info =3D { }; - virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); - if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) return -1; @@ -19737,6 +19734,8 @@ qemuDomainGetLaunchSecurityInfo(virDomainPtr domain, virDomainObj *vm; int ret =3D -1; + virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); + if (!(vm =3D qemuDomainObjFromDomain(domain))) goto cleanup; @@ -19751,7 +19750,7 @@ qemuDomainGetLaunchSecurityInfo(virDomainPtr domain, switch (vm->def->sec->sectype) { case VIR_DOMAIN_LAUNCH_SECURITY_SEV: case VIR_DOMAIN_LAUNCH_SECURITY_SEV_SNP: - if (qemuDomainGetSEVInfo(vm, list, flags) < 0) + if (qemuDomainGetSEVInfo(vm, list) < 0) goto cleanup; break; case VIR_DOMAIN_LAUNCH_SECURITY_PV: --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777551448; cv=none; d=zohomail.com; s=zohoarc; b=J6hnPY3rWnBE1T/saZch72n6LO+8aSZmY5JtLAF4E5JdhAYZxwhkfqXvScXj2p+KD+mWGTsQUWHbCNGTP1C6qQ8pJidSSUGY+lGuQBpg22GlGMz5uFUJwReR4/k1en67/ZBzbl0cZHwSoOWpRvFiucwPWy5lEKJH2EhQwo9zBEc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777551448; 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=JCRnMhLzo2NQ0C+RADC0jKsgko8qEoPOA0vi6gwj88g=; b=UXFdyScGOACevbOziHb3xkAror5bYl5MOnoKE5zwskRXk0lIfaLF1sEUvZafGRUGn5dnWrSh0NGsq4VQ498hN8ULGIekhr/T6aVWhZoktn8PmGQx1cld0hWrdC6h9s9/nU68J1hf3h5fn8XNLkhfZ42uCVzsYIFShgmq6P1GoIo= 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 1777551448080180.43525670138501; Thu, 30 Apr 2026 05:17:28 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 2C23A3F86D; Thu, 30 Apr 2026 08:17:27 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 31E6F43E50; Thu, 30 Apr 2026 07:46:56 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 187D741CFC; Thu, 30 Apr 2026 07:46:41 -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 6980F41998 for ; Thu, 30 Apr 2026 07:44:18 -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-590-BtC8radLNmGdSKeWShr5oA-1; Thu, 30 Apr 2026 07:44:16 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 068C5195608F for ; Thu, 30 Apr 2026 11:44:16 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 31D2D30001A1 for ; Thu, 30 Apr 2026 11:44:14 +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=1777549458; 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=JCRnMhLzo2NQ0C+RADC0jKsgko8qEoPOA0vi6gwj88g=; b=UaKnCo7L0cqqkXjDkJga5aufrViBT4ButmZUZoBzSr1lK0bGLNJVVx0SOQxVjLvZjoo6pI GXGdBq0n++gVnsWS8LjNvOfxDl//+T5bZiaSUk4Kne8CR+gyxpc78xZ5jMlxaP4S7Yg/iX Oto81wkOch9AAQvakmaaIN5G2z1DDsM= X-MC-Unique: BtC8radLNmGdSKeWShr5oA-1 X-Mimecast-MFC-AGG-ID: BtC8radLNmGdSKeWShr5oA_1777549456 To: devel@lists.libvirt.org Subject: [PATCH v2 19/35] qemuDomainDetachDeviceAlias: Move 'flags' validation to top level Date: Thu, 30 Apr 2026 13:43:35 +0200 Message-ID: <9cb476ed5558d114d1086d53791b8ef945bb4969.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: bjYcmnqLQb7u6Nny_q5_TsIva-SJ0_y5spDZwf-SALI_1777549456 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: Z2IR2ULBWUROGX4T5X4JGOIM5YXMJIOK X-Message-ID-Hash: Z2IR2ULBWUROGX4T5X4JGOIM5YXMJIOK 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: 1777551449725158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 781efd612c..8e30857b34 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7742,9 +7742,6 @@ qemuDomainDetachDeviceAliasLiveAndConfig(virQEMUDrive= r *driver, g_autoptr(virDomainDef) vmdef =3D NULL; unsigned int parse_flags =3D VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE; - virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | - VIR_DOMAIN_AFFECT_CONFIG, -1); - cfg =3D virQEMUDriverGetConfig(driver); if ((flags & VIR_DOMAIN_AFFECT_CONFIG) && @@ -7840,6 +7837,9 @@ qemuDomainDetachDeviceAlias(virDomainPtr dom, virDomainObj *vm =3D NULL; int ret =3D -1; + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + if (!(vm =3D qemuDomainObjFromDomain(dom))) goto cleanup; --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777551516; cv=none; d=zohomail.com; s=zohoarc; b=FN9JkeEjC6YSlN4JiCYcUwJqqbCjagyVKBf4kbT6eXnDZQjBddmo2jIbV2cRzIxNnxcFVGDeLx9WlR4RZOJvwePxXSyb900cPD/UPAiwQo+k0vVIbxAVh67fANeY8Erv0xLCw938AACKuWpHAlvQYPzf/y1ZTBq0aRo686KWRr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777551516; 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=x5jiThP0lSIWm/rpBytymMYc8RehpcLcJ3drLsdF9Wc=; b=kxxz4GnIq+Bg70WcQZgTSQFAVz7emUyftH+BrEQIvqU00gTpPqyajl5x3tYczn0vawaUEQI8OtG9u3AJvoxLIPoPprZt6ZfMqLXs7mjjbThgTTY1jiWV8/c0HUux2V0OiebKslv/Peya4Ay8RoEtcRn0To8KVMfgl2hVHM9d+rI= 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 1777551516629974.4634612367845; Thu, 30 Apr 2026 05:18:36 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B03C7417EC; Thu, 30 Apr 2026 08:18:35 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id D039C43E83; Thu, 30 Apr 2026 07:47:38 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E029241E34; Thu, 30 Apr 2026 07:47:27 -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 21344419F9 for ; Thu, 30 Apr 2026 07:44:20 -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-57-XHWPRbL4MfC6Qt7-l-u55A-1; Thu, 30 Apr 2026 07:44:17 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 150661800350 for ; Thu, 30 Apr 2026 11:44:17 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5F4B6300019F for ; Thu, 30 Apr 2026 11:44:16 +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_H4, 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=1777549459; 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=x5jiThP0lSIWm/rpBytymMYc8RehpcLcJ3drLsdF9Wc=; b=GeekeJLQm2WlRvufCWH8ITTuGUJdX3Eg9fTAzT20Z0ENfpz8JwPHtIC+NBIPzO44NB9rX0 o7FCTgeA/tReEvlDgWiLh0/m57SPrl3EdC66nh7hG4L/9pdWHmcgvFIuTmc1Y6M3iGRgfa Eq5SFrKIlOY+RylXVphZ7+NnT/XXNvI= X-MC-Unique: XHWPRbL4MfC6Qt7-l-u55A-1 X-Mimecast-MFC-AGG-ID: XHWPRbL4MfC6Qt7-l-u55A_1777549457 To: devel@lists.libvirt.org Subject: [PATCH v2 20/35] qemuDomainManagedSaveDefineXML: Add top-level flag validation Date: Thu, 30 Apr 2026 13:43:36 +0200 Message-ID: <5dd4744839a88e2a4356d283de7062a51e5956a5.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ZuV_5CyAMr21I9NH2GeW8EBOJ-zSZwuErkNMPGTBNow_1777549457 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HT57S2W6C2OQKY72QGSKYENQ3QCIKOE2 X-Message-ID-Hash: HT57S2W6C2OQKY72QGSKYENQ3QCIKOE2 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: 1777551518064158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The implementation for managed save uses 'qemuDomainSaveImageDefineXML' internally which validates the flags. To have a top level flag validation for the upcoming flag introspection export the supported flags as a macro and add a 'virCheckFlags' to 'qemuDomainManagedSaveDefineXML'. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8e30857b34..34d8f0257d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6120,6 +6120,11 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, co= nst char *path, return ret; } + +#define QEMU_SAVE_IMAGE_DEFINE_FLAGS \ + VIR_DOMAIN_SAVE_RUNNING | \ + VIR_DOMAIN_SAVE_PAUSED + static int qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, const char *dxml, unsigned int flags) @@ -6132,8 +6137,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, cons= t char *path, virQEMUSaveData *data =3D NULL; int state =3D -1; - virCheckFlags(VIR_DOMAIN_SAVE_RUNNING | - VIR_DOMAIN_SAVE_PAUSED, -1); + virCheckFlags(QEMU_SAVE_IMAGE_DEFINE_FLAGS, -1); if (flags & VIR_DOMAIN_SAVE_RUNNING) state =3D 1; @@ -6243,6 +6247,8 @@ qemuDomainManagedSaveDefineXML(virDomainPtr dom, cons= t char *dxml, g_autofree char *path =3D NULL; int ret =3D -1; + virCheckFlags(QEMU_SAVE_IMAGE_DEFINE_FLAGS, -1); + if (!(vm =3D qemuDomainObjFromDomain(dom))) return -1; --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777551609; cv=none; d=zohomail.com; s=zohoarc; b=RyuzTxRfITC1Sr8YapCz5ZHc4XNYPfpJtbJpApQh1mH7/b7HsFN3vg+eUuD7TUARKmO34a8H7ty9edeem+l5v+k5P8nrPwRdyZVW/0nhtsf9oInP//YTXWLlRoCwwhv6rq+d1qJ4kZXqAujB1BBxc6JShsbE4XpUwoBkCQReY48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777551609; 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=yKwVO46CDtXgY5l56da/ME/5HR2rjGsxvASyoETBlcs=; b=hIPq5MEBANjQ8WxQpn1TlciKMdHPMwJd6e3pDGnGC97TtHJUnxWZ78mMeT52YgT4S3XxO28Bt2G87GTx3769y+3j8DUMdAR1sVSMB8bNqpyeYcKwUNZyiTWXxLMbZHIQUSsgz2skKwKlpcHO/Um8KBtITCsuNS/A+1n0GXlLUSo= 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 1777551609672821.3892555229842; Thu, 30 Apr 2026 05:20:09 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B740541835; Thu, 30 Apr 2026 08:20:08 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id D7E4F43ECE; Thu, 30 Apr 2026 07:47:56 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 1A73741D04; Thu, 30 Apr 2026 07:47:46 -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 D339B419E5 for ; Thu, 30 Apr 2026 07:44:20 -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-572-PR-L9c-QOiSgIHFXeRpd_w-1; Thu, 30 Apr 2026 07:44:19 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 2E0FC180049F for ; Thu, 30 Apr 2026 11:44:18 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 79A86300019F for ; Thu, 30 Apr 2026 11:44:17 +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=1777549460; 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=yKwVO46CDtXgY5l56da/ME/5HR2rjGsxvASyoETBlcs=; b=YkcTQj9SIsJj9sylZUjtCsd+wyg+1YiRtHBAs7Ar6NNjlShD7yW/7qGexSf2mu4RogNtfb TFaq343sHFtfD1d1rg7TXQ1MJeSxRGpwFt7Q5oGjhGgyWMiVlu9Ujb9w9Tz+jid3F0lMwJ yS3OEssX3Sd79Rl31GTe7FdKN8/cV7U= X-MC-Unique: PR-L9c-QOiSgIHFXeRpd_w-1 X-Mimecast-MFC-AGG-ID: PR-L9c-QOiSgIHFXeRpd_w_1777549458 To: devel@lists.libvirt.org Subject: [PATCH v2 21/35] qemuDomainQemuMonitorCommand: Add top-level flag validation Date: Thu, 30 Apr 2026 13:43:37 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: dcyBJYHx14SumTMCG1wJMDdhFt5WX1wUwVYXWM53VPY_1777549458 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 7NFU4VSAZBAI6I3DDB7C27ZZVZ4KK2ZC X-Message-ID-Hash: 7NFU4VSAZBAI6I3DDB7C27ZZVZ4KK2ZC 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: 1777551610479158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The implementation uses 'qemuDomainQemuMonitorCommandWithFiles' internally. To have a top level flag validation for the upcoming flag introspection export the supported flags as a macro and add a 'virCheckFlags'. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 34d8f0257d..1eef19d3ff 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13720,6 +13720,9 @@ qemuDomainBackupGetXMLDesc(virDomainPtr domain, } +#define QEMU_DOMAIN_MONITOR_COMMAND_FLAGS \ + VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP + static int qemuDomainQemuMonitorCommandWithFiles(virDomainPtr domain, const char *cmd, @@ -13737,7 +13740,7 @@ qemuDomainQemuMonitorCommandWithFiles(virDomainPtr = domain, bool hmp; int fd =3D -1; - virCheckFlags(VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP, -1); + virCheckFlags(QEMU_DOMAIN_MONITOR_COMMAND_FLAGS, -1); /* currently we don't pass back any fds */ if (outfds) @@ -13791,6 +13794,8 @@ qemuDomainQemuMonitorCommand(virDomainPtr domain, char **result, unsigned int flags) { + virCheckFlags(QEMU_DOMAIN_MONITOR_COMMAND_FLAGS, -1); + return qemuDomainQemuMonitorCommandWithFiles(domain, cmd, 0, NULL, NUL= L, NULL, result, flags); } --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777551688; cv=none; d=zohomail.com; s=zohoarc; b=VuZcq2v3yfkIyqkSaVCvMGqFoh2WsqF0TXEjSkT3L5nZWN6yCV6WdZRUaMHdBzDNR4lA1NBh9fkVrZdILd1pnQ/Eo9o0aUhFN65goxocIIehvuVTFLU1UbTf2NwloBBrH4zOFXQTQ9HgWsYgO2ulR5uyT7a/gb1RcnhYVn1JNyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777551688; 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=fx/CcU26g1SM+9sAlLWSHy48R/iKjqX92NveF+lbQzc=; b=NG1xZJU9nAoqwR51yDwLN5vQayzUKH7h5UysXMtywqNDhI1HuyooIKEBW+trBEZC6cAG5V5x4Lda2uQrcYkxMV3hlOb5Z7oLwQXlk4YbKVDp74xC2xN7Tzrr11H/et4jjxzcn0/GGSpDfdLnsTS/t3AWwzXhHmjLPSYg1CY00CU= 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 1777551688762484.5534996724615; Thu, 30 Apr 2026 05:21:28 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id EA27041AFD; Thu, 30 Apr 2026 08:21:27 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 9BE3943F0B; Thu, 30 Apr 2026 07:48:21 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 04BB04196F; Thu, 30 Apr 2026 07:48:10 -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 E577D419FD for ; Thu, 30 Apr 2026 07:44:21 -0400 (EDT) Received: from mx-prod-mc-08.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-551-5xpQuOovPaWZXVElAJPa0g-1; Thu, 30 Apr 2026 07:44:20 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4816418004AD for ; Thu, 30 Apr 2026 11:44:19 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 935BA300019F for ; Thu, 30 Apr 2026 11:44:18 +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_H4, 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=1777549461; 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=fx/CcU26g1SM+9sAlLWSHy48R/iKjqX92NveF+lbQzc=; b=VM6Mq6PoYZ/hC+bsInRNlpGZSDmzAqpIxIPuKxKNwUZvnP26Nf8HZr3fPgRmBbdOIX/EIa 12syEBhcH3CDdJ7PWDKcsjdW48K1ohdHBEbT5/wbj+bsyHw5CgBDCj23axqz7cSs9bQaHW bdYtvbGDlBQlFjWJDk3QNHzlqq5nnjQ= X-MC-Unique: 5xpQuOovPaWZXVElAJPa0g-1 X-Mimecast-MFC-AGG-ID: 5xpQuOovPaWZXVElAJPa0g_1777549459 To: devel@lists.libvirt.org Subject: [PATCH v2 22/35] qemuConnectDomainQemuMonitorEventRegister: Add top-level flag validation Date: Thu, 30 Apr 2026 13:43:38 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: kLLplj1OEsfgrJS24Ljufl1gYyXjj7ovFTbPFxu7CpM_1777549459 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: TFHXKLG3L7TZJPLM6LBGJG2YLRKJQP5S X-Message-ID-Hash: TFHXKLG3L7TZJPLM6LBGJG2YLRKJQP5S 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: 1777551689490154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The implementation uses 'virDomainQemuMonitorEventStateRegisterID' internally. To have a top level flag validation for the upcoming flag introspection export the supported flags as a macro and add a 'virCheckFlags'. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_event.c | 4 +--- src/conf/domain_event.h | 5 +++++ src/qemu/qemu_driver.c | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c index 88087bad4f..4fb0f68ae9 100644 --- a/src/conf/domain_event.c +++ b/src/conf/domain_event.c @@ -2471,9 +2471,7 @@ virDomainQemuMonitorEventStateRegisterID(virConnectPt= r conn, return -1; if (flags !=3D -1) - virCheckFlags(VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX= | - VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_NOCAS= E, - -1); + virCheckFlags(VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_FLAGS= , -1); data =3D g_new0(virDomainQemuMonitorEventData, 1); data->flags =3D flags; if (event && flags !=3D -1) { diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h index f31cfb9e42..63ecd66b21 100644 --- a/src/conf/domain_event.h +++ b/src/conf/domain_event.h @@ -334,6 +334,11 @@ virDomainEventStateDeregister(virConnectPtr conn, virConnectDomainEventCallback callback) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); + +#define VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_FLAGS \ + VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX | \ + VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_NOCASE + int virDomainQemuMonitorEventStateRegisterID(virConnectPtr conn, virObjectEventState *state, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1eef19d3ff..758dbbe19f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16352,6 +16352,8 @@ qemuConnectDomainQemuMonitorEventRegister(virConnec= tPtr conn, virQEMUDriver *driver =3D conn->privateData; int ret =3D -1; + virCheckFlags(VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_FLAGS, -1= ); + if (virConnectDomainQemuMonitorEventRegisterEnsureACL(conn) < 0) return -1; --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777551770; cv=none; d=zohomail.com; s=zohoarc; b=f2Je+Af8Pf671/tDWsvBvg3J4nb9Xobi1rXQ9+cSc8H2XnkELM4EDdfrp6Jbz8guMmdtqKTx9Ep9nCmf4rj8Bz4HBD3K57rzVdzFyA9zUqGWMQXHroCO9KlnVOA7YrtM8hpJtenIp6TMSrRfDhtbDyII17BYYCtea3eAF5pGkCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777551770; 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=15/W9I0W+O/gWEk/poroFJUa8CJG+aHCN/3AjJptrUU=; b=JqgVYCqXJvFgwFzSW2jFkW1QTJhDEm1iHwdVzSUq/NH70x4bh0S+uDFxttsQcZqZ0j8gSKoi2cz2LQ+s9uHtTj5Tp0eFAxFy4frsFtHYp2F2gidgpK1nyGCNgx3C7+kkFIsYcm232XXId2T8hdnX11riCzy7me6CPmRgQVoMUgk= 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 177755177071642.91880301728895; Thu, 30 Apr 2026 05:22:50 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id DCC4841992; Thu, 30 Apr 2026 08:22:49 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id C4BAD41817; Thu, 30 Apr 2026 07:48:43 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 3156141818; Thu, 30 Apr 2026 07:48:35 -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 DCA4641A40 for ; Thu, 30 Apr 2026 07:44:22 -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-592-nhAPe5O_NiiChtLCo2n5hQ-1; Thu, 30 Apr 2026 07:44:21 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 61EA31800473 for ; Thu, 30 Apr 2026 11:44:20 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id ACB5530001A1 for ; Thu, 30 Apr 2026 11:44:19 +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=1777549462; 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=15/W9I0W+O/gWEk/poroFJUa8CJG+aHCN/3AjJptrUU=; b=Bplx+xvwWoaAy8duuXJ4TUPNBMBCDmHNT9RiGTizWzDtVa+/MTbaav9wRju3bjhXVxqYcq +PtzSbuWnaFEILA5ivBLxTDuiyhyvrRTNGDLwSDYXS+0LY13vjpjYCjDvmA7Ljpu15/qK9 JLQXgCbTnoXQiIjYhnk6diS7THjpg3s= X-MC-Unique: nhAPe5O_NiiChtLCo2n5hQ-1 X-Mimecast-MFC-AGG-ID: nhAPe5O_NiiChtLCo2n5hQ_1777549460 To: devel@lists.libvirt.org Subject: [PATCH v2 23/35] qemuDomainGetMetadata: Add top-level flag validation Date: Thu, 30 Apr 2026 13:43:39 +0200 Message-ID: <11ea34d94205a0c56189325f01bb1472ec1d4ac5.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: zrbwE8psOuipIHuyZ85rUg_kXHOeUx79fzaQ1ILTBDo_1777549460 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: P2I5DUANLNXTQICAG6N4HAAJVP6YN25W X-Message-ID-Hash: P2I5DUANLNXTQICAG6N4HAAJVP6YN25W 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: 1777551772744154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The implementation uses 'virDomainObjGetMetadata' internally. To have a top level flag validation for the upcoming flag introspection export the supported flags as a macro and add a 'virCheckFlags'. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 3 +-- src/conf/domain_conf.h | 4 ++++ src/qemu/qemu_driver.c | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3497e84bf5..d73bac5cc5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -31557,8 +31557,7 @@ virDomainObjGetMetadata(virDomainObj *vm, virDomainDef *def; char *ret =3D NULL; - virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | - VIR_DOMAIN_AFFECT_CONFIG, NULL); + virCheckFlags(VIR_DOMAIN_OBJ_GET_METADATA_FLAGS, NULL); if (type >=3D VIR_DOMAIN_METADATA_LAST) { virReportError(VIR_ERR_INVALID_ARG, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a8f90803da..bdfb99ed1d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -4543,6 +4543,10 @@ const char *virDomainChrSourceDefGetPath(virDomainCh= rSourceDef *chr); void virDomainChrSourceDefClear(virDomainChrSourceDef *def); +#define VIR_DOMAIN_OBJ_GET_METADATA_FLAGS \ + VIR_DOMAIN_AFFECT_LIVE | \ + VIR_DOMAIN_AFFECT_CONFIG + char *virDomainObjGetMetadata(virDomainObj *vm, int type, const char *uri, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 758dbbe19f..c8975fbbf6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15998,6 +15998,8 @@ qemuDomainGetMetadata(virDomainPtr dom, virDomainObj *vm; char *ret =3D NULL; + virCheckFlags(VIR_DOMAIN_OBJ_GET_METADATA_FLAGS, NULL); + if (!(vm =3D qemuDomainObjFromDomain(dom))) return NULL; --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777551875; cv=none; d=zohomail.com; s=zohoarc; b=UvxJpQJo30BvrxZJ1bXAGIKJhie9b2j13CR8PgETLhTcduLOYS7AbQvhZoEKFZ73QaR9CBKOW8Q2WTvYfkdJGkOX067xBFtUkEdfUpSfUeoBK20nAX642NV0Hf9Q4CG+I/8DdePCq78ytKDmMHnXQuOELoR9chQOqHeadq2aU0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777551875; 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=Zv2qjy9Lk6I1swZnfgyRfxCQY96reJFOw07Nu5EUTKI=; b=llng4B7wFmA3iRH7Uz7Qgfw0flfEYBr+kfFxN0yeDb4bRiPATKJdhhTWKV/tYx8Q8lW0AF6UqLmxwMhawsAc0yG0dBl7VIT7OV2pMVysW/pGHqkelyphXN/3TKDXnWdwVN3aq/uZAwAGK8VoM5fxmNcFuzkh20v+ulAMvTrBO4g= 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 1777551875979679.9852890583812; Thu, 30 Apr 2026 05:24:35 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id F3AEE41B06; Thu, 30 Apr 2026 08:24:34 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id E1D7643F7C; Thu, 30 Apr 2026 07:49:13 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 85213419D2; Thu, 30 Apr 2026 07:49:02 -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 F23F641A7F for ; Thu, 30 Apr 2026 07:44:23 -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-602-MLM9lXa5N5iwlUNO1y0MjQ-1; Thu, 30 Apr 2026 07:44:22 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 77DE619560B7 for ; Thu, 30 Apr 2026 11:44:21 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C66CD300019F for ; Thu, 30 Apr 2026 11:44:20 +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=1777549463; 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=Zv2qjy9Lk6I1swZnfgyRfxCQY96reJFOw07Nu5EUTKI=; b=hth4Uw+dCxynM+sV+PGEG46MP/TyEkhtzF9JPgzUmRKtbqCxLmkFQ6HbJth3+T931MIpUQ zogOeZFbG1fAVJ8/geBNTqB1z3bWdqPa1Cx+L+IyKM1fPnbOmq4sEOMcrjxWjwUTZLMiKb rXgTodwfMSNvnbQteG6a2zfmYDMt/t0= X-MC-Unique: MLM9lXa5N5iwlUNO1y0MjQ-1 X-Mimecast-MFC-AGG-ID: MLM9lXa5N5iwlUNO1y0MjQ_1777549461 To: devel@lists.libvirt.org Subject: [PATCH v2 24/35] API: Introduce 'virConnectGetIntrospection' Date: Thu, 30 Apr 2026 13:43:40 +0200 Message-ID: <71ca4d2589425aa2c0a3e364dd84369ccd02a3bd.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 3bztPpe6kEaPCGFHzxTksqCW1CHdQMZVqglj8-i0caQ_1777549461 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: B6TOG7KD3TKIZGHCHDIDHCGWJMLGOXHN X-Message-ID-Hash: B6TOG7KD3TKIZGHCHDIDHCGWJMLGOXHN 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: 1777551877862158500 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=C3=A1n Tomko --- include/libvirt/libvirt-host.h | 3 +++ src/driver-hypervisor.h | 5 +++++ src/libvirt-host.c | 40 ++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 5 +++++ src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 15 ++++++++++++- src/remote_protocol-structs | 7 ++++++ 7 files changed, 75 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-host.h b/include/libvirt/libvirt-host.h index 5b448e7954..f9562df9e7 100644 --- a/include/libvirt/libvirt-host.h +++ b/include/libvirt/libvirt-host.h @@ -1041,5 +1041,8 @@ int virNodeAllocPages(virConnectPtr conn, unsigned int cellCount, unsigned int flags); +char *virConnectGetIntrospection(virConnectPtr conn, + unsigned int flags); + #endif /* LIBVIRT_HOST_H */ diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 6a43688b0c..79a7d819a4 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1473,6 +1473,10 @@ typedef int const char *groupname, unsigned int flags); +typedef char * +(*virDrvConnectGetIntrospection)(virConnectPtr conn, + unsigned int flags); + typedef struct _virHypervisorDriver virHypervisorDriver; /** @@ -1750,4 +1754,5 @@ struct _virHypervisorDriver { virDrvDomainGraphicsReload domainGraphicsReload; virDrvDomainSetThrottleGroup domainSetThrottleGroup; virDrvDomainDelThrottleGroup domainDelThrottleGroup; + virDrvConnectGetIntrospection connectGetIntrospection; }; diff --git a/src/libvirt-host.c b/src/libvirt-host.c index 6b4345b09d..eec3d4d3cd 100644 --- a/src/libvirt-host.c +++ b/src/libvirt-host.c @@ -142,6 +142,46 @@ virConnectSupportsFeature(virConnectPtr conn, int feat= ure) } +/** + * virConnectGetIntrospection: + * @conn: pointer to the hypervisor connection + * @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. + * + * Returns: XML string containing the introspection data. Caller is respon= sible + * for freeing the associated memory. On error NULL is returned. + * + * Since: 12.4.0 + */ +char * +virConnectGetIntrospection(virConnectPtr conn, + unsigned int flags) +{ + VIR_DEBUG("conn=3D%p, flags=3D0x%x", conn, flags); + + virResetLastError(); + + virCheckConnectReturn(conn, NULL); + + if (conn->driver->connectGetIntrospection) { + char *ret =3D conn->driver->connectGetIntrospection(conn, 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 c506acd2ed..3a01d21d33 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -956,4 +956,9 @@ LIBVIRT_11.2.0 { virDomainDelThrottleGroup; } LIBVIRT_10.2.0; +LIBVIRT_12.4.0 { + global: + 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 ec71eaed87..e26da6a309 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -7935,6 +7935,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainGraphicsReload =3D remoteDomainGraphicsReload, /* 10.2.0 */ .domainSetThrottleGroup =3D remoteDomainSetThrottleGroup, /* 11.2.0 */ .domainDelThrottleGroup =3D remoteDomainDelThrottleGroup, /* 11.2.0 */ + .connectGetIntrospection =3D remoteConnectGetIntrospection, /* 12.4.0 = */ }; static virNetworkDriver network_driver =3D { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 38a83c64ea..5ba88d4582 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -4009,6 +4009,13 @@ struct remote_domain_event_nic_mac_change_msg { remote_nonnull_string newMAC; }; +struct remote_connect_get_introspection_args { + unsigned int flags; +}; + +struct remote_connect_get_introspection_ret { + remote_nonnull_string xml; +}; /*----- Protocol. -----*/ /* Define the program number, protocol version and procedure numbers here.= */ @@ -7120,5 +7127,11 @@ enum remote_procedure { * @generate: both * @acl: none */ - REMOTE_PROC_DOMAIN_EVENT_NIC_MAC_CHANGE =3D 453 + REMOTE_PROC_DOMAIN_EVENT_NIC_MAC_CHANGE =3D 453, + + /** + * @generate: both + * @acl: connect:read + */ + REMOTE_PROC_CONNECT_GET_INTROSPECTION =3D 454 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index d11a8f91a9..9d02ae762e 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -3337,6 +3337,12 @@ struct remote_domain_event_nic_mac_change_msg { remote_nonnull_string oldMAC; remote_nonnull_string newMAC; }; +struct remote_connect_get_introspection_args { + 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, @@ -3791,4 +3797,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_SET_THROTTLE_GROUP =3D 451, REMOTE_PROC_DOMAIN_DEL_THROTTLE_GROUP =3D 452, REMOTE_PROC_DOMAIN_EVENT_NIC_MAC_CHANGE =3D 453, + REMOTE_PROC_CONNECT_GET_INTROSPECTION =3D 454, }; --=20 2.54.0 From nobody Wed Jun 10 17:27:23 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=1777551957; cv=none; d=zohomail.com; s=zohoarc; b=U++FXmXt4zJ9HtKQHCZzTRFavyy4fU41MH6HtynGbqJ0KpN541Vr0iXscr+rNY7QPPEtKvzSphxcC031b5d/fEdFd2Y2zR4YKAmif7aPlqJUtLad/O/8N96uQsBini+4R5O2Gz/Bb2aTzbiOk9zpi2KCWEElL4g7F1PME21t9ww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777551957; 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=tJyKnENq6PDU7GexDpbCMFR2YiU5xb6zQ8Xgyr4c5I0=; b=ZWheldy5drhtttncG77M/67aY4VSY7zLKLdjb2cEs9JGxAEZ9npC7GDMrgalvabrdgZQZtIY1hUXUO28RP2Zm9rDzVIBsDvb/4ES8i6IqvE56K/uzGrS68ZmRXLDgDNmvR+cFomPyVd55aLC5pqq1sBHBCOsluJ+j7rHKiSa9Kc= 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 1777551957734550.5722888123856; Thu, 30 Apr 2026 05:25:57 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 11EC84194F; Thu, 30 Apr 2026 08:25:57 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id EF48543FC4; Thu, 30 Apr 2026 07:49:19 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 3482841CF5; Thu, 30 Apr 2026 07:49: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 452433F874 for ; Thu, 30 Apr 2026 07:44:25 -0400 (EDT) Received: from mx-prod-mc-08.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-64-8mUBN0CZOsWv1KDJDbomkQ-1; Thu, 30 Apr 2026 07:44:23 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8F5A918002C6 for ; Thu, 30 Apr 2026 11:44:22 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DE4CA30001A1 for ; Thu, 30 Apr 2026 11:44:21 +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=1777549464; 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=tJyKnENq6PDU7GexDpbCMFR2YiU5xb6zQ8Xgyr4c5I0=; b=SImfpCRlh8u7n+o2ihxW9eQMnene7um8hiYfF2HkXb73xd0L+mL+4Fy4kvehNGSrKYmpY2 KINTg803P/x6bMURGoE4zKAKGkbxbtQRD/8C50gMbzhNFaTsyv65FUHseOmieD+Mu9Tf78 ZTfokBK7tBy/npvTMH+NUuZjjZRQ3uM= X-MC-Unique: 8mUBN0CZOsWv1KDJDbomkQ-1 X-Mimecast-MFC-AGG-ID: 8mUBN0CZOsWv1KDJDbomkQ_1777549462 To: devel@lists.libvirt.org Subject: [PATCH v2 25/35] virsh: Introduce 'introspection' command which uses 'virConnectGetIntrospection' Date: Thu, 30 Apr 2026 13:43:41 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: dcY3KpkK2CohcTVBrAV7c2NzyP0vSCyickgC7jWenhY_1777549462 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: VNPXIWBIJKV4YNBGTVLVWSL5XHS43UQR X-Message-ID-Hash: VNPXIWBIJKV4YNBGTVLVWSL5XHS43UQR 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: 1777551959519154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n 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 80b0ea14a8..01e2ac9d32 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -1097,6 +1097,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 ef91e22fed..e1980bc276 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1864,6 +1864,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, 0))) + return false; + + return virshDumpXML(ctl, xml, "domain", xpath, wrap); +} + + const vshCmdDef hostAndHypervisorCmds[] =3D { {.name =3D "allocpages", .handler =3D cmdAllocpages, @@ -2003,5 +2040,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 10 17:27:24 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=1777552124; cv=none; d=zohomail.com; s=zohoarc; b=LX1Db2wpF4DAif1gmySKfYhayPmnCkyzXA8cwNJDWWkTjlCVbnOevZptfDUNXRWk1m7T6aH61acauCe8IqCmt/0NRA+Yoa/1rAfA8uvUz6gZYJtBBlGvH6fj37TVXtSxNsxDaLs8XR8dWAqszL20zO2YoaF+N5EpOYU0Hdf6mA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777552124; 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=qeRAG6pkvwX7oFfgXjLSrbAxgDTnZGYc3NVj27cRqbk=; b=OH+TWkdmBdU/Oa8j9CTLnoi32BlMIiqk/1TxR91SV2sNjQiNgHXLT0ofmDVTsS16GzI6sXdB4Ja5yySwwiC7KF3VTsJW+jLataFRJ//I5p48IjT4fEubDyUuPkPT5vRJmyUu7Y4BLEOJ0dyWqeQ3DajfZ74FfuiMWJEAh6pcL3I= 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 1777552124803743.5869970711335; Thu, 30 Apr 2026 05:28:44 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E5AEF41AEC; Thu, 30 Apr 2026 08:28:43 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 258DF41A92; Thu, 30 Apr 2026 07:49:37 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 3BFCA419F3; Thu, 30 Apr 2026 07:49:26 -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 77DA64198C for ; Thu, 30 Apr 2026 07:44:26 -0400 (EDT) Received: from mx-prod-mc-08.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-612-9PswOOSFObaIsG2WW1Y0gQ-1; Thu, 30 Apr 2026 07:44:24 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ACC5918002CC for ; Thu, 30 Apr 2026 11:44:23 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0718530001A1 for ; Thu, 30 Apr 2026 11:44:22 +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=1777549466; 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=qeRAG6pkvwX7oFfgXjLSrbAxgDTnZGYc3NVj27cRqbk=; b=XeB7hxNGgzEHy1sJe+N0uuoHvHK8zthIJl7da/FxXaYmD1J7xOr96Jv/PtJCfd6VxZMl0K oVZvDRute9pSMJp6tPUa3C6aawm0OfNivayy4cl//bTxZ8CwbKNLnQih0ReYc+/MThnBt1 64dmMKYH2tWuEB7oBEXvIBrUGBC0lfA= X-MC-Unique: 9PswOOSFObaIsG2WW1Y0gQ-1 X-Mimecast-MFC-AGG-ID: 9PswOOSFObaIsG2WW1Y0gQ_1777549463 To: devel@lists.libvirt.org Subject: [PATCH v2 26/35] scripts: Introduce 'getintrospection' script Date: Thu, 30 Apr 2026 13:43:42 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: IlXKETZZ6xVE2AtCjtuw0UQFnAutNtd2yDKvy82LM7I_1777549463 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: CKFHGIVSPXTDKN7ATEFNMN23QJAPO7QT X-Message-ID-Hash: CKFHGIVSPXTDKN7ATEFNMN23QJAPO7QT 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: 1777552126129154100 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=C3=A1n Tomko --- scripts/genintrospection.py | 220 ++++++++++++++++++++++++++++++++++++ scripts/meson.build | 1 + src/qemu/meson.build | 18 +++ 3 files changed, 239 insertions(+) create mode 100644 scripts/genintrospection.py diff --git a/scripts/genintrospection.py b/scripts/genintrospection.py new file mode 100644 index 0000000000..25a17e2b0c --- /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 b4fb62f14f..a6cc3d1a85 100644 --- a/src/qemu/meson.build +++ b/src/qemu/meson.build @@ -45,6 +45,23 @@ qemu_driver_sources =3D [ 'qemu_virtiofs.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, python3_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 10 17:27:24 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=1777552231; cv=none; d=zohomail.com; s=zohoarc; b=j77DFVe0pdqejBKK4HRW+2vxhf8jITdVrRKWDpnR4i7zP/rxP4ofOq5FwXAWHPBFeU+lO2JKDp5e/cBENdule3OLQ9OsAxMMYLhMJ8F3eBfxE01ieOATbnN1iQtXMerGtRbbwB0A9v9ZpdPY0pKx1cOqFvetVM/NjFuuL1w5IC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777552231; 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=SgdDDPzll70LoQm29PQxCyPrHanMdbin4RopwReCuDU=; b=kisN6IfzQFEkG6piZp/S0aR2S2nzM2t/2AV7752VE3LpQGNSbIMOiM7NNnb+Z+VeBeTyGYd+Y3u9GpCa5LBX5bLAGu3H+f/KOkkkLUJto6UWTR6d3yrFkAkLLD6heI1PdzWDDh9ZfJBC3MORfCkYp81hlb4DbliC4yIgFenfamU= 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 1777552231006753.0556340058203; Thu, 30 Apr 2026 05:30:31 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id DE0BC41A32; Thu, 30 Apr 2026 08:30:29 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 59E1044052; Thu, 30 Apr 2026 07:49:56 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E864E418A5; Thu, 30 Apr 2026 07:49:45 -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 21640418EA for ; Thu, 30 Apr 2026 07:44:27 -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-427-VauoxuLMOXarbGSYxs7PPg-1; Thu, 30 Apr 2026 07:44:25 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 C38811956054 for ; Thu, 30 Apr 2026 11:44:24 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1DDF3300019F for ; Thu, 30 Apr 2026 11:44:23 +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_H4, 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=1777549466; 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=SgdDDPzll70LoQm29PQxCyPrHanMdbin4RopwReCuDU=; b=QAFANUUusj6p5H77hEQ0jJLoaxV1LcHxIU0/Y6AXRmoOY0pnT2RRL9TFMLso3Cf9uZkQdG /k41BfvoglTgfeWMvQ+0HPXgubgBo6qy7HWX5kY3y4qwYCKtL/wyuLjSlt36ZLQ24pJOgS x2w/RX2SE9OJI17yqSOFbtRqX/ychdw= X-MC-Unique: VauoxuLMOXarbGSYxs7PPg-1 X-Mimecast-MFC-AGG-ID: VauoxuLMOXarbGSYxs7PPg_1777549464 To: devel@lists.libvirt.org Subject: [PATCH v2 27/35] qemu: Implement 'virConnectGetIntrospection' Date: Thu, 30 Apr 2026 13:43:43 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: c5Zpz-aXBp0xZYhs5Dt7QSnCFvbuXuzxvNOLY_U3XlA_1777549464 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: DYIUVZ3W45ZIKSUKXCPOEIOHSELBWB6V X-Message-ID-Hash: DYIUVZ3W45ZIKSUKXCPOEIOHSELBWB6V 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: 1777552231769158501 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=C3=A1n Tomko --- src/libvirt_private.syms | 5 +++++ src/qemu/qemu_driver.c | 17 +++++++++++++++++ src/util/meson.build | 1 + src/util/virintrospection.c | 37 +++++++++++++++++++++++++++++++++++++ src/util/virintrospection.h | 17 +++++++++++++++++ 5 files changed, 77 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 37c9c73d92..706079b87f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2657,6 +2657,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 c8975fbbf6..38f87a4bff 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -105,6 +105,7 @@ #include "virdomaincheckpointobjlist.h" #include "virutil.h" #include "backup_conf.h" +#include "virintrospection.h" #define VIR_FROM_THIS VIR_FROM_QEMU @@ -20871,6 +20872,21 @@ qemuDomainDelThrottleGroup(virDomainPtr dom, } +#include "qemu_introspection.inc.h" + +static char * +qemuConnectGetIntrospection(virConnectPtr conn G_GNUC_UNUSED, + unsigned int flags) +{ + virCheckFlags(0, NULL); + + if (virConnectGetIntrospectionEnsureACL(conn) < 0) + return NULL; + + return virIntrospectionGetXML(driver_api_introspection); +} + + static virHypervisorDriver qemuHypervisorDriver =3D { .name =3D QEMU_DRIVER_NAME, .connectURIProbe =3D qemuConnectURIProbe, @@ -21125,6 +21141,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainSetAutostartOnce =3D qemuDomainSetAutostartOnce, /* 11.2.0 */ .domainSetThrottleGroup =3D qemuDomainSetThrottleGroup, /* 11.2.0 */ .domainDelThrottleGroup =3D qemuDomainDelThrottleGroup, /* 11.2.0 */ + .connectGetIntrospection =3D qemuConnectGetIntrospection, /* 12.4.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 10 17:27:24 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=1777552355; cv=none; d=zohomail.com; s=zohoarc; b=CY/dBkECKt0+hNQa6QXw8tuNOypkvJ26d1SDYK64ji+tkSHzUjYYW5LFoUHriRJuBw2Sk3MYXHikmT3DUr3QeqtvE7b0NERqGUoll/xUYDlJP3CtJl1aKGr49C9Oo7lHyPw5a0dM+0HAr3CK3bw4P2BMNKsMpaTylYByvLd73p8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777552355; 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=m+iz6Nmedj95QpFnKKbR+u2u7L8oPk4TrSEPNnMizHQ=; b=GnADB4m4bI/tSPtoRvEV2v6/VIC8zaVQKj8WzHx2fa5AowbM+i+VlPF8jn20edogjFnerO5D2yFLFYDXC5KTexm8POFQKNBpHFaGwoAcQnic+3uitTbqYdCm/lQus7pVHwCFPZ5jbTVawGNqtIc8zzFesE/q9yWwd2lRsbX02Lk= 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 177755235514460.38121222689381; Thu, 30 Apr 2026 05:32:35 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 7BD2541A90; Thu, 30 Apr 2026 08:32:34 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 95E2B44086; Thu, 30 Apr 2026 07:50:46 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B241743FDB; Thu, 30 Apr 2026 07:50:35 -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 999DC41AA1 for ; Thu, 30 Apr 2026 07:44:28 -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-465-egyvciDoPCyrC2E1TgscDQ-1; Thu, 30 Apr 2026 07:44:26 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 DC06F1956094 for ; Thu, 30 Apr 2026 11:44:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3579D300019F for ; Thu, 30 Apr 2026 11:44:24 +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_H4, 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=1777549468; 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=m+iz6Nmedj95QpFnKKbR+u2u7L8oPk4TrSEPNnMizHQ=; b=M3u3O62rkkh3YxSXTUllblbG0N1E7ejIHpNaUpqCuvh07FZ6ieIxJBnsq9Nw+v2B5sL4wp +8c5AMPxdRCOVUGaTsg6sfLefTEw1r3G9ggZ5oU7dJu1niCRSUVSb4qXnxwd4wNDsybe7A 3W/+yDYbtCADj7Odnes010yGbqgNJdw= X-MC-Unique: egyvciDoPCyrC2E1TgscDQ-1 X-Mimecast-MFC-AGG-ID: egyvciDoPCyrC2E1TgscDQ_1777549466 To: devel@lists.libvirt.org Subject: [PATCH v2 28/35] util: typedparam: Introduce 'virTypedParamsValidateTemplate' Date: Thu, 30 Apr 2026 13:43:44 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: biXdiGEVSHbyhTxDvpDKIl5s-wOiR-4S503kXzUqSV8_1777549466 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 33V5EYDYQNSGDDWXO4Y25M3XPJ5AHSFU X-Message-ID-Hash: 33V5EYDYQNSGDDWXO4Y25M3XPJ5AHSFU 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: 1777552357832154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa While 'virTypedParamsValidate', which uses varargs to pass the template to validate parameters agains, is convenient for single uses we have multiple occasions where we want to validate the same list of parameters in muliple places. We use either a macro which expands to the parameter list in place or a function which encapsulates the validation. For introspection of input typed parameters we'll need to have the list of supported typed parameters in each function which uses them as input and either of the approaches is inconvenient for generating the introspection parts. Refactor 'virTypedParamsValidate', to split the actual validation internals into ''virTypedParamsValidateInternal' and create two wrappers: - 'virTypedParamsValidate' which uses varargs - 'virTypedParamsValidateTemplate' which uses an array of structs containing the template. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 + src/util/virtypedparam.c | 134 +++++++++++++++++++++++++-------------- src/util/virtypedparam.h | 11 ++++ 3 files changed, 100 insertions(+), 46 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 706079b87f..20507af7f7 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3684,6 +3684,7 @@ virTypedParamsRemoteFree; virTypedParamsReplaceString; virTypedParamsSerialize; virTypedParamsValidate; +virTypedParamsValidateTemplate; # util/viruri.h diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index ec8046b998..92f25cea39 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -94,75 +94,55 @@ virTypedParamsSortName(const void *left, return strcmp(param_left->field, param_right->field); } +static int +virTypedParamsSortTemplate(const void *left, + const void *right, + void *opaque G_GNUC_UNUSED) +{ + const virTypedParamValidationTemplate *param_left =3D left; + const virTypedParamValidationTemplate *param_right =3D right; + return strcmp(param_left->name, param_right->name); +} + /* Validate that PARAMS contains only recognized parameter names with * correct types, and with no duplicates except for parameters * specified with VIR_TYPED_PARAM_MULTIPLE flag in type. * Pass in as many name/type pairs as appropriate, and pass NULL to end * the list of accepted parameters. Return 0 on success, -1 on failure * with error message already issued. */ -int -virTypedParamsValidate(virTypedParameterPtr params, int nparams, ...) +static int +virTypedParamsValidateInternal(virTypedParameterPtr params, + size_t nparams, + virTypedParamValidationTemplate *templates, + size_t ntemplates) { - va_list ap; size_t i; size_t j; - const char *name; const char *last_name =3D NULL; - size_t nkeys =3D 0; - size_t nkeysalloc =3D 0; - g_autofree virTypedParameterPtr sorted =3D NULL; - g_autofree virTypedParameterPtr keys =3D NULL; + g_autofree virTypedParameterPtr sorted =3D g_new0(virTypedParameter, n= params); - if (!nparams) { - return 0; - } - - va_start(ap, nparams); - - sorted =3D g_new0(virTypedParameter, nparams); - - /* Here we intentionally don't copy values */ memcpy(sorted, params, sizeof(*params) * nparams); g_qsort_with_data(sorted, nparams, sizeof(*sorted), virTypedParamsSortName, NULL); - name =3D va_arg(ap, const char *); - while (name) { - int type =3D va_arg(ap, int); - VIR_RESIZE_N(keys, nkeysalloc, nkeys, 1); - - if (virStrcpyStatic(keys[nkeys].field, name) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Field name '%1$s' too long"), name); - va_end(ap); - return -1; - } - - keys[nkeys].type =3D type & ~VIR_TYPED_PARAM_MULTIPLE; - /* Value is not used anyway */ - keys[nkeys].value.i =3D type & VIR_TYPED_PARAM_MULTIPLE; - - nkeys++; - name =3D va_arg(ap, const char *); - } - - va_end(ap); - - g_qsort_with_data(keys, nkeys, sizeof(*keys), virTypedParamsSortName, = NULL); + g_qsort_with_data(templates, ntemplates, + sizeof(*templates), virTypedParamsSortTemplate, NULL= ); - for (i =3D 0, j =3D 0; i < nparams && j < nkeys;) { - if (STRNEQ(sorted[i].field, keys[j].field)) { + for (i =3D 0, j =3D 0; i < nparams && j < ntemplates;) { + if (STRNEQ(sorted[i].field, templates[j].name)) { j++; } else { - if (STREQ_NULLABLE(last_name, sorted[i].field) && - !(keys[j].value.i & VIR_TYPED_PARAM_MULTIPLE)) { + unsigned int expected_type =3D templates[j].typeflags & ~VIR_T= YPED_PARAM_MULTIPLE; + bool multiple =3D templates[j].typeflags & VIR_TYPED_PARAM_MUL= TIPLE; + + if (STREQ_NULLABLE(last_name, sorted[i].field) && !multiple) { virReportError(VIR_ERR_INVALID_ARG, _("parameter '%1$s' occurs multiple times"), sorted[i].field); return -1; } - if (virTypedParamValidateType(sorted + i, keys[j].type) < 0) + if (virTypedParamValidateType(sorted + i, expected_type) < 0) return -1; last_name =3D sorted[i].field; @@ -170,7 +150,7 @@ virTypedParamsValidate(virTypedParameterPtr params, int= nparams, ...) } } - if (j =3D=3D nkeys && i !=3D nparams) { + if (j =3D=3D ntemplates && i !=3D nparams) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, _("parameter '%1$s' not supported"), sorted[i].field); @@ -181,6 +161,68 @@ virTypedParamsValidate(virTypedParameterPtr params, in= t nparams, ...) } +/* Validate that PARAMS contains only recognized parameter names with + * correct types, and with no duplicates except for parameters + * specified with VIR_TYPED_PARAM_MULTIPLE flag in type. + * Pass in as many name/type pairs as appropriate, and pass NULL to end + * the list of accepted parameters. Return 0 on success, -1 on failure + * with error message already issued. */ +int +virTypedParamsValidate(virTypedParameterPtr params, + int nparams, + ...) +{ + va_list ap; + const char *name; + g_autofree virTypedParamValidationTemplate *templates =3D NULL; + size_t ntemplates =3D 0; + size_t ntemplatesalloc =3D 0; + + if (nparams =3D=3D 0) + return 0; + + va_start(ap, nparams); + + for (name =3D va_arg(ap, const char *); name; name =3D va_arg(ap, cons= t char *)) { + VIR_RESIZE_N(templates, ntemplatesalloc, ntemplates, 1); + + if (virStrcpy((char *)templates[ntemplates].name, name, VIR_TYPED_= PARAM_FIELD_LENGTH) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Field name '%1$s' too long"), name); + va_end(ap); + return -1; + } + + templates[ntemplates].typeflags =3D va_arg(ap, unsigned int); + ntemplates++; + } + + va_end(ap); + + return virTypedParamsValidateInternal(params, nparams, templates, ntem= plates); +} + + +int +virTypedParamsValidateTemplate(virTypedParameterPtr params, + int nparams, + const virTypedParamValidationTemplate *temp= lates) +{ + size_t ntemplates =3D 0; + g_autofree virTypedParamValidationTemplate *templ_copy =3D NULL; + + /* we need to copy the list of templates because + * 'virTypedParamsValidateInternal' will need to sort it */ + while (*templates[ntemplates++].name =3D=3D '\0') + ; + + templ_copy =3D g_new0(virTypedParamValidationTemplate, ntemplates); + memcpy(templ_copy, templates, sizeof(*templates) * ntemplates); + + return virTypedParamsValidateInternal(params, nparams, templ_copy, nte= mplates); +} + + /* Check if params contains only specified parameter names. Return true if * only specified names are present in params, false if params contains any * unspecified parameter name. */ diff --git a/src/util/virtypedparam.h b/src/util/virtypedparam.h index 819166ff1b..bee3ecc14d 100644 --- a/src/util/virtypedparam.h +++ b/src/util/virtypedparam.h @@ -68,6 +68,17 @@ virTypedParamValidateType(virTypedParameterPtr param, unsigned int expected_type) G_GNUC_WARN_UNUSED_RESULT; +struct _virTypedParamValidationTemplate { + const char name[VIR_TYPED_PARAM_FIELD_LENGTH]; /* parameter name */ + unsigned int typeflags; +}; +typedef struct _virTypedParamValidationTemplate virTypedParamValidationTem= plate; + +int +virTypedParamsValidateTemplate(virTypedParameterPtr params, + int nparams, + const virTypedParamValidationTemplate *temp= lates) + G_GNUC_WARN_UNUSED_RESULT; int virTypedParamsValidate(virTypedParameterPtr params, int nparams, --=20 2.54.0 From nobody Wed Jun 10 17:27:24 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=1777552500; cv=none; d=zohomail.com; s=zohoarc; b=TDGmgjusKmQXAmcUbKZSQojUuqf7g64WUX9PqEDaixfAoSGR7cYgDoi4ev5jDC38s1nYaXD7iWk+GZrAa14+sMlRbaCJvxpNUHk3hn0R7J6II87+j9/Te91uIn2hMG1TIOhtvxnAPeMpSJK8s/1i92cry8ikiQ5+s1S/NKBi0w8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777552500; 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=50pzms/etEOQxYj9/2T4zLsXWFIXFa04iyNkow7gI38=; b=AeKqfoEQO6TkM/h3ws9COEGoar8SSq1ZQnwKavJoChC8Bnd85VuJKBT12ZrPBi4lAqi1hPDcEhhXr2lBt5aMveGxQoT0WNxEQjbAwa37bp38kjC/IaZOnS2mNdWI18X8VMVj5YPaLUcjlHkvEv1pC+YLe2H8sYCSNcuzWXRRcQ4= 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 17775525006448.917229679681327; Thu, 30 Apr 2026 05:35:00 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E62BC41B4A; Thu, 30 Apr 2026 08:34:59 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 46E05440BD; Thu, 30 Apr 2026 07:50:57 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 79C6B44087; Thu, 30 Apr 2026 07:50:47 -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 847EA41AAD for ; Thu, 30 Apr 2026 07:44:29 -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-352-pNsQcdFPOo-aqkLNSA2eRg-1; Thu, 30 Apr 2026 07:44:27 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 F2A9319560B7 for ; Thu, 30 Apr 2026 11:44:26 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4C78A300019F for ; Thu, 30 Apr 2026 11:44:26 +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,UPPERCASE_50_75 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=1777549469; 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=50pzms/etEOQxYj9/2T4zLsXWFIXFa04iyNkow7gI38=; b=B3uLLslSX9sJyaeIJ6cTwQDLBqA9aL4fA7hCJ5s1kMqM5q5Z/P/f4xQFLLQGaPxL82403R sUsNC2iRMPoFiK5WHgsSqIDtcI8cYx2YPJRbl3DBDgR9WjIw30DF8cfV7zGzTo8UkKmm0z 4j3hsYJ7WAgo2IEEYLosg9FcjHv9g84= X-MC-Unique: pNsQcdFPOo-aqkLNSA2eRg-1 X-Mimecast-MFC-AGG-ID: pNsQcdFPOo-aqkLNSA2eRg_1777549467 To: devel@lists.libvirt.org Subject: [PATCH v2 29/35] qemu: migration: Use 'virTypedParamsValidateTemplate' for migration params Date: Thu, 30 Apr 2026 13:43:45 +0200 Message-ID: <8817d88d971d6892cfe429cbe79dc4f0c3c8cfbd.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: OaWJgzQepYwLVKejihCLr20K2SQAV9Nh0WGfkTwwFNk_1777549467 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: YJTSMN5LQVQDVNFGNH2XDLYAYTKOKZOJ X-Message-ID-Hash: YJTSMN5LQVQDVNFGNH2XDLYAYTKOKZOJ 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: 1777552502314154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Refactor the code to use the new helper for validating migration params and making them later available for introspection. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 12 ++++++------ src/qemu/qemu_migration.c | 29 +++++++++++++++++++++++++++++ src/qemu/qemu_migration.h | 32 +------------------------------- 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 38f87a4bff..f01146655e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11143,7 +11143,7 @@ qemuDomainMigrateBegin3Params(virDomainPtr domain, virDomainObj *vm; virCheckFlags(QEMU_MIGRATION_FLAGS, NULL); - if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS)= < 0) + if (virTypedParamsValidateTemplate(params, nparams, qemuMigrationParam= etersValidation) < 0) return NULL; if (virTypedParamsGetString(params, nparams, @@ -11252,7 +11252,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn, const char *nbdURI =3D NULL; virCheckFlags(QEMU_MIGRATION_FLAGS, -1); - if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS)= < 0) + if (virTypedParamsValidateTemplate(params, nparams, qemuMigrationParam= etersValidation) < 0) return -1; if (virTypedParamsGetString(params, nparams, @@ -11390,7 +11390,7 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr= dconn, g_autoptr(qemuMigrationParams) migParams =3D NULL; virCheckFlags(QEMU_MIGRATION_FLAGS, -1); - if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS)= < 0) + if (virTypedParamsValidateTemplate(params, nparams, qemuMigrationParam= etersValidation) < 0) return -1; if (virTypedParamsGetString(params, nparams, @@ -11494,7 +11494,7 @@ qemuDomainMigratePerform3Params(virDomainPtr dom, int ret =3D -1; virCheckFlags(QEMU_MIGRATION_FLAGS, -1); - if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS)= < 0) + if (virTypedParamsValidateTemplate(params, nparams, qemuMigrationParam= etersValidation) < 0) return ret; if (virTypedParamsGetString(params, nparams, @@ -11640,7 +11640,7 @@ qemuDomainMigrateFinish3Params(virConnectPtr dconn, const char *dname =3D NULL; virCheckFlags(QEMU_MIGRATION_FLAGS, NULL); - if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS)= < 0) + if (virTypedParamsValidateTemplate(params, nparams, qemuMigrationParam= etersValidation) < 0) return NULL; if (virTypedParamsGetString(params, nparams, @@ -11709,7 +11709,7 @@ qemuDomainMigrateConfirm3Params(virDomainPtr domain, virCheckFlags(QEMU_MIGRATION_FLAGS, -1); - if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS)= < 0) + if (virTypedParamsValidateTemplate(params, nparams, qemuMigrationParam= etersValidation) < 0) return -1; if (!(vm =3D qemuDomainObjFromDomain(domain))) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index ffffeea75c..bc06a100e4 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -84,6 +84,35 @@ VIR_ENUM_IMPL(qemuMigrationJobPhase, "finish_resume", ); +const virTypedParamValidationTemplate qemuMigrationParametersValidation[] = =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 }, + { VIR_MIGRATE_PARAM_GRAPHICS_URI, VIR_TYPED_PARAM_STRING }, + { VIR_MIGRATE_PARAM_LISTEN_ADDRESS, VIR_TYPED_PARAM_STRING }, + { VIR_MIGRATE_PARAM_MIGRATE_DISKS, VIR_TYPED_PARAM_STRING | VIR_TYPED_= PARAM_MULTIPLE }, + { VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES, VIR_TYPED_PARAM_STRIN= G | VIR_TYPED_PARAM_MULTIPLE }, + { VIR_MIGRATE_PARAM_MIGRATE_DISKS_TARGET_ZERO, VIR_TYPED_PARAM_STRING = | VIR_TYPED_PARAM_MULTIPLE }, + { VIR_MIGRATE_PARAM_DISKS_PORT, VIR_TYPED_PARAM_INT }, + { VIR_MIGRATE_PARAM_COMPRESSION, VIR_TYPED_PARAM_STRING | VIR_TYPED_PA= RAM_MULTIPLE }, + { VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL, VIR_TYPED_PARAM_INT }, + { VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS, VIR_TYPED_PARAM_INT }, + { VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS, VIR_TYPED_PARAM_INT }, + { VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE, VIR_TYPED_PARAM_ULLONG }, + { VIR_MIGRATE_PARAM_PERSIST_XML, VIR_TYPED_PARAM_STRING }, + { VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL, VIR_TYPED_PARAM_INT }, + { VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, VIR_TYPED_PARAM_INT }, + { VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY, VIR_TYPED_PARAM_ULLONG }, + { VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS, VIR_TYPED_PARAM_INT }, + { VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL, VIR_TYPED_PARAM_INT }, + { VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL, VIR_TYPED_PARAM_INT }, + { VIR_MIGRATE_PARAM_TLS_DESTINATION, VIR_TYPED_PARAM_STRING }, + { VIR_MIGRATE_PARAM_DISKS_URI, VIR_TYPED_PARAM_STRING }, + { VIR_MIGRATE_PARAM_BANDWIDTH_AVAIL_SWITCHOVER, VIR_TYPED_PARAM_ULLONG= }, + { "", 0 } +}; + static bool ATTRIBUTE_NONNULL(1) qemuMigrationJobIsAllowed(virDomainObj *vm) diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index 59f32d2ebf..7e9410e1f7 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -65,38 +65,8 @@ 0) /* All supported migration parameters and their types. */ -#define QEMU_MIGRATION_PARAMETERS \ - 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, \ - VIR_MIGRATE_PARAM_GRAPHICS_URI, VIR_TYPED_PARAM_STRING, \ - VIR_MIGRATE_PARAM_LISTEN_ADDRESS, VIR_TYPED_PARAM_STRING, \ - VIR_MIGRATE_PARAM_MIGRATE_DISKS, VIR_TYPED_PARAM_STRING | \ - VIR_TYPED_PARAM_MULTIPLE, \ - VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES, VIR_TYPED_PARAM_STRING = | \ - VIR_TYPED_PARAM_MULTIPL= E, \ - VIR_MIGRATE_PARAM_MIGRATE_DISKS_TARGET_ZERO, VIR_TYPED_PARAM_STRING | \ - VIR_TYPED_PARAM_MULTIPL= E, \ - VIR_MIGRATE_PARAM_DISKS_PORT, VIR_TYPED_PARAM_INT, \ - VIR_MIGRATE_PARAM_COMPRESSION, VIR_TYPED_PARAM_STRING | \ - VIR_TYPED_PARAM_MULTIPLE, \ - VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL, VIR_TYPED_PARAM_INT, \ - VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS, VIR_TYPED_PARAM_INT, \ - VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS, VIR_TYPED_PARAM_INT, \ - VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE, VIR_TYPED_PARAM_ULLONG= , \ - VIR_MIGRATE_PARAM_PERSIST_XML, VIR_TYPED_PARAM_STRING, \ - VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL, VIR_TYPED_PARAM_INT, \ - VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, VIR_TYPED_PARAM_INT, \ - VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY, VIR_TYPED_PARAM_ULLONG, \ - VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS, VIR_TYPED_PARAM_INT, \ - VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL, VIR_TYPED_PARAM_INT, \ - VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL, VIR_TYPED_PARAM_INT, \ - VIR_MIGRATE_PARAM_TLS_DESTINATION, VIR_TYPED_PARAM_STRING, \ - VIR_MIGRATE_PARAM_DISKS_URI, VIR_TYPED_PARAM_STRING, \ - VIR_MIGRATE_PARAM_BANDWIDTH_AVAIL_SWITCHOVER, VIR_TYPED_PARAM_ULLONG, \ - NULL +extern const virTypedParamValidationTemplate qemuMigrationParametersValida= tion[]; typedef enum { QEMU_MIGRATION_PHASE_NONE =3D 0, --=20 2.54.0 From nobody Wed Jun 10 17:27:24 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=1777552591; cv=none; d=zohomail.com; s=zohoarc; b=J6Q/vwWhdDX+9qnZJi/ypOg/3ITfYADCMYTnv82AlKt+tLHGMp3DqZFjIrKjrWu5qQkYyCekWWcZH+BBcnxbogOKFbjX7HC6UpKZ0KSNjzsj4pTzP39WZNd82zeJevj3IpIWR+1J3j602NISjp8uoiV0EHsGDdWP3AbolVtwyf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777552591; 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=nXmsoj7IbyXYGoRK5RiG4SzV0qMq/mrVYyVuz+WhDp8=; b=kkZe+bZt38BRGx9ZrwXasgucNkSkeIefY/s2LQWpoSNITTTz1vutIq3WUWSTBnXWHPBTDxVtvVjLKpWm5lnHsJmawtSxjW5SwnjhSN8PbAsXA3ToHHy1lc5z8uxX7bjJCSID81ydJTjJ4qQr1+Z+9kn3SIW0+fb77Y/u79rRpI8= 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 177755259197445.93999497354491; Thu, 30 Apr 2026 05:36:31 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 15BB141A0C; Thu, 30 Apr 2026 08:36:30 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 8980741ABD; Thu, 30 Apr 2026 07:51:08 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D64B244035; Thu, 30 Apr 2026 07:50:59 -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 A92DF41AB8 for ; Thu, 30 Apr 2026 07:44:30 -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-674-tQNxT1fiMSyESGstACtQJg-1; Thu, 30 Apr 2026 07:44:28 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 19CC619560A1 for ; Thu, 30 Apr 2026 11:44:28 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 66649300019F for ; Thu, 30 Apr 2026 11:44:27 +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,UPPERCASE_50_75 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=1777549470; 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=nXmsoj7IbyXYGoRK5RiG4SzV0qMq/mrVYyVuz+WhDp8=; b=AzwVYJlJCf/sDV4R/HdIoOTgcDMd5f6uOmlyM0Iecj8iqxSq4TNgwVOn97N7mjhRy9q5Lm arAyPrBmAiMteEKMVB1DadQO2h05qgDGpvLdg/v6nojn9p72HVEncFwCUdrfM4penmHf87 GJ34aXBV8BAiaztMjKww8CirNOuRBBI= X-MC-Unique: tQNxT1fiMSyESGstACtQJg-1 X-Mimecast-MFC-AGG-ID: tQNxT1fiMSyESGstACtQJg_1777549468 To: devel@lists.libvirt.org Subject: [PATCH v2 30/35] qemu: Reimplement 'qemuDomainValidateBlockIoTune' using 'virTypedParamsValidateTemplate' Date: Thu, 30 Apr 2026 13:43:46 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: BdQms7PEzkrYFM8B3YOjepZCT0qKWIvlGCm_31XvMvs_1777549468 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4FNA63BGAYZCTM6YCYEXTXIRSOTDPCN7 X-Message-ID-Hash: 4FNA63BGAYZCTM6YCYEXTXIRSOTDPCN7 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: 1777552593753158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Make the block io tuning params introspectable. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 81 +++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 53 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f01146655e..82f5febc6b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15345,57 +15345,29 @@ qemuDomainCheckBlockIoTuneReset(virDomainDiskDef = *disk, } -static int -qemuDomainValidateBlockIoTune(virTypedParameterPtr params, - int nparams) -{ - if (virTypedParamsValidate(params, nparams, - VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME, - VIR_TYPED_PARAM_STRING, - VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX= _LENGTH, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_= LENGTH, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX= _LENGTH, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_= LENGTH, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_L= ENGTH, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_= LENGTH, - VIR_TYPED_PARAM_ULLONG, - NULL) < 0) - return -1; - - return 0; -} - +const virTypedParamValidationTemplate qemuDomainBlockIoTuneParametersValid= ation[] =3D { + { VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX, VIR_TYPED_PARAM_ULLONG = }, + { VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX, VIR_TYPED_PARAM_ULLONG = }, + { VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME, VIR_TYPED_PARAM_STRING }, + { VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH, VIR_TYPED_PARAM_= ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH, VIR_TYPED_PARAM_U= LLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH, VIR_TYPED_PARAM_= ULLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH, VIR_TYPED_PARAM_U= LLONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH, VIR_TYPED_PARAM_UL= LONG }, + { VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH, VIR_TYPED_PARAM_U= LLONG }, + { "", 0 } +}; static int qemuDomainSetBlockIoTuneFields(virDomainBlockIoTuneInfo *info, @@ -15597,7 +15569,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); - if (qemuDomainValidateBlockIoTune(params, nparams) < 0) + + if (virTypedParamsValidateTemplate(params, nparams, + qemuDomainBlockIoTuneParametersVali= dation) < 0) return -1; if (!(vm =3D qemuDomainObjFromDomain(dom))) @@ -20677,7 +20651,8 @@ qemuDomainSetThrottleGroup(virDomainPtr dom, return -1; } - if (qemuDomainValidateBlockIoTune(params, nparams) < 0) + if (virTypedParamsValidateTemplate(params, nparams, + qemuDomainBlockIoTuneParametersVali= dation) < 0) return -1; if (!(vm =3D qemuDomainObjFromDomain(dom))) --=20 2.54.0 From nobody Wed Jun 10 17:27:24 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=1777552675; cv=none; d=zohomail.com; s=zohoarc; b=SZOETajck+iuYzgG+J8DuaxA8IDtlg4Yuo6RDfp3GrjG16gSv32aMDhs0fQlNtxCuH47iQsnUB1KykT45mbxFtM5mRo78bQYqnE0zlryUE9UlKICjyuqS6GYk1MHYUNmlYA23CGWWwq7TuYVHj8rzUi67ESnnAVADeEZmEjESjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777552675; 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=3qWyWEQ3xA5AhPglEpoPXM5u323bEGUQdrboAFD4V9o=; b=d20xktdywQLs1uIz2N5e8WHK5/WIezn2kckM/nGvV3f5H122qG2TT2RrTbEpFcR1X62yoEk+KfnIaB4FcO6CqGu4YjPQWQNtzCCOoc5PprRWWHmzzCBcfYwKL46UyLBUfcnAr8wWZKMJ+uggEPDVaUfqc5y4LG9O6VSZXgwXhUA= 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 1777552675446930.9652396229641; Thu, 30 Apr 2026 05:37:55 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 668E73F34E; Thu, 30 Apr 2026 08:37:54 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id A078344133; Thu, 30 Apr 2026 07:51:15 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 306A141AC7; Thu, 30 Apr 2026 07:51:07 -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 AAA1A41AC7 for ; Thu, 30 Apr 2026 07:44:31 -0400 (EDT) Received: from mx-prod-mc-08.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-414-BTO0EyQ7MOq1uP-aoImNpA-1; Thu, 30 Apr 2026 07:44:30 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3398718002C5 for ; Thu, 30 Apr 2026 11:44:29 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8034A300019F for ; Thu, 30 Apr 2026 11:44:28 +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=1777549471; 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=3qWyWEQ3xA5AhPglEpoPXM5u323bEGUQdrboAFD4V9o=; b=V8VThgs3GW1Z0toeW16qnYvqRnY6GG5OtOzorHKMdIZHfqEogEqTQevR6S0rjFWFRHyA/l sprWTIch9REVpx4LTUaZO2ElFhMF7UttPCPkFz8GEeImqVqPG311+SBPagF7FeN3lP7FYI b1/umFEEpf8T/fp2JA1Dfbw4EVnmAUc= X-MC-Unique: BTO0EyQ7MOq1uP-aoImNpA-1 X-Mimecast-MFC-AGG-ID: BTO0EyQ7MOq1uP-aoImNpA_1777549469 To: devel@lists.libvirt.org Subject: [PATCH v2 31/35] util: hostmem: Make parameters for 'virHostMemSetParameters' introspectable Date: Thu, 30 Apr 2026 13:43:47 +0200 Message-ID: <480592dd70d3d1aecaaaebe06204f81d5c2341cf.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: E_WhjBv2t9K9MEFskS9afal-WArFGtDFTba6enXDSZM_1777549469 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IBMOKNY372UYEIFCZDGNOETMUQ524NWU X-Message-ID-Hash: IBMOKNY372UYEIFCZDGNOETMUQ524NWU 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: 1777552675966158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Refactor the validation using 'virTypedParamsValidateTemplate' and export the template so that 'qemuNodeSetMemoryParameters' can expose them via introspection. In addition since 'virHostMemSetParameters' is conditionally compiled, platforms which don't support it will not expose given params. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 + src/qemu/qemu_driver.c | 4 ++++ src/util/virhostmem.c | 24 ++++++++++++++++-------- src/util/virhostmem.h | 2 ++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 20507af7f7..94351fe153 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2605,6 +2605,7 @@ virHostMemGetParameters; virHostMemGetStats; virHostMemGetTHPSize; virHostMemSetParameters; +virHostMemSetParametersValidation; # util/virhostuptime.h diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 82f5febc6b..d64366924c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16502,6 +16502,10 @@ qemuNodeSetMemoryParameters(virConnectPtr conn, { virCheckFlags(0, -1); + if (virTypedParamsValidateTemplate(params, nparams, + virHostMemSetParametersValidation) = < 0) + return -1; + if (virNodeSetMemoryParametersEnsureACL(conn) < 0) return -1; diff --git a/src/util/virhostmem.c b/src/util/virhostmem.c index 7d7deac34b..beff114362 100644 --- a/src/util/virhostmem.c +++ b/src/util/virhostmem.c @@ -351,21 +351,24 @@ virHostMemParametersAreAllSupported(virTypedParameter= Ptr params, } #endif + #ifdef __linux__ +const virTypedParamValidationTemplate virHostMemSetParametersValidation[] = =3D +{ + { VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN, VIR_TYPED_PARAM_UINT }, + { VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS, VIR_TYPED_PARAM_UINT }, + { VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES, VIR_TYPED_PARAM_UINT }, + { "", 0 } +}; + int virHostMemSetParameters(virTypedParameterPtr params, int nparams) { size_t i; - if (virTypedParamsValidate(params, nparams, - VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN, - VIR_TYPED_PARAM_UINT, - VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS, - VIR_TYPED_PARAM_UINT, - VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES, - VIR_TYPED_PARAM_UINT, - NULL) < 0) + if (virTypedParamsValidateTemplate(params, nparams, + virHostMemSetParametersValidation) = < 0) return -1; if (!virHostMemParametersAreAllSupported(params, nparams)) @@ -379,6 +382,11 @@ virHostMemSetParameters(virTypedParameterPtr params, return 0; } #else +const virTypedParamValidationTemplate virHostMemSetParametersValidation[] = =3D +{ + { "", 0 } +}; + int virHostMemSetParameters(virTypedParameterPtr params G_GNUC_UNUSED, int nparams G_GNUC_UNUSED) diff --git a/src/util/virhostmem.h b/src/util/virhostmem.h index 4a0d692402..ebe7d26f21 100644 --- a/src/util/virhostmem.h +++ b/src/util/virhostmem.h @@ -22,6 +22,7 @@ #pragma once #include "internal.h" +#include "virtypedparam.h" int virHostMemGetStats(int cellNum, virNodeMemoryStatsPtr params, @@ -35,6 +36,7 @@ int virHostMemGetInfo(unsigned long long *mem, int virHostMemGetParameters(virTypedParameterPtr params, int *nparams); +extern const virTypedParamValidationTemplate virHostMemSetParametersValida= tion[]; int virHostMemSetParameters(virTypedParameterPtr params, int nparams); --=20 2.54.0 From nobody Wed Jun 10 17:27:24 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=1777552752; cv=none; d=zohomail.com; s=zohoarc; b=DDwdvIyRjauwpAwZdbUPd4VAf8mKNF7vIDZoxKeLi9CExpa6XmUMfVBWV+TGSqszuxJg7DtN+a0ZfE3SixOl+Wd7+KyON0t8GyHnC2S+nv85faqL1SpuF3ptNwDtEH2mVTua6yWKB+tPh0UaJ8mYP+Qwbg6SYKFcfkWw3/T8Dxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777552752; 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=KmSEI1ZR9e3HolJWF0dPOC37t8dPu3qbk3kjKaP1jkw=; b=lUBBagrGm55xTA9zA6fd1duCpAKeK+DNip89frPX+smoquphHsvvvF88OcqZml/7zDk5/xctB18BVtbZaeGT4xLTVVEWCQdINOD+/nOFd0dUQDWx6EDSJA86OdbPy/nYKum/nwxPfgWqHKt590tPYKb449gmYI/kQULIZDAS3zw= 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 17775527529241013.7818990362907; Thu, 30 Apr 2026 05:39:12 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E3C30419E5; Thu, 30 Apr 2026 08:39:11 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 5ED0A44154; Thu, 30 Apr 2026 07:51:29 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id C180B44077; Thu, 30 Apr 2026 07:51:19 -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 0FCB641809 for ; Thu, 30 Apr 2026 07:44:33 -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-661-Ip-SezKxO6K8IWRun3h1-A-1; Thu, 30 Apr 2026 07:44:31 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 4984819560BB for ; Thu, 30 Apr 2026 11:44:30 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 98F16300019F for ; Thu, 30 Apr 2026 11:44:29 +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_H4, 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=1777549472; 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=KmSEI1ZR9e3HolJWF0dPOC37t8dPu3qbk3kjKaP1jkw=; b=J63G+JV3X7QvTYPC/T+ms5HyQ7/xtchvf1mQTqyJAIE4np/dXrJWRunUYNwCEBiquXG0MD YbfiNEoXSh8KRswIWEA9bvkiVFbAe+vJy6z0B56gcm7qxBfpT7J69Yh2zq9i2kQsj0zOEk jcPhWl6jrqj/sZ/HOm5xZpdAvY0DBI0= X-MC-Unique: Ip-SezKxO6K8IWRun3h1-A-1 X-Mimecast-MFC-AGG-ID: Ip-SezKxO6K8IWRun3h1-A_1777549470 To: devel@lists.libvirt.org Subject: [PATCH v2 32/35] qemuDomainSetSchedulerParameters: Make typed parameters introspectable Date: Thu, 30 Apr 2026 13:43:48 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: W_rplHatNNT4NZXPu3npB7bBUpyu0U5YAIp5oayJm9I_1777549470 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: M25BKISLGYNEID5NBR7QPTOJOF7QOOWJ X-Message-ID-Hash: M25BKISLGYNEID5NBR7QPTOJOF7QOOWJ 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: 1777552754342158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa For making introspection possible both qemuDomainSetSchedulerParameters and qemuDomainSetSchedulerParametersFlags need to have the check present. Refactor the flag validation to make it present in both APIs. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d64366924c..f0ef6796d3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8991,6 +8991,20 @@ qemuSetIOThreadsBWLive(virDomainObj *vm, virCgroup *= cgroup, goto endjob; \ } + +const virTypedParamValidationTemplate qemuDomainSetSchedulerParametersVali= dation[] =3D { + { VIR_DOMAIN_SCHEDULER_CPU_SHARES, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_SCHEDULER_VCPU_PERIOD, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_SCHEDULER_VCPU_QUOTA, VIR_TYPED_PARAM_LLONG }, + { VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA, VIR_TYPED_PARAM_LLONG }, + { VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA, VIR_TYPED_PARAM_LLONG }, + { VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD, VIR_TYPED_PARAM_ULLONG }, + { VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA, VIR_TYPED_PARAM_LLONG }, + { "", 0 } +}; + static int qemuDomainSetSchedulerParametersFlags(virDomainPtr dom, virTypedParameterPtr params, @@ -9016,26 +9030,9 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr d= om, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); - if (virTypedParamsValidate(params, nparams, - VIR_DOMAIN_SCHEDULER_CPU_SHARES, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_SCHEDULER_VCPU_PERIOD, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_SCHEDULER_VCPU_QUOTA, - VIR_TYPED_PARAM_LLONG, - VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA, - VIR_TYPED_PARAM_LLONG, - VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA, - VIR_TYPED_PARAM_LLONG, - VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA, - VIR_TYPED_PARAM_LLONG, - NULL) < 0) + + if (virTypedParamsValidateTemplate(params, nparams, + qemuDomainSetSchedulerParametersVal= idation) < 0) return -1; if (!(vm =3D qemuDomainObjFromDomain(dom))) @@ -9297,6 +9294,10 @@ qemuDomainSetSchedulerParameters(virDomainPtr dom, virTypedParameterPtr params, int nparams) { + if (virTypedParamsValidateTemplate(params, nparams, + qemuDomainSetSchedulerParametersVal= idation) < 0) + return -1; + return qemuDomainSetSchedulerParametersFlags(dom, params, nparams, --=20 2.54.0 From nobody Wed Jun 10 17:27:24 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=1777552818; cv=none; d=zohomail.com; s=zohoarc; b=aGjpFOhJMsVHB21Xk8mnzh5X87SA0GiZKI5Abeb6HYNl7KA7H7KQX+p+EV5uluMJtdV15w2Otomw9NpBI2f8NmIZZ8+4QqkrzO/FTguX7kmGWLOLoGJINxdYVhoaMeEMkCwKCyT6ZllnfyJXJqMin6ENTAKhixA9Q5zXzTYSl88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777552818; 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=9zKw6C64vDIL5BXqao3j/Bjyuak8YUBJlmbcX1y+6x0=; b=PakxRUMcko0FQ9srEcgUiqFSCKtbztA7JzCMbOmbDkM1QqsceA9gjFK2LHscp6IAHuc9D8l+aq8ZLfKbODfFXTEGawnnWfoRlw8NiFXqDgesA4Jt5qcMdl+E5JkdKIISkDgl7GHiH0Jk6MeT5W8ZYiUTyjM7l3Jhb6cYgiwm3Do= 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 1777552818942851.7651279170474; Thu, 30 Apr 2026 05:40:18 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E827F3F34D; Thu, 30 Apr 2026 08:40:17 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 295ED441B4; Thu, 30 Apr 2026 07:51:33 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id CF0E041DEA; Thu, 30 Apr 2026 07:51:22 -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 CB80E41915 for ; Thu, 30 Apr 2026 07:44:33 -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-659-xRo78PAyNyK9KZoB6cd9dA-1; Thu, 30 Apr 2026 07:44:32 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 6AF0A1956080 for ; Thu, 30 Apr 2026 11:44:31 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B332730001BB for ; Thu, 30 Apr 2026 11:44:30 +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_H4, 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=1777549473; 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=9zKw6C64vDIL5BXqao3j/Bjyuak8YUBJlmbcX1y+6x0=; b=RwMN+Ye4XuYhzibFKGr4V7R9IA8AkgmwAlqOUiLYY8DV0/SLXWLR3Aya7tHXz+kl9pW/tW 53yC1Zz9/tCBeBkEqGQvCp1wYyRSQ5qrVRkNEjB3GGzlneHiDc23QyqgDttz14HQt4qgH9 rtFnMem5yW1Mnd4jwNSoqk7woIJj+nc= X-MC-Unique: xRo78PAyNyK9KZoB6cd9dA-1 X-Mimecast-MFC-AGG-ID: xRo78PAyNyK9KZoB6cd9dA_1777549471 To: devel@lists.libvirt.org Subject: [PATCH v2 33/35] qemuDomainSetIOThreadParams: Move typed parameter validation to top level Date: Thu, 30 Apr 2026 13:43:49 +0200 Message-ID: <5518e705f1cfcaf6c8fc4f0f2a33b70f90671a5e.1777548628.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: TDIXhCto9ygvQNTwlcNa-iWw1i0YCosqk9xZoNcG7fY_1777549471 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: YBIKPTIOXXHB7KU4LG2UTAJPGR6ZI5YP X-Message-ID-Hash: YBIKPTIOXXHB7KU4LG2UTAJPGR6ZI5YP 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: 1777552820614158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa This will allow introspecting them. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f0ef6796d3..718994f5b5 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5318,20 +5318,6 @@ qemuDomainIOThreadParseParams(virTypedParameterPtr p= arams, { int rc; - if (virTypedParamsValidate(params, nparams, - VIR_DOMAIN_IOTHREAD_POLL_MAX_NS, - VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_IOTHREAD_POLL_GROW, - VIR_TYPED_PARAM_UNSIGNED, - VIR_DOMAIN_IOTHREAD_POLL_SHRINK, - VIR_TYPED_PARAM_UNSIGNED, - VIR_DOMAIN_IOTHREAD_THREAD_POOL_MIN, - VIR_TYPED_PARAM_INT, - VIR_DOMAIN_IOTHREAD_THREAD_POOL_MAX, - VIR_TYPED_PARAM_INT, - NULL) < 0) - return -1; - if ((rc =3D virTypedParamsGetULLong(params, nparams, VIR_DOMAIN_IOTHREAD_POLL_MAX_NS, &iothread->poll_max_ns)) < 0) @@ -5674,6 +5660,20 @@ qemuDomainSetIOThreadParams(virDomainPtr dom, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); + if (virTypedParamsValidate(params, nparams, + VIR_DOMAIN_IOTHREAD_POLL_MAX_NS, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_IOTHREAD_POLL_GROW, + VIR_TYPED_PARAM_UNSIGNED, + VIR_DOMAIN_IOTHREAD_POLL_SHRINK, + VIR_TYPED_PARAM_UNSIGNED, + VIR_DOMAIN_IOTHREAD_THREAD_POOL_MIN, + VIR_TYPED_PARAM_INT, + VIR_DOMAIN_IOTHREAD_THREAD_POOL_MAX, + VIR_TYPED_PARAM_INT, + NULL) < 0) + return -1; + if (iothread_id =3D=3D 0) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("invalid value of 0 for iothread_id")); --=20 2.54.0 From nobody Wed Jun 10 17:27:24 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=1777552980; cv=none; d=zohomail.com; s=zohoarc; b=TabuwYMo0DZBeDNASSN4e7FS1uxbPP7AxdWBjfMi/ii9uES6hoQ/CQnfcHOMGxbgsf3plrzICyBVZMdszl7OY0y0o8lfISg0B2Xv94nM8GQJIgzTBlgFFPv6k2RPgaPrP/G/IZsCT/3cvl5BOIzHqoXl5XA1oykXx/6FNBpJwNk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777552980; 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=QhJo6AU599uSZnyl80fAWPLKMG7KfaGAqsXX2+nRVnY=; b=TyrswXOlCu0YNBRegwchisc2MgDkH7Gkji3lu3Eo4dRBv+aGgI9+98DUGnMJL3fG9rpYbeFNL4WHwxreDRoTQV7ExPxJKfWPZLHV+DOvaaKq8xjStCRXv3AccH9HAeoXh5JIiMOej4BXzxEP+YZGVUSnqU8I9DfOfatxTwZ7T64= 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 1777552980446262.71705482729556; Thu, 30 Apr 2026 05:43:00 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id C010241AD9; Thu, 30 Apr 2026 08:42:59 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 6A1F544136; Thu, 30 Apr 2026 07:51:47 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id AE67641AD5; Thu, 30 Apr 2026 07:51:37 -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 57ECB4185C for ; Thu, 30 Apr 2026 07:44:35 -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-647-soYOmRLnMwSbtCWLj8NXSg-1; Thu, 30 Apr 2026 07:44:33 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 80828180036E for ; Thu, 30 Apr 2026 11:44:32 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.17]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CECC3300019F for ; Thu, 30 Apr 2026 11:44:31 +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_H4, 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=1777549474; 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=QhJo6AU599uSZnyl80fAWPLKMG7KfaGAqsXX2+nRVnY=; b=A5895I61LQJiqs4061i0b689nOCvtyUDre91uhhxlryzfXKNFK6PDChZFGAdNOO+H/jYqN kEJ7gFeic3L/ZrMMV+oUNSZ34AfeDzh7aBo/QOJz0HvAmuLh215EGCz06tsl1P/ocfd3HD ZkO6KgNztAK7bgKWr/4+PR4eYTzHqXo= X-MC-Unique: soYOmRLnMwSbtCWLj8NXSg-1 X-Mimecast-MFC-AGG-ID: soYOmRLnMwSbtCWLj8NXSg_1777549472 To: devel@lists.libvirt.org Subject: [PATCH v2 34/35] introspection: Add introspection of input typed parameters Date: Thu, 30 Apr 2026 13:43:50 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: I66gcM8mLSz9OTuoCNoKUISSWtb023m65JZ0inGtk6k_1777549472 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: MNLUDFRIHI6SJ4X6MBX75ATRXP4MT5KO X-Message-ID-Hash: MNLUDFRIHI6SJ4X6MBX75ATRXP4MT5KO 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: 1777552981934154100 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=C3=A1n Tomko --- scripts/genintrospection.py | 127 ++++++++++++++++++++++++++++++++++++ src/util/virintrospection.c | 45 +++++++++++++ src/util/virintrospection.h | 3 + 3 files changed, 175 insertions(+) diff --git a/scripts/genintrospection.py b/scripts/genintrospection.py index 25a17e2b0c..ac51634d10 100644 --- 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