From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 608A91FF09B for ; Mon, 09 Nov 2026 16:43:54 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id DCE83215C7; Mon, 09 Nov 2026 16:43:49 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH storage 1/4] lvm: factor out helper for querying LV size Date: Mon, 9 Nov 2026 16:39:34 +0100 Message-ID: <20261109154341.215638-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261109154341.215638-1-f.ebner@proxmox.com> References: <20261109154341.215638-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794239024955 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.287 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 4WB5ABB6PG3KZ4IXWW6O4DJ64XFHPI5R X-Message-ID-Hash: 4WB5ABB6PG3KZ4IXWW6O4DJ64XFHPI5R X-MailFrom: f.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; 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: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: No functional change intended. To be used for checking the size of the LV underlying a qcow2 volume at the beginning of a resize operation. Signed-off-by: Fiona Ebner --- src/PVE/Storage/LVMPlugin.pm | 54 ++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm index 0ab9dc2d..53120e47 100644 --- a/src/PVE/Storage/LVMPlugin.pm +++ b/src/PVE/Storage/LVMPlugin.pm @@ -406,6 +406,35 @@ sub lvm_list_volumes { return $lvs; } +my sub lvm_lv_size_info { + my ($path, $timeout) = @_; + + my $cmd = [ + '/sbin/lvs', + '--separator', + ':', + '--noheadings', + '--units', + 'b', + '--unbuffered', + '--nosuffix', + '--options', + 'lv_size', + $path, + ]; + + my $size; + run_command( + $cmd, + timeout => $timeout, + errmsg => "can't get size of '$path'", + outfunc => sub { + $size = int(shift); + }, + ); + return wantarray ? ($size, 'raw', 0, undef) : $size; +} + # Acquire the storage lock for a cleanup step of volume or snapshot removal, retrying the # acquisition so transient lock contention on a busy cluster does not leave a half-removed volume # behind. Only the acquisition is retried; $code_started keeps a failure inside the locked section @@ -1694,30 +1723,7 @@ sub volume_size_info { return PVE::Storage::Plugin::file_size_info($path, $timeout, $format) if $format eq 'qcow2'; - my $cmd = [ - '/sbin/lvs', - '--separator', - ':', - '--noheadings', - '--units', - 'b', - '--unbuffered', - '--nosuffix', - '--options', - 'lv_size', - $path, - ]; - - my $size; - run_command( - $cmd, - timeout => $timeout, - errmsg => "can't get size of '$path'", - outfunc => sub { - $size = int(shift); - }, - ); - return wantarray ? ($size, 'raw', 0, undef) : $size; + return lvm_lv_size_info($path, $timeout); } my sub volume_snapshot_locked { -- 2.47.3