[pve-devel] [PATCH storage v4] Fix #318: Delete vzdump log when deleting a backup

Dominic Jäger d.jaeger at proxmox.com
Tue Apr 9 09:41:25 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 Jäger <d.jaeger at proxmox.com>
---
No more error message if .log file was deleted before the backup.

 PVE/API2/Storage/Content.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PVE/API2/Storage/Content.pm b/PVE/API2/Storage/Content.pm
index e941cb6..4aa9daf 100644
--- a/PVE/API2/Storage/Content.pm
+++ b/PVE/API2/Storage/Content.pm
@@ -307,6 +307,13 @@ __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";
+	    if (-e $logpath) {
+		unlink($logpath);
+	    }
+	}
 
 	return undef;
     }});
-- 
2.11.0




More information about the pve-devel mailing list