From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage 2/3] fix #6587: lvm plugin: snapshot info: fix parsing snapshot name
Date: Wed, 30 Jul 2025 18:20:56 +0200 [thread overview]
Message-ID: <20250730162117.160498-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250730162117.160498-1-f.ebner@proxmox.com>
Volume names are allowed to contain underscores, so it is impossible
to determine the snapshot name from just the volume name, e.g:
snap_vm-100-disk_with_underscore_here_s_some_more.qcow2
Therefore, pass along the short volume name too and match against it.
Note that none of the variables from the result of parse_volname()
were actually used previously.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/Storage/LVMPlugin.pm | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index 705585f..2026450 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -470,9 +470,11 @@ my sub get_snap_name {
}
my sub parse_snap_name {
- my ($name) = @_;
+ my ($name, $short_volname) = @_;
- if ($name =~ m/^snap_\S+_(.*)\.qcow2$/) {
+ $short_volname =~ s/\.(qcow2)$//;
+
+ if ($name =~ m/^snap_\Q$short_volname\E_(.*)\.qcow2$/) {
return $1;
}
}
@@ -799,11 +801,13 @@ sub status {
sub volume_snapshot_info {
my ($class, $scfg, $storeid, $volname) = @_;
+ my $short_volname = ($class->parse_volname($volname))[1];
+
my $get_snapname_from_path = sub {
my ($path) = @_;
my $name = basename($path);
- if (my $snapname = parse_snap_name($name)) {
+ if (my $snapname = parse_snap_name($name, $short_volname)) {
return $snapname;
} elsif ($name eq $volname) {
return 'current';
@@ -812,8 +816,6 @@ sub volume_snapshot_info {
};
my $path = $class->filesystem_path($scfg, $volname);
- my ($vtype, $name, $vmid, $basename, $basevmid, $isBase, $format) =
- $class->parse_volname($volname);
my $json = PVE::Storage::Common::qemu_img_info($path, undef, 10, 1);
die "failed to query file information with qemu-img\n" if !$json;
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-07-30 16:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-30 16:20 [pve-devel] [PATCH-SERIES storage 0/3] " Fiona Ebner
2025-07-30 16:20 ` [pve-devel] [PATCH storage 1/3] lvm plugin: snapshot info: avoid superfluous argument for closure Fiona Ebner
2025-07-30 16:20 ` Fiona Ebner [this message]
2025-07-30 16:20 ` [pve-devel] [PATCH storage 3/3] lvm plugin: volume snapshot: actually print error when renaming Fiona Ebner
2025-07-30 17:29 ` [pve-devel] [PATCH-SERIES storage 0/3] fix #6587: lvm plugin: snapshot info: fix parsing snapshot name Max R. Carrara
2025-07-30 17:36 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-31 8:34 ` Fiona Ebner
2025-07-31 8:50 ` 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=20250730162117.160498-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.