From 652154c0b04abc18e3acb61d0059a449b8bfb874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Wed, 11 Dec 2024 14:48:36 +0100 Subject: [PATCH] btrfs: fix handling of non-images volumes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit previously, only 'images' returned a format, now other volume types do too, so differentiate where needed. reported on the forum: https://forum.proxmox.com/threads/158888/ Signed-off-by: Fabian Grünbichler --- src/PVE/Storage/BTRFSPlugin.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PVE/Storage/BTRFSPlugin.pm b/src/PVE/Storage/BTRFSPlugin.pm index def51ef..cadd9d1 100644 --- a/src/PVE/Storage/BTRFSPlugin.pm +++ b/src/PVE/Storage/BTRFSPlugin.pm @@ -196,13 +196,13 @@ sub filesystem_path { $path .= "/$vmid" if $vtype eq 'images'; - if (defined($format) && $format eq 'raw') { + if ($vtype eq 'images' && defined($format) && $format eq 'raw') { my $dir = raw_name_to_dir($name); if ($snapname) { $dir .= "\@$snapname"; } $path .= "/$dir/disk.raw"; - } elsif (defined($format) && $format eq 'subvol') { + } elsif ($vtype eq 'images' && defined($format) && $format eq 'subvol') { $path .= "/$name"; if ($snapname) { $path .= "\@$snapname"; @@ -422,10 +422,10 @@ my sub foreach_subvol : prototype($$) { sub free_image { my ($class, $storeid, $scfg, $volname, $isBase, $_format) = @_; - my (undef, undef, $vmid, undef, undef, undef, $format) = + my ($vtype, undef, $vmid, undef, undef, undef, $format) = $class->parse_volname($volname); - if (!defined($format) || ($format ne 'subvol' && $format ne 'raw')) { + if (!defined($format) || $vtype ne 'images' || ($format ne 'subvol' && $format ne 'raw')) { return $class->SUPER::free_image($storeid, $scfg, $volname, $isBase, $_format); }