From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH storage 4/8] fix #6819: lvm plugin: list images: use approximate size for inactive qcow2 volumes
Date: Wed, 13 May 2026 15:05:36 +0200 [thread overview]
Message-ID: <20260513130548.143270-5-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260513130548.143270-1-f.ebner@proxmox.com>
For qcow2 volumes on LVM, the exact size can only be queried when the
LV is active. For a shared LVM, an LV might already be active on
another node, so it must not be activated. Also, doing so for each
volume would be costly. Instead, return only the approximate size when
the LV is inactive.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/Storage/LVMPlugin.pm | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index 3a35e38..4564f5b 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -833,19 +833,28 @@ sub list_images {
}
my $format = ($class->parse_volname($volname))[6];
- my $size =
- $format eq 'qcow2'
- ? $class->volume_size_info($scfg, $storeid, $volname)
- : $info->{lv_size};
+ my $entry = {
+ volid => $volid,
+ format => $format,
+ vmid => $owner,
+ ctime => $info->{ctime},
+ };
- push @$res,
- {
- volid => $volid,
- format => $format,
- size => $size,
- vmid => $owner,
- ctime => $info->{ctime},
- };
+ if ($format eq 'qcow2') {
+ my $size;
+ if ($info->{lv_state} eq 'a') {
+ $size = $class->volume_size_info($scfg, $storeid, $volname);
+ }
+ if (defined($size)) {
+ $entry->{size} = $size;
+ } else {
+ $entry->{'approximate-size'} = $info->{lv_size};
+ }
+ } else {
+ $entry->{size} = $info->{lv_size};
+ }
+
+ push @$res, $entry;
}
}
--
2.47.3
next prev parent reply other threads:[~2026-05-13 13:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 13:05 [PATCH-SERIES storage/manager/container/qemu-server 0/8] fix #6819: lvm plugin: list images: use approximate size for inactive qcow2 volumes Fiona Ebner
2026-05-13 13:05 ` [PATCH storage 1/8] api: content: add missing imports and group/order according to style guide Fiona Ebner
2026-05-13 13:05 ` [PATCH storage 2/8] pvesm: " Fiona Ebner
2026-05-13 13:05 ` [PATCH storage 3/8] api/cli: list content: declare size optional and add approximate-size Fiona Ebner
2026-05-13 13:05 ` Fiona Ebner [this message]
2026-05-13 13:05 ` [PATCH manager 5/8] fix #6819: storage: content view: fallback to approximate size Fiona Ebner
2026-05-13 13:05 ` [PATCH container 6/8] volume rescan: also consider zero-sized volumes Fiona Ebner
2026-05-13 13:05 ` [PATCH container 7/8] volume rescan: also consider volumes listed only with an approximate size Fiona Ebner
2026-05-13 13:05 ` [PATCH qemu-server 8/8] " Fiona Ebner
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=20260513130548.143270-5-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