From f5451f288dba1eec8d679193b66813fe0b693690 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 1 Mar 2017 12:03:40 +0100 Subject: [PATCH] remove immutable flag also for subvols on directory storage or else the removal of such templates (with rootfs size 0) fails Signed-off-by: Dominik Csapak --- 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"; }