all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage] Remove the .notes file when a backup is deleted
Date: Tue, 10 May 2022 14:09:37 +0200	[thread overview]
Message-ID: <20220510120937.83344-1-d.tschlatscher@proxmox.com> (raw)

When a VM or Container was deleted, the .notes file was not removed,
therefore, over time the dump folder would get polluted with notes of
backups that no longer existed.
As backup names contain a timestamp and as the notes cannot be reused
because of this, I think it is safe to just delete them just like we
do with the .log file.

Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
---
 PVE/API2/Storage/Content.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/PVE/API2/Storage/Content.pm b/PVE/API2/Storage/Content.pm
index 8ff858d..3f9d77f 100644
--- a/PVE/API2/Storage/Content.pm
+++ b/PVE/API2/Storage/Content.pm
@@ -457,8 +457,11 @@ __PACKAGE__->register_method ({
 	    if ($vtype eq 'backup'
 		&& $path =~ /(.*\/vzdump-\w+-\d+-\d{4}_\d{2}_\d{2}-\d{2}_\d{2}_\d{2})[^\/]+$/) {
 		my $logpath = "$1.log";
+		my $notespath = "$path.notes";
 		# try to cleanup our backup log file too, if still existing, #318
 		unlink($logpath) if -e $logpath;
+		# also cleanup the .notes file if it still exists, #3972
+		unlink($notespath) if -e $notespath;
 	    }
 	};
 
-- 
2.30.2





             reply	other threads:[~2022-05-10 12:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 12:09 Daniel Tschlatscher [this message]
2022-05-11  7:37 ` Fabian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220510120937.83344-1-d.tschlatscher@proxmox.com \
    --to=d.tschlatscher@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal