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 <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak
2017-03-01 12:03:40 +01:00
committed by Fabian Grünbichler
parent 69e7407e45
commit f5451f288d

View File

@ -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";
}