[pve-devel] [PATCH v2 storage 03/13] Add archive_remove
Fabian Ebner
f.ebner at proxmox.com
Wed Jun 10 13:23:54 CEST 2020
to keep the removal of the archive and its log file together.
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
New in v2
PVE/Storage.pm | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index ac0dccd..a459572 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -1418,6 +1418,17 @@ sub archive_info {
return $info;
}
+sub archive_remove {
+ my ($archive_path) = @_;
+
+ my $dirname = dirname($archive_path);
+ my $archive_info = eval { archive_info($archive_path) } // {};
+ my $logfn = $archive_info->{logfilename};
+
+ unlink $archive_path;
+ unlink "$dirname/$logfn" if defined($logfn);
+}
+
sub extract_vzdump_config_tar {
my ($archive, $conf_re) = @_;
--
2.20.1
More information about the pve-devel
mailing list