all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com, d.tschlatscher@proxmox.com
Subject: Re: [pve-devel] [PATCH storage] Remove the .notes file when a backup is deleted
Date: Wed, 11 May 2022 09:37:30 +0200	[thread overview]
Message-ID: <8f5059ca-d288-9cc4-71d4-9c145dde5e0e@proxmox.com> (raw)
In-Reply-To: <20220510120937.83344-1-d.tschlatscher@proxmox.com>

Commit title should include "fixes #3972"

Please note that there's also an archive_remove() function in Storage.pm
which is called when pruning. That (and I'd say archive_info() too)
should be extended to also handle the notes file.

Am 10.05.22 um 14:09 schrieb Daniel Tschlatscher:
> When a VM or Container was deleted, the .notes file was not removed,

Nit: should be "VM or Container backup"

> 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})[^\/]+$/) {

It would be nice if we could simply switch to calling archive_remove()
here for non-PBS, but that might break interaction with external
plugins. But maybe we can at least re-use archive_info() to match the
path and get the log and notes file names.

>  		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;
>  	    }
>  	};
>  




      reply	other threads:[~2022-05-11  7:38 UTC|newest]

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

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=8f5059ca-d288-9cc4-71d4-9c145dde5e0e@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=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