From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage] lvm thin plugin: pass format to find_free_diskname() to avoid cosmetic warning
Date: Fri, 18 Jul 2025 15:45:32 +0200 [thread overview]
Message-ID: <20250718134613.147665-1-f.ebner@proxmox.com> (raw)
Since commit eda88c9 ("lvmplugin: add qcow2 snapshot"), the LVM
plugin's find_free_diskname() method assumes that the format is set
and compares it against a fixed string. When the argument is not set,
the method would still behave correctly, but Perl produces a warning.
Always pass along the format to find_free_diskname() to fix it.
Reported-by: Stefan Hanreich <s.hanreich@proxmox.com>
Reported-by: Markus Frank <m.frank@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/Storage/LvmThinPlugin.pm | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/PVE/Storage/LvmThinPlugin.pm b/src/PVE/Storage/LvmThinPlugin.pm
index 6f8a92e..3854e6c 100644
--- a/src/PVE/Storage/LvmThinPlugin.pm
+++ b/src/PVE/Storage/LvmThinPlugin.pm
@@ -109,7 +109,7 @@ sub alloc_image {
die "no such volume group '$vg'\n" if !defined($vgs->{$vg});
- $name = $class->find_free_diskname($storeid, $scfg, $vmid)
+ $name = $class->find_free_diskname($storeid, $scfg, $vmid, $fmt)
if !$name;
my $cmd = [
@@ -297,17 +297,17 @@ sub clone_image {
my $lv;
+ my ($isBase, $format) = ($class->parse_volname($volname))[5,6];
+
if ($snap) {
$lv = "$vg/snap_${volname}_$snap";
} else {
- my ($vtype, undef, undef, undef, undef, $isBase, $format) = $class->parse_volname($volname);
-
die "clone_image only works on base images\n" if !$isBase;
$lv = "$vg/$volname";
}
- my $name = $class->find_free_diskname($storeid, $scfg, $vmid);
+ my $name = $class->find_free_diskname($storeid, $scfg, $vmid, $format);
my $cmd = ['/sbin/lvcreate', '-n', $name, '-prw', '-kn', '-s', $lv];
run_command($cmd, errmsg => "clone image '$lv' error");
@@ -449,7 +449,7 @@ sub volume_import {
die "volume $vg/$volname already exists\n" if !$allow_rename;
warn "volume $vg/$volname already exists - importing with a different name\n";
- $tempname = $class->find_free_diskname($storeid, $scfg, $vmid);
+ $tempname = $class->find_free_diskname($storeid, $scfg, $vmid, $file_format);
} else {
$tempname = $volname;
$tempname =~ s/base/vm/;
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
reply other threads:[~2025-07-18 13:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250718134613.147665-1-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.