From b1f9d990178741a71b2ef7adb9e3a4a8b9932ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominic=20J=C3=A4ger?= Date: Tue, 9 Apr 2019 09:41:25 +0200 Subject: [PATCH] Fix #318: Delete vzdump log when deleting a backup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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; }});