[pve-devel] [PATCH v3 storage] Fix #318: Delete vzdump log when deleting a backup
Dominic Jaeger
d.jaeger at proxmox.com
Fri Apr 5 11:30:00 CEST 2019
Vzdump log files were not deleted when a backup was deleted.
Consequently, the folder continuously filled with .log files.
Now they get deleted after the backup is removed.
Signed-off-by: Dominic Jaeger <d.jaeger at proxmox.com>
---
Add regex guard
Remove the dependency for suffix and fileparse
Improve variable handling
PVE/API2/Storage/Content.pm | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/PVE/API2/Storage/Content.pm b/PVE/API2/Storage/Content.pm
index e941cb6..748f755 100644
--- a/PVE/API2/Storage/Content.pm
+++ b/PVE/API2/Storage/Content.pm
@@ -307,6 +307,11 @@ __PACKAGE__->register_method ({
}
PVE::Storage::vdisk_free ($cfg, $volid);
+ if ($vtype eq 'backup' && $path =~
+ /(.*\/vzdump-\w+-\d+-\d{4}_\d{2}_\d{2}-\d{2}_\d{2}_\d{2})[^\/]+$/) {
+ my $logpath = "$1.log";
+ unlink($logpath) || die "unlink '$logpath' failed - $!\n";
+ }
return undef;
}});
--
2.11.0
More information about the pve-devel
mailing list