]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage.pm
fix #3307: make it possible to set protection for backups
[pve-storage.git] / PVE / Storage.pm
index 223fbb5b4e94cfc6fe3823507dd234c116012095..fdc21d9128281eb2c137fc5bb402ec6f16ccf18f 100755 (executable)
@@ -1456,6 +1456,12 @@ sub decompressor_info {
     return $info;
 }
 
+sub protection_file_path {
+    my ($path) = @_;
+
+    return "${path}.protected";
+}
+
 sub archive_info {
     my ($archive) = shift;
     my $info;
@@ -1487,6 +1493,9 @@ sub archive_info {
 sub archive_remove {
     my ($archive_path) = @_;
 
+    die "cannot remove protected archive '$archive_path'\n"
+       if -e protection_file_path($archive_path);
+
     my $dirname = dirname($archive_path);
     my $archive_info = eval { archive_info($archive_path) } // {};
     my $logfn = $archive_info->{logfilename};