[pve-devel] [PATCH storage] remove immutable flag also for subvols on directory storage

Dominik Csapak d.csapak at proxmox.com
Wed Mar 1 12:03:40 CET 2017


or else the removal of such templates (with rootfs size 0) fails

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/Storage/Plugin.pm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 6e73547..31b8541 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -597,6 +597,12 @@ sub free_image {
 
     my $path = $class->filesystem_path($scfg, $volname);
 
+    if ($isBase) {
+	# try to remove immutable flag
+	eval { run_command(['/usr/bin/chattr', '-i', $path]); };
+	warn $@ if $@;
+    }
+
     if (defined($format) && ($format eq 'subvol')) {
 	File::Path::remove_tree($path);
     } else {
@@ -606,12 +612,6 @@ sub free_image {
 	    return undef;
 	}
 
-	if ($isBase) {
-	    # try to remove immutable flag
-	    eval { run_command(['/usr/bin/chattr', '-i', $path]); };
-	    warn $@ if $@;
-	}
-
 	unlink($path) || die "unlink '$path' failed - $!\n";
     }
     
-- 
2.1.4





More information about the pve-devel mailing list