From: Fiona Ebner <f.ebner@proxmox.com>
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 [thread overview]
Message-ID: <20261109154341.215638-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20261109154341.215638-1-f.ebner@proxmox.com>
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 <f.ebner@proxmox.com>
---
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
next prev parent reply other threads:[~2026-11-09 15:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 15:39 [PATCH-SERIES storage/qemu-server/container 0/4] volume resize improvements, part 1 Fiona Ebner
2026-11-09 15:39 ` Fiona Ebner [this message]
2026-11-09 15:39 ` [PATCH storage 2/4] lvm: qcow2 resize: do not abort if LV size is already large enough Fiona Ebner
2026-11-09 15:39 ` [PATCH qemu-server 3/4] qm: disk resize: propagate exit status from worker Fiona Ebner
2026-11-09 15:39 ` [PATCH container 4/4] pct: " Fiona Ebner
2026-11-09 18:18 ` applied: [PATCH-SERIES storage/qemu-server/container 0/4] volume resize improvements, part 1 Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261109154341.215638-2-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox