public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH storage] btrfs: fix handling of non-images volumes
@ 2024-12-11 13:48 Fabian Grünbichler
  2024-12-11 14:01 ` [pve-devel] applied: " Fiona Ebner
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2024-12-11 13:48 UTC (permalink / raw)
  To: pve-devel

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 <f.gruenbichler@proxmox.com>
---
 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);
     }
 
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-11 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-11 13:48 [pve-devel] [PATCH storage] btrfs: fix handling of non-images volumes Fabian Grünbichler
2024-12-11 14:01 ` [pve-devel] applied: " Fiona Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal