use chattr to set immutable flag on base images
This commit is contained in:
@ -449,7 +449,13 @@ sub create_base {
|
|||||||
rename($path, $newpath) ||
|
rename($path, $newpath) ||
|
||||||
die "rename '$path' to '$newpath' failed - $!\n";
|
die "rename '$path' to '$newpath' failed - $!\n";
|
||||||
|
|
||||||
chmod(0444, $newpath);
|
# We try to protect base volume
|
||||||
|
|
||||||
|
chmod(0444, $newpath); # nobody should write anything
|
||||||
|
|
||||||
|
# also try to set immutable flag
|
||||||
|
eval { run_command(['/usr/bin/chattr', '+i', $newpath]); };
|
||||||
|
warn $@ if $@;
|
||||||
|
|
||||||
return $newvolname;
|
return $newvolname;
|
||||||
}
|
}
|
||||||
@ -575,9 +581,13 @@ sub free_image {
|
|||||||
"(use by '$tmpvolname')\n";
|
"(use by '$tmpvolname')\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# try to remove immutable flag
|
||||||
|
eval { run_command(['/usr/bin/chattr', '-i', $path]); };
|
||||||
|
warn $@ if $@;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink $path;
|
unlink($path) || die "unlink '$path' failed - $!\n";
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user