From nobody Sat May 30 15:28:31 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=1780066183; cv=none; d=zohomail.com; s=zohoarc; b=AnBGv5pmofUXJ9oodEllX1KKjkbHwz+v14TeKbjAA5D696NqLgfs+bCArYlCt8AP11cAvXwNFkNYjNMo5ePi/g1JzigntydCOAxZRobmibwzAGgTA5ja6TKKJrm5xJ6H+X50Mi/uhI9ycUUPVFWmV8Dv4XScP6I/X7xQ1X9zJiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066183; 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=JeXEHNpiIfA0jsthEnnSBcOt75vq4k9NpZKXQfwRPyI=; b=hDEd7wE16I9UhV6HYT91/hda7Ww1tAe7um0ePVNCTW4DcUUTU0TrQg1DL91yIzNUMxF+1o24iIxHHByRfURwQgeHKJYIJYwYVZG7+Kt7HDGJPR6DpJYL2WJT9R3KV4Idzg7QO+BSir8wVj6FZWOB2/e/JgKMf/tYoV8ZHCG8ecg= 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 1780066183036301.33861334862877; Fri, 29 May 2026 07:49:43 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 9311341DE9; Fri, 29 May 2026 10:49:41 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id F3EB141B5B; Fri, 29 May 2026 10:47:16 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 4EE4C3FCE2; Fri, 29 May 2026 10:47: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 63C3F417CA for ; Fri, 29 May 2026 10:47:02 -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-279-Qxk_k4pPN1Wt6Xe5LIXu8w-1; Fri, 29 May 2026 10:46:59 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 63C9819560BB for ; Fri, 29 May 2026 14:46:58 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 944351955F22 for ; Fri, 29 May 2026 14:46: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=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780066022; 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=JeXEHNpiIfA0jsthEnnSBcOt75vq4k9NpZKXQfwRPyI=; b=YrJ49b2UIlqzL5jEHxPBqpWL1r7UrAOy/sKMIAV8Cjd/ms0jJqTF3wwY7PKAZ8PtUUWtqz IpEtysuZFi+IgnyVoc8dlfL4+L48p42RQuj40Ju1VNqH7veDhX9kGQuYs92m887DsM4Wlo 7HnEVMEaCqdRx1sS3uBXz2GnpRSFL8k= X-MC-Unique: Qxk_k4pPN1Wt6Xe5LIXu8w-1 X-Mimecast-MFC-AGG-ID: Qxk_k4pPN1Wt6Xe5LIXu8w_1780066018 To: devel@lists.libvirt.org Subject: [RFC patch 01/17] storage_source: Don't modify @src in 'virStorageSourceUpdatePhysicalSize' Date: Fri, 29 May 2026 16:46:38 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: jESyZ6QzuTIOW6Q6DnRydylFIckfFkFgVXILK8bAVrI_1780066018 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: OJHW7EQLI2ESX5YPW3BE37QSMCCU2KCY X-Message-ID-Hash: OJHW7EQLI2ESX5YPW3BE37QSMCCU2KCY 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: 1780066184865158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Upcoming code will want to modify the call semantics of the function to unlock the domain object around it thus we ought to not modify @src directly. Rename the function to 'virStorageSourceGetSize' and return the detected size via argument instead of directly modifying it. Signed-off-by: Peter Krempa --- src/libvirt_private.syms | 2 +- src/qemu/qemu_domain.c | 2 +- src/storage_file/storage_source.c | 22 +++++++++++++++------- src/storage_file/storage_source.h | 8 +++++--- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 2391f01bc7..a7ce33b428 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1927,6 +1927,7 @@ virStorageSourceGetMetadata; virStorageSourceGetMetadataFromBuf; virStorageSourceGetMetadataFromFD; virStorageSourceGetRelativeBackingPath; +virStorageSourceGetSize; virStorageSourceInit; virStorageSourceInitAs; virStorageSourceNewFromBacking; @@ -1942,7 +1943,6 @@ virStorageSourceSupportsSecurityDriver; virStorageSourceUnlink; virStorageSourceUpdateBackingSizes; virStorageSourceUpdateCapacity; -virStorageSourceUpdatePhysicalSize; # util/viracpi.c diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 84c8645259..ef79fc72aa 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11651,7 +11651,7 @@ qemuDomainStorageUpdatePhysical(virQEMUDriverConfig= *cfg, return -1; } - ret =3D virStorageSourceUpdatePhysicalSize(src, fd, &sb); + ret =3D virStorageSourceGetSize(src, fd, &sb, &src->physical); qemuDomainStorageCloseStat(src, &fd); diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_s= ource.c index e886433bb4..cc2d3a3198 100644 --- a/src/storage_file/storage_source.c +++ b/src/storage_file/storage_source.c @@ -585,39 +585,47 @@ virStorageSourceNewFromDataFile(virStorageSource *par= ent) /** + * virStorageSourceGetPhysicalSize: * @src: disk source definition structure * @fd: file descriptor * @sb: stat buffer + * @physical: filled with the physical size of @src * - * Updates src->physical depending on the actual type of storage being use= d. + * Fetches size information about @src depending on the actual type of sto= rage + * being used. * To be called for domain storage source reporting as the volume code does * not set/use the 'type' field for the voldef->source.target * * Returns 0 on success, -1 on error. No libvirt errors are reported. */ int -virStorageSourceUpdatePhysicalSize(virStorageSource *src, - int fd, - struct stat const *sb) +virStorageSourceGetSize(virStorageSource *src, + int fd, + struct stat const *sb, + unsigned long long *physical) { off_t end; virStorageType actual_type =3D virStorageSourceGetActualType(src); + unsigned long long dummy; + + if (!physical) + physical =3D &dummy; switch (actual_type) { case VIR_STORAGE_TYPE_FILE: case VIR_STORAGE_TYPE_NETWORK: - src->physical =3D sb->st_size; + *physical =3D sb->st_size; break; case VIR_STORAGE_TYPE_BLOCK: if ((end =3D lseek(fd, 0, SEEK_END)) =3D=3D (off_t) -1) return -1; - src->physical =3D end; + *physical =3D end; break; case VIR_STORAGE_TYPE_DIR: - src->physical =3D 0; + *physical =3D 0; break; /* We shouldn't get VOLUME, but the switch requires all cases */ diff --git a/src/storage_file/storage_source.h b/src/storage_file/storage_s= ource.h index 63fefb6919..fd58509eb3 100644 --- a/src/storage_file/storage_source.h +++ b/src/storage_file/storage_source.h @@ -54,9 +54,11 @@ virStorageSourceChainLookupBySource(virStorageSource *ch= ain, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int -virStorageSourceUpdatePhysicalSize(virStorageSource *src, - int fd, - struct stat const *sb); +virStorageSourceGetSize(virStorageSource *src, + int fd, + struct stat const *sb, + unsigned long long *physical) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3); int virStorageSourceUpdateBackingSizes(virStorageSource *src, --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780066326; cv=none; d=zohomail.com; s=zohoarc; b=Wkmp9q/JBauaeNuR3rlUNFVPFr3PcASuLobR6tFEmZdqHUTjBt4pohRxhUp+7621mWi7TxFuZZ1H9zLRESSUT2rZSgpJDoQEOO273ayotFS4UBOBcOdRrprbWmM4kuADiwSLw6UZDfeZB0s/sMOYGRGaDC/AiKiHCobeYJIblqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066326; 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=mu6SvBRZQhHBqhO9nAfD3fM7pMBI3s+5ozg44TDcBRk=; b=PSeIxTa0+TTT2Io41u37Nat6oPS6tJ/pqMytLuYLdjYj7sAvU5K8cjDgO+cvSaiRuU8SWzN9FSpY7ldauIDBElySGXRyhYG+NXSkTMseqtH2j3RMKgBUWm4aRkgTdtTWiiblf9fwTz+unADWiJy9wT72dNQpIGR9gyOTBnpjYRw= 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 1780066326951810.6268575303654; Fri, 29 May 2026 07:52:06 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E04C741B26; Fri, 29 May 2026 10:52:01 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 579C541D3D; Fri, 29 May 2026 10:47:26 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 0C09B417CA; Fri, 29 May 2026 10:47:05 -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 DFF6541841 for ; Fri, 29 May 2026 10:47:03 -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-624-UBpNd60sPF-G8IgS4yz95A-1; Fri, 29 May 2026 10:47:01 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 7EF471800619 for ; Fri, 29 May 2026 14:46:59 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CB04D1955F22 for ; Fri, 29 May 2026 14:46:58 +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=1780066023; 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=mu6SvBRZQhHBqhO9nAfD3fM7pMBI3s+5ozg44TDcBRk=; b=Ms5njZNhrrTi10Wwzjd5Hw2vl0NVvSo8l270ZsRgd4oZy7Y5Mubz7Vx6O+1mA943dSwFwd AmD+lnE/hI9UU50O0svJkRXAYntk1J4W3S8SbHBzxw7fuG7sO0QfX4EnK58CilajhziYtZ yma5jHhczvl464D833/tcayTf8hXiU4= X-MC-Unique: UBpNd60sPF-G8IgS4yz95A-1 X-Mimecast-MFC-AGG-ID: UBpNd60sPF-G8IgS4yz95A_1780066019 To: devel@lists.libvirt.org Subject: [RFC patch 02/17] virStorageSourceGetSize: Return also 'allocation' value if needed Date: Fri, 29 May 2026 16:46:39 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 2yRcG4P8_anI6wt9fl1PUPjVtPwzJbM1XMV_tGyoIRg_1780066019 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: X5DARWYNLM5N5SIEL7RJDVHARZBYCB6I X-Message-ID-Hash: X5DARWYNLM5N5SIEL7RJDVHARZBYCB6I 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: 1780066328769154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Lift the calculation from 'virStorageSourceUpdateBackingSizes'. This will be used to have a single place for these values for use in VM drivers where 'type' does reflect reality. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 2 +- src/storage_file/storage_source.c | 13 +++++++++++++ src/storage_file/storage_source.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ef79fc72aa..e7afeb3fa0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11651,7 +11651,7 @@ qemuDomainStorageUpdatePhysical(virQEMUDriverConfig= *cfg, return -1; } - ret =3D virStorageSourceGetSize(src, fd, &sb, &src->physical); + ret =3D virStorageSourceGetSize(src, fd, &sb, NULL, &src->physical); qemuDomainStorageCloseStat(src, &fd); diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_s= ource.c index cc2d3a3198..fb4fc48947 100644 --- a/src/storage_file/storage_source.c +++ b/src/storage_file/storage_source.c @@ -589,6 +589,7 @@ virStorageSourceNewFromDataFile(virStorageSource *paren= t) * @src: disk source definition structure * @fd: file descriptor * @sb: stat buffer + * @allocation: current actual disk usage * @physical: filled with the physical size of @src * * Fetches size information about @src depending on the actual type of sto= rage @@ -602,6 +603,7 @@ int virStorageSourceGetSize(virStorageSource *src, int fd, struct stat const *sb, + unsigned long long *allocation, unsigned long long *physical) { off_t end; @@ -611,9 +613,18 @@ virStorageSourceGetSize(virStorageSource *src, if (!physical) physical =3D &dummy; + if (!allocation) + allocation =3D &dummy; + switch (actual_type) { case VIR_STORAGE_TYPE_FILE: case VIR_STORAGE_TYPE_NETWORK: +#ifndef WIN32 + *allocation =3D (unsigned long long) sb->st_blocks * (unsigned lon= g long) DEV_BSIZE; +#else + *allocation =3D sb->st_size; +#endif + *physical =3D sb->st_size; break; @@ -621,10 +632,12 @@ virStorageSourceGetSize(virStorageSource *src, if ((end =3D lseek(fd, 0, SEEK_END)) =3D=3D (off_t) -1) return -1; + *allocation =3D end; *physical =3D end; break; case VIR_STORAGE_TYPE_DIR: + *allocation =3D 0; *physical =3D 0; break; diff --git a/src/storage_file/storage_source.h b/src/storage_file/storage_s= ource.h index fd58509eb3..774dcbffee 100644 --- a/src/storage_file/storage_source.h +++ b/src/storage_file/storage_source.h @@ -57,6 +57,7 @@ int virStorageSourceGetSize(virStorageSource *src, int fd, struct stat const *sb, + unsigned long long *allocation, unsigned long long *physical) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3); --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780066251; cv=none; d=zohomail.com; s=zohoarc; b=OGIzd8rs79viWdGX99E1RriS2/B6TW/Dcf5qai3v8edKO5+CGY/UU1lVZhCQBeBo6xZBWcxarXRE7j/8ZrxbkEQbmEZ7Swosw4iU1dHELV8lAL2K7ggbuja0Y3LYYgkiJ2vBU82fJ5bp6SdQ1kpr1YuY2eA5sVcCOn+/XsSpJuk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066251; 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=Xb4WXreknclt6JwOnRq5S3IPC1phgdBdQ8oYagDbBDc=; b=SuGpF8jx1erxSX0XgQ0rq7Z+rHOCBHOGzDJkZ2BjHqlxB1gjJ7NrHGCeO42tTMjCRH9gZYXiW8N3Dg6FffkY+S5GSHruDHlyoRwRvGgxGQOkVA4W+iPlmbvrr6sNzuMs9NUnGnZ4jlA51vtEshowMsJT9VSr0FbWCwQTvtHsQtM= 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 1780066251594151.1878622034086; Fri, 29 May 2026 07:50:51 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 0C1C741B5C; Fri, 29 May 2026 10:50:50 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 4CA4C419F4; Fri, 29 May 2026 10:47:22 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 7CABF417E7; Fri, 29 May 2026 10:47:04 -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 A1B2F3FCE2 for ; Fri, 29 May 2026 10:47:03 -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-626-jrj8d45DNMOLhlLeSjonCA-1; Fri, 29 May 2026 10:47:01 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 C6DC018005BE for ; Fri, 29 May 2026 14:47:00 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F28561955F22 for ; Fri, 29 May 2026 14:46: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_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=1780066023; 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=Xb4WXreknclt6JwOnRq5S3IPC1phgdBdQ8oYagDbBDc=; b=R3T0dVa6SrEacIFXSXKhVAEqRr6Jwl+/Rfd9/tx46be3cEDkeq40zBw7v4T2foZQg2HcXD 7PlPkXdFPO0aCBaVISAgQqrCEZLWKn+OOvbuC4xexiwYNbTo/NMWC+GoXmt8xY9PqRFEcH lYZ7U/68+elMQBbKJHMuKPWBzujyzbQ= X-MC-Unique: jrj8d45DNMOLhlLeSjonCA-1 X-Mimecast-MFC-AGG-ID: jrj8d45DNMOLhlLeSjonCA_1780066020 To: devel@lists.libvirt.org Subject: [RFC patch 03/17] virStorageFileProbeFormatFromBuf: Allow NULL 'path' argument Date: Fri, 29 May 2026 16:46:40 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: anwnnYaeGUJ-pyrbxP6I4kMA54QabUFytF3ldV4gDs8_1780066020 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 2IPBULSVHEJQIRBW4KTLR5TGRJWEOAFN X-Message-ID-Hash: 2IPBULSVHEJQIRBW4KTLR5TGRJWEOAFN 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: 1780066253433154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The 'path' argument is used only for VIR_DEBUG/VIR_WARN message. Document the function and allow passing NULL path, in which case the VIR_WARN is skipped. This will be used to allow simpler calling of metadata probing in VM stats code which will not even probe format as VM XMLs now require that format is populated. Signed-off-by: Peter Krempa --- src/storage_file/storage_file_probe.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/stora= ge_file_probe.c index a1f4c25b3d..ff6512db77 100644 --- a/src/storage_file/storage_file_probe.c +++ b/src/storage_file/storage_file_probe.c @@ -854,6 +854,14 @@ virStorageFileMatchesVersion(int versionOffset, } +/** + * virStorageFileProbeFormatFromBuf: + * @path: path of image (used only for logs; may be NULL) + * @buf: buffer to probe format from + * @buflen: length of @buf + * + * Probes the format of the image header passed via @buf. + */ static int virStorageFileProbeFormatFromBuf(const char *path, char *buf, @@ -862,7 +870,7 @@ virStorageFileProbeFormatFromBuf(const char *path, int format =3D VIR_STORAGE_FILE_RAW; size_t i; int possibleFormat =3D VIR_STORAGE_FILE_RAW; - VIR_DEBUG("path=3D%s, buf=3D%p, buflen=3D%zu", path, buf, buflen); + VIR_DEBUG("path=3D%s, buf=3D%p, buflen=3D%zu", NULLSTR(path), buf, buf= len); /* First check file magic */ for (i =3D 0; i < VIR_STORAGE_FILE_LAST; i++) { @@ -882,7 +890,7 @@ virStorageFileProbeFormatFromBuf(const char *path, } } - if (possibleFormat !=3D VIR_STORAGE_FILE_RAW) + if (path && possibleFormat !=3D VIR_STORAGE_FILE_RAW) VIR_WARN("File %s matches %s magic, but version is wrong. Please r= eport new version to devel@lists.libvirt.org", path, virStorageFileFormatTypeToString(possibleFormat)); --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780066474; cv=none; d=zohomail.com; s=zohoarc; b=e77B16SH54tC8uD9ItSu8d4ZZsVeVFq68oQ51C7UQcGX6UU4pZ6Zl8wVUqpQzftJAbYVv67+KKaiQgBG21w6K+QXOMEpIBHdtcE03+3oihVR8VbjEA7hFYxaF8cWtwTfSHws/l1OfSPmPC1pqzLqvU1cXQ/xd9SVsdhW40sSGZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066474; 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=lkuLE2Gu2etkpzrUts4pttalaExkuXtirdmx3/QbZMw=; b=KJED8BkPXvtVbEY7ZQmHLw3oLpxk7TWyFURUpY2C12OMZjOjJTV6tZ+19pcMmtH4cDGNomFnNQ6F7JP/dhg2BE1KKhYHwcbXpm3fryrQde1ApdLTwUZIkd5fvUjZtR6LcNjuDZa8ixMQcMtJrpBPEG0eqLSFCNgUJkmLagrJ9jc= 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 1780066474676459.94178011224983; Fri, 29 May 2026 07:54:34 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 6899741BA0; Fri, 29 May 2026 10:54:33 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 4F7BD41DDE; Fri, 29 May 2026 10:47:36 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 802FB41952; Fri, 29 May 2026 10:47:07 -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 8529A41844 for ; Fri, 29 May 2026 10:47:06 -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-443-eqe_yhAAP82iM1clVZeVqg-1; Fri, 29 May 2026 10:47:02 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 E78E819560B5 for ; Fri, 29 May 2026 14:47:01 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3A8EC1955F22 for ; Fri, 29 May 2026 14:47: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=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780066026; 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=lkuLE2Gu2etkpzrUts4pttalaExkuXtirdmx3/QbZMw=; b=dWDWR1emJEHiIO6G46xp/gsUZxlV173VTxh6cE2iqp+M7Tl1LRUb5f587GDniooXQTDRWt 9xxjj/K+CapbnGykhg6N/nEwdl6K6HYZ9oJ/GRp/VbWbeAS4UESEgZ8+7Hjt2kZUFgnAOS 2IDL0PaYPBu9njf/QhnN9oVvtH/TRvo= X-MC-Unique: eqe_yhAAP82iM1clVZeVqg-1 X-Mimecast-MFC-AGG-ID: eqe_yhAAP82iM1clVZeVqg_1780066022 To: devel@lists.libvirt.org Subject: [RFC patch 04/17] virStorageFileProbeGetMetadata: Allow NULL 'meta->path' Date: Fri, 29 May 2026 16:46:41 +0200 Message-ID: <0fa857329aa71ac104f70d0c6bbc4e3e47949ef7.1780063451.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: u-quyudt7ruDEL67NF4kf953ktf9SKl6EaVUM8DjIpM_1780066022 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: W4KDV75QKU6PGGAHUV7JEMNPZ47XN4LI X-Message-ID-Hash: W4KDV75QKU6PGGAHUV7JEMNPZ47XN4LI 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: 1780066476698158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Document that the caller doesn't have to populate the field as it's used only for VIR_DEBUG and optional VIR_WARN calls. Signed-off-by: Peter Krempa --- src/storage_file/storage_file_probe.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/stora= ge_file_probe.c index ff6512db77..8fa84a796e 100644 --- a/src/storage_file/storage_file_probe.c +++ b/src/storage_file/storage_file_probe.c @@ -960,8 +960,10 @@ virStorageFileGetEncryptionPayloadOffset(const struct = FileEncryptionInfo *info, /* Given a header in BUF with length LEN, as parsed from the storage file * assuming it has the given FORMAT, populate information into META * with information about the file and its backing store. Return format - * of the backing store as BACKING_FORMAT. PATH and FORMAT have to be - * pre-populated in META. + * of the backing store as BACKING_FORMAT. + * + * 'meta->format' and 'meta->path' are expected to be pre-populated althou= gh + * 'meta->path' may be NULL as the value is used only in debug messages. * * Note that this function may be called repeatedly on @meta, so it must * clean up any existing allocated memory which would be overwritten. @@ -974,7 +976,7 @@ virStorageFileProbeGetMetadata(virStorageSource *meta, size_t i; VIR_DEBUG("path=3D%s, buf=3D%p, len=3D%zu, meta->format=3D%d", - meta->path, buf, len, meta->format); + NULLSTR(meta->path), buf, len, meta->format); if (meta->format =3D=3D VIR_STORAGE_FILE_AUTO) meta->format =3D virStorageFileProbeFormatFromBuf(meta->path, buf,= len); --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780066412; cv=none; d=zohomail.com; s=zohoarc; b=cpng4XaHD2a8rhX91vu6b2KCHN7aakvr20UbwC2skAT9JylXm25G610v524T/FCIPYu/KKA8n7QG2reXLVz3GwjWJ4Q7Q2h41MRjE35sJRGcoX8HvGJhBSE+S/9Xho5wwxUzOJ3pNeW8Z+BqRM4GO2mPgRx1iAIT6N52via9b10= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066412; 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=4ZSyJsQgd43hN5l6S0zsw65M4BWR5myfJzAQagTVBbU=; b=GiTl/3d5xD2h9VHW7mAxRlHgMf7nsvuyMHklEHTWHYDno/HcfrH3VLa6l7c3V4rNOoMi+yOrvFEsgnva4810dHLjvBVAmnCCugeYO7jWHPio5oMwM1gOeyFyUN72gCEPPUxhxyojxnScVuTyC7gy8xD2rX4d/BNejfL990F/AYo= 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 1780066412010881.0856568547276; Fri, 29 May 2026 07:53:32 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 426EA419FD; Fri, 29 May 2026 10:53:30 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 5533E41D8F; Fri, 29 May 2026 10:47:32 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A42D6417CA; Fri, 29 May 2026 10:47:06 -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 EDA763FCE2 for ; Fri, 29 May 2026 10:47: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-689-WmT0iDLUOFunulQcpMKstQ-1; Fri, 29 May 2026 10:47:04 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 18D81180060F for ; Fri, 29 May 2026 14:47:03 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5B36B1955F22 for ; Fri, 29 May 2026 14:47: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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,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=1780066025; 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=4ZSyJsQgd43hN5l6S0zsw65M4BWR5myfJzAQagTVBbU=; b=apqRDPVM+WRI9tQuUqREJGdzoHdBTB28WsYfORAVUR/nxjJm4R4YxNZkx+Xkz7QPNGEyk2 ik6SF3YCnYtUTLR+F5DBD/WqytQddI2Y68nUjl9vwwH6VLjTgX5rs7K0Zo794FbUXG3PL+ ab6tZgvl22LQeei1g7B/so7vBmzrtds= X-MC-Unique: WmT0iDLUOFunulQcpMKstQ-1 X-Mimecast-MFC-AGG-ID: WmT0iDLUOFunulQcpMKstQ_1780066023 To: devel@lists.libvirt.org Subject: [RFC patch 05/17] virStorageSourceGetMetadataFromBuf: Refactor cleanup Date: Fri, 29 May 2026 16:46:42 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: VqO2lEBdsXFNZAwwyV7PCdSykG9TlQtsGmWQkhLoljA_1780066023 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: UABSA75GPTC5WTBE6H4SIJEFYL62GHVL X-Message-ID-Hash: UABSA75GPTC5WTBE6H4SIJEFYL62GHVL 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: 1780066414046154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Use automatic freeing for 'ret' and stop checking return value from 'virStorageSourceMetadataNew' which can't fail. Signed-off-by: Peter Krempa --- src/storage_file/storage_source.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_s= ource.c index fb4fc48947..651822eb65 100644 --- a/src/storage_file/storage_source.c +++ b/src/storage_file/storage_source.c @@ -119,17 +119,12 @@ virStorageSourceGetMetadataFromBuf(const char *path, size_t len, int format) { - virStorageSource *ret =3D NULL; + g_autoptr(virStorageSource) ret =3D virStorageSourceMetadataNew(path, = format); - if (!(ret =3D virStorageSourceMetadataNew(path, format))) + if (virStorageFileProbeGetMetadata(ret, buf, len) < 0) return NULL; - if (virStorageFileProbeGetMetadata(ret, buf, len) < 0) { - virObjectUnref(ret); - return NULL; - } - - return ret; + return g_steal_pointer(&ret); } --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780066560; cv=none; d=zohomail.com; s=zohoarc; b=n2dov58+51RrW7NKYtMT8lxFs79RblYH4iYSZ9ris4Bb7QsFYWziGKCPh3dZsg6QSHiHrA0dSKMEWY78nDKhD6YGaD+5Jx1xvN2jU880IV4G+TuYETJCM7PyJ10QVSrEWrQFqhS2eTwuYPKY1a/Jo2hBO5+5zccz2Kno+brvLpE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066560; 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=vxnDBo9LHx1CaPYfqNcXKAIesDKo/XWmlmSWt2xBk6E=; b=fx/nRvWXjCeibvgRlz1QZSUBoW7H4xVE9uC/T+7BqSPUTzGqwudB762kZthG5Ux+L6eQI3RpdiZ/utCUUUyxTBo5moIvgzcmgaF5r7qMn0mpnXkjUK8YUumEFRJl7Gmu+Wyi8w3t9qQLOnAHnAxGxvUDBM0v186qNHDMLmeGY3k= 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 1780066560468568.327859779985; Fri, 29 May 2026 07:56:00 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 9F13641A9A; Fri, 29 May 2026 10:55:59 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 2408241E10; Fri, 29 May 2026 10:47:43 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 9FD0641961; Fri, 29 May 2026 10:47:14 -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 32DB54187A for ; Fri, 29 May 2026 10:47:07 -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-19-swRmQsTSPTOyHSwaQtCosA-1; Fri, 29 May 2026 10:47:05 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 429C01800451 for ; Fri, 29 May 2026 14:47:04 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8CC8C1955F22 for ; Fri, 29 May 2026 14:47: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_H3, 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=1780066026; 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=vxnDBo9LHx1CaPYfqNcXKAIesDKo/XWmlmSWt2xBk6E=; b=Ryb7oJJoGWY5Tom2p/WVrWZfx/OuDV08Uh0RPcoz/T5Y532i0F8XYDcF47nHCcw96vRRg/ Mx+g84PEaQRETbSPKgkSPXRGd3K0p4o4idYRQCUyYBxxSz45f8Bm4/+7qFS8UoBaOZp0cv dm7LSyTY+Hqr1nfejAEFW1eXSMyURsM= X-MC-Unique: swRmQsTSPTOyHSwaQtCosA-1 X-Mimecast-MFC-AGG-ID: swRmQsTSPTOyHSwaQtCosA_1780066024 To: devel@lists.libvirt.org Subject: [RFC patch 06/17] virStorageSourceUpdateCapacity: Factor out size probing to 'virStorageSourceProbeCapacityFromBuf' Date: Fri, 29 May 2026 16:46:43 +0200 Message-ID: <4ac194d3a931cf784eebf0b930fcbdc63cebf992.1780063451.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: rKulX6YUFC87SdeLLhzYfoI6biozUFVgPnRG8JT0gAY_1780066024 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HWBMNTD2N6RBCKGEJILAVVNCAMZCA7EQ X-Message-ID-Hash: HWBMNTD2N6RBCKGEJILAVVNCAMZCA7EQ 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: 1780066562479154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Extract the logic to probe the image format header to a separate caller which will not touch the virStorageSource. Note that this does no longer update 'encryption->payload_offset' of the source when called from 'virStorageSourceUpdateCapacity', but that value is not actually used elsewhere. Signed-off-by: Peter Krempa --- src/libvirt_private.syms | 1 + src/storage_file/storage_source.c | 52 ++++++++++++++++++++++++------- src/storage_file/storage_source.h | 7 +++++ 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a7ce33b428..8d5b4fb875 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1933,6 +1933,7 @@ virStorageSourceInitAs; virStorageSourceNewFromBacking; virStorageSourceNewFromBackingAbsolute; virStorageSourceParseRBDColonString; +virStorageSourceProbeCapacityFromBuf; virStorageSourceRead; virStorageSourceReportBrokenChain; virStorageSourceStat; diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_s= ource.c index 651822eb65..1108865b03 100644 --- a/src/storage_file/storage_source.c +++ b/src/storage_file/storage_source.c @@ -731,7 +731,6 @@ virStorageSourceUpdateCapacity(virStorageSource *src, ssize_t len) { int format =3D src->format; - g_autoptr(virStorageSource) meta =3D NULL; /* Raw files: capacity is physical size. For all other files: if * the metadata has a capacity, use that, otherwise fall back to @@ -743,19 +742,48 @@ virStorageSourceUpdateCapacity(virStorageSource *src, return -1; } - if (format =3D=3D VIR_STORAGE_FILE_RAW && !src->encryption) { - src->capacity =3D src->physical; - } else if ((meta =3D virStorageSourceGetMetadataFromBuf(src->path, buf, - len, format))) { - src->capacity =3D meta->capacity ? meta->capacity : src->physical; - if (src->encryption && meta->encryption) - src->encryption->payload_offset =3D meta->encryption->payload_= offset; - } else { + src->capacity =3D src->physical; + + if (src->format =3D=3D VIR_STORAGE_FILE_RAW && !src->encryption) + return 0; + + if (virStorageSourceProbeCapacityFromBuf(format, buf, len, &src->capac= ity)) return -1; - } - if (src->encryption && src->encryption->payload_offset !=3D -1) - src->capacity -=3D src->encryption->payload_offset * 512; + return 0; +} + + +/** + * virStorageSourceProbeCapacityFromBuf: + * @format: format of the image to probe + * @buf: buffer containing the header of the image + * @buflen: length of @buf + * @capacity: filled with the probed capacity; caller must pre-fill it with + * physical size of the image in case when the image header doe= sn't + * contain lenght + * + * Probes the image header in @buf for capacity recorded in the header and= fills + * it into @capacity. Calers must pre-fill @capacity with the physical size + * of the backing storage as some formats don't contain capacity informati= on + * in the header. It doesn't make sense to call this for 'raw' files. + */ +int +virStorageSourceProbeCapacityFromBuf(virStorageFileFormat format, + char *buf, + ssize_t buflen, + unsigned long long *capacity) +{ + g_autoptr(virStorageSource) meta =3D virStorageSourceMetadataNew(NULL,= format); + + if (virStorageFileProbeGetMetadata(meta, buf, buflen) < 0) + return -1; + + if (meta->capacity > 0) + *capacity =3D meta->capacity; + + if (meta->encryption && meta->encryption->payload_offset !=3D -1) + *capacity -=3D meta->encryption->payload_offset * 512; return 0; } diff --git a/src/storage_file/storage_source.h b/src/storage_file/storage_s= ource.h index 774dcbffee..c8cd244ca1 100644 --- a/src/storage_file/storage_source.h +++ b/src/storage_file/storage_source.h @@ -71,6 +71,13 @@ virStorageSourceUpdateCapacity(virStorageSource *src, char *buf, ssize_t len); +int +virStorageSourceProbeCapacityFromBuf(virStorageFileFormat format, + char *buf, + ssize_t buflen, + unsigned long long *capacity) + ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4); + int virStorageSourceNewFromBacking(virStorageSource *parent, virStorageSource **backing); --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780066646; cv=none; d=zohomail.com; s=zohoarc; b=m4P4Qf/iRswqswSeBh8XFyDBwP0V5hhLmXwZxXUiZ1okRdFMHMOpL4VLIfCAj9Wgt6UCOljKtJ9qpnuVPZdi2cm5OT6CvdDLUk2UKgLXFlY/YjmbSEsj9hYCfAyYZGuTuAMZN6as0VkY5T1hEodnrK/4TdfkTAYWJHMACKGqvbI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066646; 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=hgCsjRfO7iTkslPINgP6FTjV9mvOH2DQPOYBNIynDLI=; b=bdUHJjyXJMLWh9FTxmL9DJOivRDxQfmd1egsc8Qw60aoUTcGMK8eHa8whkZ8tIHyzwIIRhur/wD9KaSZvVRlqsRw52aw0vxylrv24oSNUZKj6acxtlEHcaH2XfHmRX17cEY8D5QqbGGvYFrHpStNW2bf5WDK/hUMvbVdLfwyczo= 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 1780066646989417.86859922203325; Fri, 29 May 2026 07:57:26 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 2E5A941D26; Fri, 29 May 2026 10:57:26 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 4634941CF3; Fri, 29 May 2026 10:47:50 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 34B9641D18; Fri, 29 May 2026 10:47:23 -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 2E5F341987 for ; Fri, 29 May 2026 10:47:08 -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-118-jHoKPhLDNsWKM8kZAw61VA-1; Fri, 29 May 2026 10:47:06 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 5D423195604F for ; Fri, 29 May 2026 14:47:05 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A9B891955F22 for ; Fri, 29 May 2026 14:47: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=1780066027; 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=hgCsjRfO7iTkslPINgP6FTjV9mvOH2DQPOYBNIynDLI=; b=jAZKVUGZ9zLMiFwmLLIlh/XpyvVzsqo6jVFlM3v0W6w+K4hYGbhdtRVOpoG3/Z/rjk4ocB kzh7O/169mNxbMpNPRSYP37OXBTyW50QDDXjiGW+gq0ObnkAWzRcfRGhm6ZAcp4sm1C8FF UGYVZiaXB+R5UZznvJa7SmRC9wmXCrg= X-MC-Unique: jHoKPhLDNsWKM8kZAw61VA-1 X-Mimecast-MFC-AGG-ID: jHoKPhLDNsWKM8kZAw61VA_1780066025 To: devel@lists.libvirt.org Subject: [RFC patch 07/17] qemu: domain: Introduce 'qemuDomainStorageSourceProbeSize' Date: Fri, 29 May 2026 16:46:44 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: LeNRN5-ZV3BZUAbAfxo-4rhsF-5oBZAG992Vta5buq8_1780066025 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: E5DBGIXLXXN2PDYF5JMCR6UJM6ESDHFF X-Message-ID-Hash: E5DBGIXLXXN2PDYF5JMCR6UJM6ESDHFF 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: 1780066647836154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Introduce a new helper for querying disk sizes called 'qemuDomainStorageSourceProbeSize'. It combines what 'qemuDomainStorageUpdatePhysical' and 'qemuStorageLimitsRefresh' query, but doesn't update the virStorageSource struct. Instead the fetched size is returned via arguments as pointers. The idea of this helper is to centralize the two functions it replaces into a single place with more reasonable semantics w.r.t access of @src so that it can be later used with unlocked domain object to avoid cases where stuck storage would make the domain object stuck too. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 69 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 9 ++++++ 2 files changed, 78 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e7afeb3fa0..1792b0e9d0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -53,6 +53,7 @@ #include "virnetdevbandwidth.h" #include "virstoragefile.h" #include "storage_source.h" +#include "storage_file_probe.h" #include "virstring.h" #include "virprocess.h" #include "vircrypto.h" @@ -11659,6 +11660,74 @@ qemuDomainStorageUpdatePhysical(virQEMUDriverConfi= g *cfg, } +/** + * qemuDomainStorageSourceProbeSize: + * @cfg: qemu driver configuration object + * @vm: domain object + * @src: storage source to update + * @allocation: filled by current allocation (used) size in bytes (may be = NULL) + * @capacity: filled by (guest visible) capacity of @src in bytes (may be = NULL) + * @physical_ret: filed by size of the underlying storage of @src in bytes= (may be NULL) + * + * Fetches size information of @src and fills @allocation/@capacity/@physi= cal + * (whichever is non-NULL). @src and the fields with same names in that st= ructure + * are not used/touched. + * + * Returns 0 on success, -1 on error. No libvirt errors are reported. + */ +int +qemuDomainStorageSourceProbeSize(virQEMUDriverConfig *cfg, + virDomainObj *vm, + virStorageSource *src, + unsigned long long *allocation, + unsigned long long *capacity, + unsigned long long *physical_ret) +{ + int rc; + int fd =3D -1; + struct stat sb; + g_autofree char *buf =3D NULL; + ssize_t buflen =3D 0; + unsigned long long physical =3D 0; + + if (virStorageSourceIsEmpty(src)) + return 0; + + if (qemuDomainStorageOpenStat(cfg, vm, src, &fd, &sb, true) <=3D 0) + return -1; + + rc =3D virStorageSourceGetSize(src, fd, &sb, allocation, &physical); + + if (capacity && !qemuBlockStorageSourceIsRaw(src)) { + if (virStorageSourceIsLocalStorage(src)) { + buflen =3D virFileReadHeaderFD(fd, VIR_STORAGE_MAX_HEADER, &bu= f); + } else { + if ((buflen =3D virStorageSourceRead(src, 0, VIR_STORAGE_MAX_H= EADER, &buf)) < 0) + virResetLastError(); + } + } + + qemuDomainStorageCloseStat(src, &fd); + + if (rc < 0 || buflen < 0) + return -1; + + if (capacity) { + *capacity =3D physical; + + if (!qemuBlockStorageSourceIsRaw(src)) { + if (virStorageSourceProbeCapacityFromBuf(src->format, buf, buf= len, capacity)) + return -1; + } + } + + if (physical_ret) + *physical_ret =3D physical; + + return 0; +} + + /** * qemuDomainCheckCPU: * @arch: CPU architecture diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index b321a64e96..9bb8d0f97d 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1176,6 +1176,15 @@ int qemuDomainStorageUpdatePhysical(virQEMUDriverConfig *cfg, virDomainObj *vm, virStorageSource *src); + +int +qemuDomainStorageSourceProbeSize(virQEMUDriverConfig *cfg, + virDomainObj *vm, + virStorageSource *src, + unsigned long long *allocation, + unsigned long long *capacity, + unsigned long long *physical_ret); + virCPUCompareResult qemuDomainCheckCPU(virArch arch, virDomainVirtType virtType, --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780066732; cv=none; d=zohomail.com; s=zohoarc; b=gWc9dfAlxx5+6Zxsyo9ugF1yxYsygrAOyZzdsqoGhBG5dKxUg5YRhldcHvfjc81HhGwb8Wv2aLJ1oH20UAeXDqQ6tiYXvI1GFhkXzmFlpe6al7mQ0Vj7sxLUvi6E5qw5tCdEOEPC2DjnHzhFTKDwhd5DyXTEB8IcmSGTwGZ9ya8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066732; 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=A3BS/nolv4rRwdIBOv+WccMX3x4XCNkFEHPgVD1HQcY=; b=O99chS3VdZTMzqJXhmyOzhicXORau/N1Wn9rTFQsGYgDn65ImPP9bvdroaviwDNK+VcDHA0EWLPlnvH8MTpnP1Hm4DvMiB1N1BQVvuNDZPqYnF80XohjCb6aN0CheBNLKzPfpQu3cGuaJXFLfO9MG5lETZEJmFLExd6A0Y7ghMA= 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 1780066732943170.8632695546287; Fri, 29 May 2026 07:58:52 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A8D9641B96; Fri, 29 May 2026 10:58:51 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id D8CD141E56; Fri, 29 May 2026 10:47:56 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 3C39741D5E; Fri, 29 May 2026 10: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 2B5CE41A04 for ; Fri, 29 May 2026 10:47:09 -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-657-8aqcR_EWPniitAQZbTsrYQ-1; Fri, 29 May 2026 10:47:07 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 7C94A1956095 for ; Fri, 29 May 2026 14:47:06 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C3B7A1955F22 for ; Fri, 29 May 2026 14:47:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780066028; 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=A3BS/nolv4rRwdIBOv+WccMX3x4XCNkFEHPgVD1HQcY=; b=R82AqFW1RKW8x4Gh5y0x+I1Js4lmk1BfwPTplkFH6OaUK2GeERTfsYKU9r5mqivS6HJtQ/ CfgTZk0yLaQbZ5JoPVwHnWAof0MMF63e3e8MxEbdywsnosvftGnV2EG7Tx2mzx7SzuynPV 0WIpOLMgTQ753Ndimz8iqvR7VKgj/eo= X-MC-Unique: 8aqcR_EWPniitAQZbTsrYQ-1 X-Mimecast-MFC-AGG-ID: 8aqcR_EWPniitAQZbTsrYQ_1780066026 To: devel@lists.libvirt.org Subject: [RFC patch 08/17] qemuDomainGetBlockInfo: Rewrite to 'qemuDomainStorageSourceProbeSize' Date: Fri, 29 May 2026 16:46:45 +0200 Message-ID: <40780e13e3f14000781cffd60dba0bae355682f1.1780063451.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 6zUqekNo8YOapZkN9KjhHA83hYH0mPPuDiRQXWjquo0_1780066026 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: METLVEVHUWXC6TVYFO43KFYCDR2ARMOY X-Message-ID-Hash: METLVEVHUWXC6TVYFO43KFYCDR2ARMOY 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: 1780066734207158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Use 'qemuDomainStorageSourceProbeSize' instead of 'qemuDomainStorageUpdatePhysical'. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index bcafacfb60..e37c852c98 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10803,12 +10803,14 @@ qemuDomainGetBlockInfo(virDomainPtr dom, * value for this API. NB: May still be 0 for block. */ if (entry->physical =3D=3D 0 || info->allocation =3D=3D 0 || info->allocation =3D=3D entry->physical) { + unsigned long long physical; + if (info->allocation =3D=3D 0) info->allocation =3D entry->physical; - if (qemuDomainStorageUpdatePhysical(cfg, vm, disk->src) =3D=3D 0) { - VIR_DEBUG("updating physical disk size to '%llu'", disk->src->= physical); - info->physical =3D disk->src->physical; + if (qemuDomainStorageSourceProbeSize(cfg, vm, disk->src, NULL, NUL= L, &physical) =3D=3D 0) { + VIR_DEBUG("updating physical disk size to '%llu'", physical); + info->physical =3D physical; } else { info->physical =3D entry->physical; } --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780066788; cv=none; d=zohomail.com; s=zohoarc; b=GXyV2R1qRu+OG8VrSSpXcsfQz4oEo2XCDJu8OqFPT5EXrQAiR+lljmhEfGJUWTVmvHJoG40qTB2CQXSyEf3f2ErB+XsUdqlKT7DU7pHnkmgEhCxq/i1sYDfoF+7IxxHycyIdgmU8FWfJ2SCKCKr3CmCedVDIaqW6iDtXuuaGtjs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066788; 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=HMQnWKTshwPfGgpnJRiRenMf6nzYsMaiNwUSAwwBOME=; b=ShP3p9R8s9N+tFwkqBneM0UchoGUJnJ/fOiPKdvLU8kfse1fnhXogmex5i0WtJk/fjSA16HvtDe3w4kIi1Gp8ZV8kn4X9gz3FojZjJ9E/LKFaUsT84wskH8wkWyySKL4xTG0ruPtNUpPzJjSxlddeU1nqHf3zF0F8H1ggVSkqoY= 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 1780066788905153.26876599320053; Fri, 29 May 2026 07:59:48 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 2C19141B82; Fri, 29 May 2026 10:59:48 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 2089D41E08; Fri, 29 May 2026 10:48:02 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id EF82B41DAB; Fri, 29 May 2026 10:47:32 -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 49FF041ADA for ; Fri, 29 May 2026 10:47:10 -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-184-2qn4-ySwOgyox-MixlbMhw-1; Fri, 29 May 2026 10:47:08 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 A325C195609E for ; Fri, 29 May 2026 14:47:07 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E50D41955F22 for ; Fri, 29 May 2026 14:47: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_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=1780066029; 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=HMQnWKTshwPfGgpnJRiRenMf6nzYsMaiNwUSAwwBOME=; b=dQEgqdh72eQ28ZbV9PcE+UeE7U/zCc6xnsMiWUbd7R3bp7mhU/pRT/FUk+1zrQAHVi8LWW /rf37rtHXdtrix9aN8q1drkcxNbfd65VuBKSMq0Hk+5SxWJhuUAvxEdak/du8KaDWtI+kU vPb7Q58CRnwerIs0zz/k3QeVzLpRrak= X-MC-Unique: 2qn4-ySwOgyox-MixlbMhw-1 X-Mimecast-MFC-AGG-ID: 2qn4-ySwOgyox-MixlbMhw_1780066027 To: devel@lists.libvirt.org Subject: [RFC patch 09/17] qemuDomainGetStatsOneBlock: Rewrite to 'qemuDomainStorageSourceProbeSize' Date: Fri, 29 May 2026 16:46:46 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: yYfhZ79kcPXU_BeiVq_oHBmPO_cG1IVjZo6hPCekO5Q_1780066027 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: S6ERKNYAKYI4VSF3WSDC2VWOS27M6SYO X-Message-ID-Hash: S6ERKNYAKYI4VSF3WSDC2VWOS27M6SYO 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: 1780066790150154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Use 'qemuDomainStorageSourceProbeSize' instead of 'qemuDomainStorageUpdatePhysical'. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e37c852c98..253727129c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17830,8 +17830,10 @@ qemuDomainGetStatsOneBlock(virQEMUDriverConfig *cf= g, virTypedParamListAddULLong(params, entry->physical, VIR_DOMAIN_STATS_BLOCK_PREFIX "%zu" VIR= _DOMAIN_STATS_BLOCK_SUFFIX_PHYSICAL, block_idx); } else { - if (qemuDomainStorageUpdatePhysical(cfg, dom, src) =3D=3D 0) { - virTypedParamListAddULLong(params, src->physical, + unsigned long long physical =3D 0; + + if (qemuDomainStorageSourceProbeSize(cfg, dom, src, NULL, NULL, &p= hysical) =3D=3D 0) { + virTypedParamListAddULLong(params, physical, VIR_DOMAIN_STATS_BLOCK_PREFIX "%zu"= VIR_DOMAIN_STATS_BLOCK_SUFFIX_PHYSICAL, block_idx); } } --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780066846; cv=none; d=zohomail.com; s=zohoarc; b=FgUgnGZOCbTYZL/Q8FQOnY63l0K1jJ3ZU808aUxieKFl8VP4in/qyVrV0Vi/ueZPrj9neCV5K0uZsAvnzzI8NQRKLwedrsZT9EwteBDX7X9ItXBP3DihV/IUAsYECb3/mMJ5Hv+z2fEOwc0HTR3nn/jwi3ENwsgzBQ3hF7dQh8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066846; 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=ejGKrLQ56AQArP+wuL1aCZdEa8T/ZoqpCwh+mveNXDk=; b=LNaoJGCGsTMHgW7OrA2a34KC4ga2s3Qk1LvJ36I3nQhzFzLhez0w9V8gfloijDBtB6q5uOuqeHpJ6nO/vhw+KRk9L2+/0+69zlmLK1iKDf75Ac4uSrY3qLOd9/DnwpXSj9uC7/9g1ndSoKCzZf+H8prKbvg/N2Ziq8Ho2N/Ttps= 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 1780066846438907.830528941836; Fri, 29 May 2026 08:00:46 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D06A341CD6; Fri, 29 May 2026 11:00:45 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id E606543DE0; Fri, 29 May 2026 10:48:38 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 7213441E37; Fri, 29 May 2026 10:48:28 -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 08E0541AD3 for ; Fri, 29 May 2026 10:47: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-264-9rXGi1A3OJGawHH98Spyew-1; Fri, 29 May 2026 10:47:09 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 CE4281800621 for ; Fri, 29 May 2026 14:47:08 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 220A81955F22 for ; Fri, 29 May 2026 14:47: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=-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=1780066031; 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=ejGKrLQ56AQArP+wuL1aCZdEa8T/ZoqpCwh+mveNXDk=; b=aPyMqjJLHn2+zyJ5IBaaR3767kmlyc2OkPyXSk4vS41rAGG3R/QRugDOuozhuiOSon4QPT SF5P/5rf1cl+Rk9Z+m0i71ni9Y3y7pMHz9lUFVEAidCEJkqZiu4s59XTQv/9gsvd6GhyzZ bct5hO8Rf4rBk82azr4TFN2tG9C6pMU= X-MC-Unique: 9rXGi1A3OJGawHH98Spyew-1 X-Mimecast-MFC-AGG-ID: 9rXGi1A3OJGawHH98Spyew_1780066028 To: devel@lists.libvirt.org Subject: [RFC patch 10/17] qemuMigrationDstPrepareStorage: Rewrite to 'qemuDomainStorageSourceProbeSize' Date: Fri, 29 May 2026 16:46:47 +0200 Message-ID: <83a895bc2f3dab5831685d9449790f50689da9d9.1780063451.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: oHjD_Ett4pEmOm9xo5NgxbYyqOZFX1AZmleAW9WVVZo_1780066028 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: XTY7OC6TF355SDZ5WAKXTFMZFGCXKFBP X-Message-ID-Hash: XTY7OC6TF355SDZ5WAKXTFMZFGCXKFBP 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: 1780066848954154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Use 'qemuDomainStorageSourceProbeSize' instead of 'qemuDomainStorageUpdatePhysical'. Signed-off-by: Peter Krempa --- src/qemu/qemu_migration.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 4a43ab83b0..67955aa762 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -482,9 +482,10 @@ qemuMigrationDstPrepareStorage(virDomainObj *vm, qemuDomainObjPrivate *priv =3D vm->privateData; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetCon= fig(priv->driver); qemuDomainDiskPrivate *diskPriv =3D QEMU_DOMAIN_DISK_PRIVA= TE(disk); + unsigned long long physical =3D 0; - if (qemuDomainStorageUpdatePhysical(cfg, vm, disk->src) = =3D=3D 0 && - disk->src->physical > nbd->disks[i].capacity) { + if (qemuDomainStorageSourceProbeSize(cfg, vm, disk->src, N= ULL, NULL, &physical) =3D=3D 0 && + physical > nbd->disks[i].capacity) { disk->src->sliceStorage =3D g_new0(virStorageSourceSli= ce, 1); disk->src->sliceStorage->size =3D nbd->disks[i].capaci= ty; diskPriv->migrationslice =3D true; --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780066901; cv=none; d=zohomail.com; s=zohoarc; b=YqmCy0bQM8z3FgfloHEjng95uLYHH5rqcJG/gAY5w53ExiD8ndFw3h2XDb5J4M2e0Sn96CKhKeVj5DluIVcRj9um1F+n0iNtSe7oAW9UyGES43GsSdTPsUEkC08xXBha8ExJ1LGjyeMhg1w4qbIzNvx3C/ITvOCjx344A0cd7PQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066901; 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=RP5v0gmm2ehmuQPDzpwuxqSr1+0l48PjTD3J8rZmDcY=; b=jtPZLDY46oJDfTVKHlIbtAQpCa4kkZdVQOWe9TTY4bCadFk3bGztJzt1mSlSjFBD0fn17+KiFGU87BzFMG1Mie/6Stxny27i/fJpGzwluDXg34el0rMK5LdgYFL6yfEIKjsV14yTvU4YPmhYHoHChZAAKJ+kDNrhqKyPRozlfWs= 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 1780066901543229.02500602293014; Fri, 29 May 2026 08:01:41 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 46B4D41B3C; Fri, 29 May 2026 11:01:40 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 9E78841DF3; Fri, 29 May 2026 10:48:45 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 2E32041E54; Fri, 29 May 2026 10:48:34 -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 2B8D341903 for ; Fri, 29 May 2026 10:47:13 -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-277-0HQvRv_IPN66lkoY8U5Y-g-1; Fri, 29 May 2026 10:47:10 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 EADC41956062 for ; Fri, 29 May 2026 14:47:09 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 41D0A1955F22 for ; Fri, 29 May 2026 14:47: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=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780066032; 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=RP5v0gmm2ehmuQPDzpwuxqSr1+0l48PjTD3J8rZmDcY=; b=jKYixX2c8EehQroMRutB5FLVlUtlfJSiGTIo7wmQYR+yUneGVW+YIj0re7b9fj0uN/6oYn ERcejT/4E2vx+p9GJcyLC4kQ6jgytbV+iUPO4pWQPO6eDkAANOuEv5c9iJZa8lNS+f17t+ Px962W9b8orV4KNsk1LhuBnFvJxOJpU= X-MC-Unique: 0HQvRv_IPN66lkoY8U5Y-g-1 X-Mimecast-MFC-AGG-ID: 0HQvRv_IPN66lkoY8U5Y-g_1780066030 To: devel@lists.libvirt.org Subject: [RFC patch 11/17] qemuDomainBlockResize: Rewrite to 'qemuDomainStorageSourceProbeSize' Date: Fri, 29 May 2026 16:46:48 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: rEbrxHklvOICvFyKpVOU43Rdz9gtJj_Odwo3e20EgNY_1780066030 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: CGYYHYUDBKVKST6JSXQ2BVODV6OGF7UW X-Message-ID-Hash: CGYYHYUDBKVKST6JSXQ2BVODV6OGF7UW 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: 1780066907871158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Use 'qemuDomainStorageSourceProbeSize' instead of 'qemuDomainStorageUpdatePhysical'. Since 'size_src' was used just to fetch the 'physical' field, the patch localizes the scope of the pointer and uses the 'physical' value instead. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 253727129c..1b14c6d42e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9547,7 +9547,7 @@ qemuDomainBlockResize(virDomainPtr dom, const char *nodename =3D NULL; virDomainDiskDef *disk =3D NULL; virDomainDiskDef *persistDisk =3D NULL; - virStorageSource *size_src =3D NULL; + unsigned long long physical =3D 0; virCheckFlags(VIR_DOMAIN_BLOCK_RESIZE_BYTES | VIR_DOMAIN_BLOCK_RESIZE_CAPACITY | @@ -9606,6 +9606,7 @@ qemuDomainBlockResize(virDomainPtr dom, */ if ((flags & VIR_DOMAIN_BLOCK_RESIZE_CAPACITY) || disk->src->sliceStor= age) { g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(priv= ->driver); + virStorageSource *size_src =3D NULL; if (disk->src->dataFileStore) size_src =3D disk->src->dataFileStore; @@ -9622,7 +9623,7 @@ qemuDomainBlockResize(virDomainPtr dom, } if (virStorageSourceIsBlockLocal(size_src)) { - if (qemuDomainStorageUpdatePhysical(cfg, vm, size_src) < 0) { + if (qemuDomainStorageSourceProbeSize(cfg, vm, size_src, NULL, = NULL, &physical) < 0) { virReportError(VIR_ERR_OPERATION_FAILED, _("failed to update capacity of '%1$s'"), s= ize_src->path); goto endjob; @@ -9632,11 +9633,11 @@ qemuDomainBlockResize(virDomainPtr dom, if (flags & VIR_DOMAIN_BLOCK_RESIZE_CAPACITY) { if (size =3D=3D 0) { - size =3D size_src->physical; - } else if (size !=3D size_src->physical) { + size =3D physical; + } else if (size !=3D physical) { virReportError(VIR_ERR_INVALID_ARG, _("Requested resize to '%1$llu' but device size= is '%2$llu'"), - size, size_src->physical); + size, physical); goto endjob; } } @@ -9676,10 +9677,10 @@ qemuDomainBlockResize(virDomainPtr dom, /* trying to resize a block device to a size not equal to the actu= al * size of the block device will cause qemu to fail */ if (virStorageSourceIsBlockLocal(disk->src) && - disk->src->physical !=3D size) { + physical !=3D size) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("block device backed disk must be resized to = its actual size '%1$llu'"), - disk->src->physical); + physical); goto endjob; } --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780066951; cv=none; d=zohomail.com; s=zohoarc; b=Qqr68XWeG3RcKtBHoOsGmU+8zz6nqCqYP+Abziz8jD3LNzLYc5K5TpWswgxkCvydJmsp1giXVBmPhYzWP3W7FipwFuh7wP1gZLono7s9E9jkUJ/KXBEy3S1bJn57CDhQCdR6uJ2qn58RVIXbBA9AHCKHWPIRNZlYp+s/Atgh9X4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066951; 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=wqd5bYJrnIKDcB6qXJF6JjRluWlvTRQ0r+zf+XdKYx8=; b=RWlyxBORBDnWtWwNybWH3PIbjIB1e+/Gq5mCDtXRExr+wvaXbRERcmWh/7TrEyWpuv3EBNBfHMu5dByYVPwUgIAyQ2W/XAgO/OGKFBGkzKaB6EtRz+UOq5pgME6yHCHht+KT0tiUDgatdZ8M/T4He7KZBoXWwm7td3kJi9GU8/8= 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 1780066951159795.4833272742105; Fri, 29 May 2026 08:02:31 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 77FCF4184B; Fri, 29 May 2026 11:02:30 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 5BE6943E61; Fri, 29 May 2026 10:49:06 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 24FE741AD3; Fri, 29 May 2026 10:48:53 -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)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id BBD9341952 for ; Fri, 29 May 2026 10:47:14 -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-388-Lks83JNIMCSlyzN6DM7flQ-1; Fri, 29 May 2026 10:47:11 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 1954419560B5 for ; Fri, 29 May 2026 14:47:11 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 601081955F22 for ; Fri, 29 May 2026 14:47: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=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=1780066034; 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=wqd5bYJrnIKDcB6qXJF6JjRluWlvTRQ0r+zf+XdKYx8=; b=ECJ4jYtNQPIowZL0a/9VZI25qInQ5mA4vJxuKVtU6Ju1Yj+wqytIy2DZZYi61VEGiL/aZR S4m7vtVz8kP3G8aD/sHGAGh01riUibkWFwlYSBww3ePq5IQCqzibFPQeiTBbtGf5+x9O6a qQqjgJiyKLzfy29lJzJ3W+yYCTjAwzs= X-MC-Unique: Lks83JNIMCSlyzN6DM7flQ-1 X-Mimecast-MFC-AGG-ID: Lks83JNIMCSlyzN6DM7flQ_1780066031 To: devel@lists.libvirt.org Subject: [RFC patch 12/17] qemu: domain: Remove 'qemuDomainStorageUpdatePhysical' Date: Fri, 29 May 2026 16:46:49 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: dgVLLyqegZizgxzQ4FDwbe0OqjsF-Xr1SRbuMXBeqFA_1780066031 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: VNINO7NRTWHRS6FUJBTIUWFWYYM3RUT3 X-Message-ID-Hash: VNINO7NRTWHRS6FUJBTIUWFWYYM3RUT3 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: 1780066952716154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa All uses were replaced by 'qemuDomainStorageSourceProbeSize'. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 38 -------------------------------------- src/qemu/qemu_domain.h | 4 ---- 2 files changed, 42 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1792b0e9d0..40b59a4f31 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11622,44 +11622,6 @@ qemuDomainStorageCloseStat(virStorageSource *src, } -/** - * qemuDomainStorageUpdatePhysical: - * @cfg: qemu driver configuration object - * @vm: domain object - * @src: storage source to update - * - * Update the physical size of the disk by reading the actual size of the = image - * on disk. - * - * Returns 0 on successful update and -1 otherwise (some uncommon errors m= ay be - * reported but are reset (thus only logged)). - */ -int -qemuDomainStorageUpdatePhysical(virQEMUDriverConfig *cfg, - virDomainObj *vm, - virStorageSource *src) -{ - int ret; - int fd =3D -1; - struct stat sb; - - if (virStorageSourceIsEmpty(src)) - return 0; - - if ((ret =3D qemuDomainStorageOpenStat(cfg, vm, src, &fd, &sb, true)) = <=3D 0) { - if (ret < 0) - virResetLastError(); - return -1; - } - - ret =3D virStorageSourceGetSize(src, fd, &sb, NULL, &src->physical); - - qemuDomainStorageCloseStat(src, &fd); - - return ret; -} - - /** * qemuDomainStorageSourceProbeSize: * @cfg: qemu driver configuration object diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 9bb8d0f97d..ec1c2a4779 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1172,10 +1172,6 @@ qemuDomainStorageOpenStat(virQEMUDriverConfig *cfg, void qemuDomainStorageCloseStat(virStorageSource *src, int *fd); -int -qemuDomainStorageUpdatePhysical(virQEMUDriverConfig *cfg, - virDomainObj *vm, - virStorageSource *src); int qemuDomainStorageSourceProbeSize(virQEMUDriverConfig *cfg, --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780066995; cv=none; d=zohomail.com; s=zohoarc; b=Ah+2hZDfI69DgK0nUCUTNyXoE5O0b6d7/EtI39PSPXUZV7FCkjRapHcoZiFgDdpPPWYRsclEAQdqIIF4AUKOCGSsbwAMLqjyQ0ToukMn1iekpsXjSuW22dvYb0D91QC9rxlk6XwcDWXwfPLl172A/HT1egcuKEiaoz+rJsGugZs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780066995; 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=AQCHYeCkZaqXLQhzQA0vZNjpQnrc13xTJXO9iz9Ze+A=; b=NjI4L3Z8lbqJcaQbCTlxgo/ZcwAgcLvIRxqL4gyftC9vQwHZt/3R3/yH/i9QDTTNNd780YSIXrBNZy+b7d9JXH4pvlyPpPSdBHviqTonrwRhVtpDQq85iRutdUPV4yPU1DDTYIeRcbiBCcVIXIzPtS5/Ku5fm6r0WVsNNeN41mg= 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 1780066995654385.30030479507775; Fri, 29 May 2026 08:03:15 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E701541D8D; Fri, 29 May 2026 11:03:14 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 0720441E3B; Fri, 29 May 2026 10:49:26 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id BED1D41B74; Fri, 29 May 2026 10:49:16 -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 2449141906 for ; Fri, 29 May 2026 10:47:16 -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-503-GuPSg7V6NiarVhT0SZwXWg-1; Fri, 29 May 2026 10:47:13 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 3747719560B4 for ; Fri, 29 May 2026 14:47:12 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7F9481955F22 for ; Fri, 29 May 2026 14:47: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=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780066035; 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=AQCHYeCkZaqXLQhzQA0vZNjpQnrc13xTJXO9iz9Ze+A=; b=LBxVIauBahKYnhl8YfqwxCTshGdUU0IApW/0HwZ5refD04aAKKoWWNtGx1C0m8OBTrbbst nTYRWLV76r+dFDILxmorXckyqzPuwIdgQiCzQmb0tasKEEI0jOPc6j7K3zZebkVRB3nYPR q0QmNoD0Xj5qjXGJiHqv+J5IYq4w0eo= X-MC-Unique: GuPSg7V6NiarVhT0SZwXWg-1 X-Mimecast-MFC-AGG-ID: GuPSg7V6NiarVhT0SZwXWg_1780066032 To: devel@lists.libvirt.org Subject: [RFC patch 13/17] qemuDomainGetStatsOneBlockFallback: Rewrite using 'qemuDomainStorageSourceProbeSize' Date: Fri, 29 May 2026 16:46:50 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: tS_9q51jBfDwytAhyNEFxdnW917aL9hggFMw6e5aB7M_1780066032 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: WV5S4F36TN6U3TZKXVLQRZ5BVY56L3WU X-Message-ID-Hash: WV5S4F36TN6U3TZKXVLQRZ5BVY56L3WU 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: 1780067001440154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Replace use of 'qemuStorageLimitsRefresh' by 'qemuDomainStorageSourceProbeSize'. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1b14c6d42e..c6e35c58a4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17773,25 +17773,28 @@ qemuDomainGetStatsOneBlockFallback(virQEMUDriverC= onfig *cfg, virStorageSource *src, size_t block_idx) { + unsigned long long allocation =3D 0; + unsigned long long capacity =3D 0; + unsigned long long physical =3D 0; + if (virStorageSourceIsEmpty(src) || virStorageSourceIsFD(src)) return; - if (qemuStorageLimitsRefresh(cfg, dom, src, true) <=3D 0) { - virResetLastError(); + if (qemuDomainStorageSourceProbeSize(cfg, dom, src, &allocation, + &capacity, &physical) < 0) return; - } - if (src->allocation) - virTypedParamListAddULLong(params, src->allocation, + if (allocation) + virTypedParamListAddULLong(params, allocation, VIR_DOMAIN_STATS_BLOCK_PREFIX "%zu" VIR= _DOMAIN_STATS_BLOCK_SUFFIX_ALLOCATION, block_idx); - if (src->capacity) - virTypedParamListAddULLong(params, src->capacity, + if (capacity) + virTypedParamListAddULLong(params, capacity, VIR_DOMAIN_STATS_BLOCK_PREFIX "%zu" VIR= _DOMAIN_STATS_BLOCK_SUFFIX_CAPACITY, block_idx); - if (src->physical) - virTypedParamListAddULLong(params, src->physical, + if (physical) + virTypedParamListAddULLong(params, physical, VIR_DOMAIN_STATS_BLOCK_PREFIX "%zu" VIR= _DOMAIN_STATS_BLOCK_SUFFIX_PHYSICAL, block_idx); } --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780067075; cv=none; d=zohomail.com; s=zohoarc; b=I4QoeYxMus48SIpVTcLw113YSbbLzDyXy819HfQ00FExHlGM7o0Pc7IE5258xUU/lFE0e3CtKv4DQ6W96P3WETWoVrpt9iKId/2+E4N5vcXRGD+hgRAnIMxiNsk5sH+gbY7AtfcHBMsMqQUSdqjDCb2mO0aWeMZyZqxAq0Cydms= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780067075; 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=tHFydewc8Of6sR2CCzNY2+MhUBcCdyN6TArDZnxJ1WE=; b=d1qzsl/8strbx/Kgrl6St3DhOiF+6V/9RN7HigTftFJiiCPbbdyrxrNbV9SRMKmvDeRdYf3jxjKdnVa9ZDbov2JSd0f19p1a6iAbV7MSs1uLmZHV46pQo4LhEqO2Yx/OpzKkx6EDjbRpPbg91oNegqEPnUw2bJLHzYSXUym8wn8= 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 1780067075297195.85838599886142; Fri, 29 May 2026 08:04:35 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 0CF5E41BFA; Fri, 29 May 2026 11:04:33 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id D5D9C41C12; Fri, 29 May 2026 10:49:47 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 4803441BAA; Fri, 29 May 2026 10:49:39 -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 DA05941BDE for ; Fri, 29 May 2026 10:47:16 -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-676-HLrqAzu4OhShI6cSvN6tXQ-1; Fri, 29 May 2026 10:47:14 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 527A119560B1 for ; Fri, 29 May 2026 14:47:13 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9F5D61955F22 for ; Fri, 29 May 2026 14:47: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=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=1780066036; 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=tHFydewc8Of6sR2CCzNY2+MhUBcCdyN6TArDZnxJ1WE=; b=bj4GAdQiR+PP+41nMPBHHZpqWf7WKqFND+etubjwbrRSesnwE+9mQeIxRYBD6DwVP2kHbr ZoY74hIJFtSMQrrx7fjL03xK5O1xN6gc5wioozm5nkmDb6UBM8uQsra6cSxaUbXDlokJ8y eZsadIT2eV1OCpiGfsU/DeWuXV/lMwc= X-MC-Unique: HLrqAzu4OhShI6cSvN6tXQ-1 X-Mimecast-MFC-AGG-ID: HLrqAzu4OhShI6cSvN6tXQ_1780066033 To: devel@lists.libvirt.org Subject: [RFC patch 14/17] qemuDomainGetBlockInfo: Rewrite using 'qemuDomainStorageSourceProbeSize' Date: Fri, 29 May 2026 16:46:51 +0200 Message-ID: <2033e366cba2e4d0823f39ef21f200039c507779.1780063451.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: OyJjvbN-cny1OQDtyuB_2s1n2OZ7FneyWt2N1Ob0Sxs_1780066033 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IFHUY5HUPQQ5I6XZMJODQTZWWBOMVTKV X-Message-ID-Hash: IFHUY5HUPQQ5I6XZMJODQTZWWBOMVTKV 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: 1780067077775158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Replace use of 'qemuStorageLimitsRefresh' by 'qemuDomainStorageSourceProbeSize'. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 93 ++++-------------------------------------- 1 file changed, 7 insertions(+), 86 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c6e35c58a4..13988d6568 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10633,87 +10633,6 @@ qemuDomainMemoryPeek(virDomainPtr dom, } -/** - * @cfg: driver configuration data - * @vm: domain object - * @src: storage source data - * @skipInaccessible: Suppress reporting of common errors when accessing @= src - * - * Refresh the capacity and allocation limits of a given storage source. - * - * Assumes that the caller has already obtained a domain job and only - * called for an offline domain. Being offline is particularly important - * since reading a file while qemu is writing it risks the reader seeing - * bogus data or avoiding opening a file in order to get stat data. - * - * We always want to check current on-disk statistics (as users have been - * known to change offline images behind our backs). - * - * For read-only disks, nothing should be changing unless the user has - * requested a block-commit action. For read-write disks, we know some - * special cases: capacity should not change without a block-resize (where - * capacity is the only stat that requires reading a file, and even then, - * only for non-raw files); and physical size of a raw image or of a - * block device should likewise not be changing without block-resize. - * On the other hand, allocation of a raw file can change (if the file - * is sparse, but the amount of sparseness changes due to writes or - * punching holes), and physical size of a non-raw file can change. - * - * Returns 1 if @src was successfully updated, 0 if @src can't be opened a= nd - * @skipInaccessible is true (no errors are reported) or -1 otherwise (err= ors - * are reported). - */ -static int -qemuStorageLimitsRefresh(virQEMUDriverConfig *cfg, - virDomainObj *vm, - virStorageSource *src, - bool skipInaccessible) -{ - int rc; - int ret =3D -1; - int fd =3D -1; - struct stat sb; - g_autofree char *buf =3D NULL; - ssize_t len; - - if ((rc =3D qemuDomainStorageOpenStat(cfg, vm, src, &fd, &sb, - skipInaccessible)) <=3D 0) - return rc; - - if (virStorageSourceIsLocalStorage(src)) { - if ((len =3D virFileReadHeaderFD(fd, VIR_STORAGE_MAX_HEADER, &buf)= ) < 0) { - virReportSystemError(errno, _("cannot read header '%1$s'"), - src->path); - goto cleanup; - } - } else { - if ((len =3D virStorageSourceRead(src, 0, VIR_STORAGE_MAX_HEADER, = &buf)) < 0) - goto cleanup; - } - - if (virStorageSourceUpdateBackingSizes(src, fd, &sb) < 0) - goto cleanup; - - if (virStorageSourceUpdateCapacity(src, buf, len) < 0) - goto cleanup; - - /* If guest is not using raw disk format and is on a host block - * device, then leave the value unspecified, so caller knows to - * query the highest allocated extent from QEMU - */ - if (virStorageSourceGetActualType(src) =3D=3D VIR_STORAGE_TYPE_BLOCK && - !qemuBlockStorageSourceIsRaw(src) && - S_ISBLK(sb.st_mode)) - src->allocation =3D 0; - - ret =3D 1; - - cleanup: - qemuDomainStorageCloseStat(src, &fd); - return ret; -} - - static int qemuDomainGetBlockInfo(virDomainPtr dom, const char *path, @@ -10767,12 +10686,14 @@ qemuDomainGetBlockInfo(virDomainPtr dom, /* for inactive domains we have to peek into the files */ if (!virDomainObjIsActive(vm)) { - if ((qemuStorageLimitsRefresh(cfg, vm, disk->src, false)) < 0) + if (qemuDomainStorageSourceProbeSize(cfg, vm, disk->src, + &info->allocation, + &info->capacity, + &info->physical) < 0) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to fetch size data for '%1$s'"), path= ); goto endjob; - - info->capacity =3D disk->src->capacity; - info->allocation =3D disk->src->allocation; - info->physical =3D disk->src->physical; + } ret =3D 0; goto endjob; --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780067182; cv=none; d=zohomail.com; s=zohoarc; b=lFJVz9L8buZNBPeyRn7wedk1W6D4Q8MV7VpL/WjyXKCxvT0lzfe0e3d5nPog0Dk6BxqGm9btqv2SHSJA6CwT9d8w1XFJU2Zhvw+q0UcWyPuPMCu479pN1KoViJrhGwD59WQlHVCy4xY3JHVXZ77N5IEzF9hP0OEyIF/M0LlsRIs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780067182; 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=QobaM7iPj5qO6YudHJszNk3bu1cLaO+TtcaMUDY51AI=; b=J5o7M7d4oVrFtdZpmBsGlIaEld/V05gIH1hAZ6D1ofJ+RIPYOkdAHkVw//tKNX5JrDVr1hNlJdxpBjxNh99HMlnJlpdXBUJc47u7YI3114k6H63ZYS1WfkPvm3c/6LLv58cPcy5Vcf8gFIK2bm52i2yaWMDRkHloT+7AoeXWiAY= 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 1780067182065903.151587729002; Fri, 29 May 2026 08:06:22 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 4A3A1419F5; Fri, 29 May 2026 11:06:21 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 95D1643F43; Fri, 29 May 2026 10:50:09 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id C78B243E0F; Fri, 29 May 2026 10:49:54 -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 9858241C37 for ; Fri, 29 May 2026 10:47:18 -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-367-zz5cEZBjOVKec_lNOCGL4Q-1; Fri, 29 May 2026 10:47:15 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 76BD519560A7 for ; Fri, 29 May 2026 14:47:14 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B9A631955F22 for ; Fri, 29 May 2026 14:47: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=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780066038; 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=QobaM7iPj5qO6YudHJszNk3bu1cLaO+TtcaMUDY51AI=; b=FKMWOpzcBSzs4obJfXmqJT0d+0bE9qQyaD1Zth/Jr8xUKBvuqb4NsI20a2KI4xUGgBk9BE 3qs/5bauabnrxqeO1zkCxRtNbAOyJDD3wJUsuru4K13tKEPXB9Kjy/2onWkrQ4zwriw1It dATFSdexbR8Rz1cQVUaFCp5RqwY6Qbs= X-MC-Unique: zz5cEZBjOVKec_lNOCGL4Q-1 X-Mimecast-MFC-AGG-ID: zz5cEZBjOVKec_lNOCGL4Q_1780066034 To: devel@lists.libvirt.org Subject: [RFC patch 15/17] qemu: domain: Fix coding style of domain object locking helpers Date: Fri, 29 May 2026 16:46:52 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: u-ZiEuy_mBFtYNZWYKIeu1Eb_ZA7C06gSVxg5D_KCms_1780066034 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FIK7A2QHETZ7R6KCDMLXVQNRYOEG3WPQ X-Message-ID-Hash: FIK7A2QHETZ7R6KCDMLXVQNRYOEG3WPQ 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: 1780067184597154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Fix coding style around the monitor/remote helpers. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 40b59a4f31..9368ab916d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5157,6 +5157,7 @@ qemuDomainObjEnterMonitorInternal(virDomainObj *obj, return 0; } + /* obj must NOT be locked before calling * * Should be paired with an earlier qemuDomainObjEnterMonitor() call @@ -5187,7 +5188,9 @@ qemuDomainObjExitMonitor(virDomainObj *obj) virDomainObjEndJob(obj); } -void qemuDomainObjEnterMonitor(virDomainObj *obj) + +void +qemuDomainObjEnterMonitor(virDomainObj *obj) { ignore_value(qemuDomainObjEnterMonitorInternal(obj, VIR_ASYNC_JOB_NONE= )); } @@ -5255,7 +5258,9 @@ qemuDomainObjExitAgent(virDomainObj *obj, qemuAgent *= agent) agent, obj, obj->def->name); } -void qemuDomainObjEnterRemote(virDomainObj *obj) + +void +qemuDomainObjEnterRemote(virDomainObj *obj) { VIR_DEBUG("Entering remote (vm=3D%p name=3D%s)", obj, obj->def->name); --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780067133; cv=none; d=zohomail.com; s=zohoarc; b=G2cYYk/VSPD16VM8a8tKo77IvR8iQsyiCfQxOEcwm+rTiIXLK2g97cMvA+Go+IPW4KGIkMU4CnLdhrgHPkkhzAcRHSgvNVFdQryv8Li6O/VYEncL6U4tx2Py/tqMNHhdlLaozwnHrHoGxXXKOFy+MAHu9H+oY8x5aD5D8I7pBA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780067133; 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=/t+/FxUUJyfDSNgiQdSCXTqg6Z97vmJYGylpSfJwCq4=; b=QHhoZEnrwsv2ZH+SxeVfY4dcG15jH9I34CyAcEEnkEclacFZk8pMUjErcVhzas7b8zcFBfMxOYFw5SIgaOQf4kRpKiTyaTFQ20E27Boe+WT8D0xyqN5rCJl32yluYhpK/aY3XKeKyQLdjXXe3f909tV7hwEYY8c3iG4qX7DfkhA= 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 1780067133525544.1359584365233; Fri, 29 May 2026 08:05:33 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E33FB41BF5; Fri, 29 May 2026 11:05:32 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id BFE2F43F0B; Fri, 29 May 2026 10:50:05 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B9C4841C36; Fri, 29 May 2026 10:49:54 -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 C536741C36 for ; Fri, 29 May 2026 10:47: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-81-uOk7SzojNzupteyx8A0siQ-1; Fri, 29 May 2026 10:47:16 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 9DF9F19560B6 for ; Fri, 29 May 2026 14:47:15 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EAFE41955F22 for ; Fri, 29 May 2026 14:47: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=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780066038; 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=/t+/FxUUJyfDSNgiQdSCXTqg6Z97vmJYGylpSfJwCq4=; b=fWKk/Lv00KVh/aHCao2FCyncKZmORlk7Ag7InaqcZDUCHyjJV7Ij2aPKiAyF1D/2KWVtRU T58EZRawKP8o3HDKvpbaKRWobZ/Q57WcZmwENEkKguZMHYS6MqC1cUA3hId5SizDl+3j1z Lq74ah4Wtd/Ndv4EuDQ0kbcEaEbcTfg= X-MC-Unique: uOk7SzojNzupteyx8A0siQ-1 X-Mimecast-MFC-AGG-ID: uOk7SzojNzupteyx8A0siQ_1780066035 To: devel@lists.libvirt.org Subject: [RFC patch 16/17] qemu: domain: Introduce APIs for unlocking domain object during potentially long running operations Date: Fri, 29 May 2026 16:46:53 +0200 Message-ID: <5b04ca708b9af9d1ae889e81048d3aaca554ce2c.1780063451.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 0r45a5HL-3qccxHoW5sKbg2ZiOYUXlS1aPYTiD5111s_1780066035 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: DILVJSU45JMIO3KI5L2WSXKKWPMXNT54 X-Message-ID-Hash: DILVJSU45JMIO3KI5L2WSXKKWPMXNT54 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: 1780067135786154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Similarly to how we enter monitor context, so that the VM object is unlocked while waiting for qemu, there are non-monitor operations where we might want to yield the domain object (while holding a JOB on the domain object) so that other threads are not blocked e.g. on looking upi a list of active domains. This basically copies the helpers to enter monitor minus locking of the monitor object. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 65 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 8 ++++++ 2 files changed, 73 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 9368ab916d..ea591e4c95 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5287,6 +5287,71 @@ qemuDomainObjExitRemote(virDomainObj *obj, } +/** + * qemuDomainObjEnterOperation: + * @obj: domain object + * + * @obj must be locked when this function is called. + * + * Enter a potentially long running operation on @vm. Unlocks @vm and allo= ws + * other threads to e.g. look up the object. + * + * This requires that virDomainObjBeginJob() was already called on @vm and + * checked that the VM is still active. + * + * To be followed with qemuDomainObjExitOperation() once complete + */ +int +qemuDomainObjEnterOperation(virDomainObj *obj, + virDomainAsyncJob asyncJob) +{ + if (asyncJob !=3D VIR_ASYNC_JOB_NONE) { + int ret; + if ((ret =3D virDomainObjBeginNestedJob(obj, asyncJob)) < 0) + return ret; + if (!virDomainObjIsActive(obj)) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("domain is no longer running")); + virDomainObjEndJob(obj); + return -1; + } + } else if (obj->job->asyncOwner =3D=3D virThreadSelfID()) { + VIR_WARN("This thread seems to be the async job owner; entering op= eration without asking for a nested job is dangerous"); + } else if (obj->job->owner !=3D virThreadSelfID()) { + VIR_WARN("Entering an operation without owning a job. Job %s owner= %s (%llu)", + virDomainJobTypeToString(obj->job->active), + obj->job->ownerAPI, obj->job->owner); + } + + VIR_DEBUG("Entering operation (vm=3D%p name=3D%s)", + obj, obj->def->name); + virObjectUnlock(obj); + + return 0; +} + + +/** + * qemuDomainObjExitOperation: + * @obj: domain object + * + * @obj must be *UNLOCKED* when this is called. + * + * Enter normal context on return from the long running operation started = by + * qemuDomainObjEnterOperation(). + */ +void +qemuDomainObjExitOperation(virDomainObj *obj) +{ + virObjectLock(obj); + VIR_DEBUG("Exited operation (vm=3D%p name=3D%s)", + obj, obj->def->name); + + if (obj->job->active =3D=3D VIR_JOB_ASYNC_NESTED) + virDomainObjEndJob(obj); +} + + static virDomainDef * qemuDomainDefFromXML(virQEMUDriver *driver, virQEMUCaps *qemuCaps, diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index ec1c2a4779..ad44e0cc2a 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -624,6 +624,14 @@ int qemuDomainObjExitRemote(virDomainObj *obj, bool checkActive) ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; + +int qemuDomainObjEnterOperation(virDomainObj *obj, + virDomainAsyncJob asyncJob) + ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; + +void qemuDomainObjExitOperation(virDomainObj *obj) + ATTRIBUTE_NONNULL(1); + virDomainDef *qemuDomainDefCopy(virQEMUDriver *driver, virQEMUCaps *qemuCaps, virDomainDef *src, --=20 2.54.0 From nobody Sat May 30 15:28:31 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=1780067223; cv=none; d=zohomail.com; s=zohoarc; b=mpyUAs6GGr+Zorf8aErdk2gBMTQkRiTEIpjtPFiQriWXrggQiLjKK/Uouu/eC14VB6MwHI0x/yrEVXqCPWrNu5bTuPcI4s8Fu97yXSeMpdFLo+fjwEyJRGM9d8p8HdxqAvCcCChG0cjhHaxBICEegr6m8ghTu6S5OUeStrWb+ow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780067223; 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=HuGCVce05x87+bWTDAIShAinZntX1ZYmY+TFGhJcNlw=; b=MJGQIQzrro9Co0AqqsBchZAGjxFjBYYACxenpfaWqmwLL0dcevzVTsAiWLDW0J3wtFbsRdbXBgOMFZKW9adTefWeP2NRMVflsF1WUjojJnWK0ODfYR1MGdC7vwRIcZaGYRm/AFvJilHuyjXqmMVMy6wxsjXvR+mKnSvemDqIzUI= 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 1780067223852846.3956133830937; Fri, 29 May 2026 08:07:03 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 7F6A141AB0; Fri, 29 May 2026 11:07:02 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 2693341CCA; Fri, 29 May 2026 10:50:40 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 387FB43ED6; Fri, 29 May 2026 10:50:30 -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 6F9FF41CDD for ; Fri, 29 May 2026 10:47: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-158-Zy6R01pDMPGV_hyy7IPPfg-1; Fri, 29 May 2026 10:47:17 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 C4D9F1800343 for ; Fri, 29 May 2026 14:47:16 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 13EAE1955F22 for ; Fri, 29 May 2026 14:47:15 +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=1780066041; 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=HuGCVce05x87+bWTDAIShAinZntX1ZYmY+TFGhJcNlw=; b=ZPaQ7KSOhG+Pa5MC0y+MCyTOrXRU1pAHq6aAQeBLX/2uneY73DrhkYYdMwXq/4AeeggvsY Q/qQZmujrOZblTOUfGGqNvVvKCXPiedt38839Uxws9MbDh74j7YZA6spidB260weot7n3E jT1b49foIhzBuGuxF58kTkau75prdng= X-MC-Unique: Zy6R01pDMPGV_hyy7IPPfg-1 X-Mimecast-MFC-AGG-ID: Zy6R01pDMPGV_hyy7IPPfg_1780066036 To: devel@lists.libvirt.org Subject: [RFC patch 17/17] qemuDomainStorageSourceProbeSize: Yield domain object while accessing storage Date: Fri, 29 May 2026 16:46:54 +0200 Message-ID: <5b8a88599adb4916ef26d0c4cdf8f9fd42d79452.1780063451.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: NhgE23HPvy0YC5KQWlmMnT2tOg7lo8X6_GW3yUqGaVk_1780066036 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: TJPFQRDRFGHIDO2HHDVP3FMX5TOXO33S X-Message-ID-Hash: TJPFQRDRFGHIDO2HHDVP3FMX5TOXO33S 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: 1780067225109158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Use 'qemuDomainObjEnterOperation' to unlock the domain object while accessing storage. In case when storage blocks this allows other jobs to fetch the domain object and get queued up. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ea591e4c95..d17f0dc0d6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11725,6 +11725,9 @@ qemuDomainStorageSourceProbeSize(virQEMUDriverConfi= g *cfg, if (virStorageSourceIsEmpty(src)) return 0; + if (qemuDomainObjEnterOperation(vm, VIR_ASYNC_JOB_NONE) < 0) + return -1; + if (qemuDomainStorageOpenStat(cfg, vm, src, &fd, &sb, true) <=3D 0) return -1; @@ -11741,6 +11744,8 @@ qemuDomainStorageSourceProbeSize(virQEMUDriverConfi= g *cfg, qemuDomainStorageCloseStat(src, &fd); + qemuDomainObjExitOperation(vm); + if (rc < 0 || buflen < 0) return -1; --=20 2.54.0