[pve-devel] [PATCH storage] lvm thin plugin: pass format to find_free_diskname() to avoid cosmetic warning
Fiona Ebner
f.ebner at proxmox.com
Fri Jul 18 15:45:32 CEST 2025
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 at proxmox.com>
Reported-by: Markus Frank <m.frank at proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner at 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
More information about the pve-devel
mailing list