* [pve-devel] [PATCH storage] lvm thin plugin: pass format to find_free_diskname() to avoid cosmetic warning
@ 2025-07-18 13:45 Fiona Ebner
0 siblings, 0 replies; only message in thread
From: Fiona Ebner @ 2025-07-18 13:45 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-07-18 13:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-18 13:45 [pve-devel] [PATCH storage] lvm thin plugin: pass format to find_free_diskname() to avoid cosmetic warning Fiona Ebner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox