From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com, d.tschlatscher@proxmox.com
Subject: Re: [pve-devel] [PATCH storage v3 1/4] fix #3972: Remove the .notes file when a backup is deleted
Date: Mon, 13 Jun 2022 10:33:50 +0200 [thread overview]
Message-ID: <a170eb53-2592-7f5f-144a-e33ece087017@proxmox.com> (raw)
In-Reply-To: <20220520132859.144041-1-d.tschlatscher@proxmox.com>
Am 20.05.22 um 15:28 schrieb Daniel Tschlatscher:
> When a VM or Container backup was deleted, the .notes file was not
> removed, therefore, over time the dump folder would get polluted with
> notes for 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.
>
> Furthermore, I sourced the deletion of the log and notes file into a
> new function called "archive_auxiliaries_remove". Additionally, the
> archive_info object now returns one more field containing the name of
> the notes file. The test cases have to be adapted to expect this new
> value as the package will not compile otherwise.
>
> Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
Only found small nits, so consider the series:
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
> @@ -1585,16 +1586,25 @@ sub archive_remove {
> die "cannot remove protected archive '$archive_path'\n"
> if -e protection_file_path($archive_path);
>
> + unlink $archive_path or die "removing archive $archive_path failed: $!\n";
> +
> + archive_auxiliaries_remove($archive_path);
> +}
> +
> +sub archive_auxiliaries_remove {
> + my ($archive_path) = @_;
> +
> my $dirname = dirname($archive_path);
> my $archive_info = eval { archive_info($archive_path) } // {};
> my $logfn = $archive_info->{logfilename};
> + my $notesfn = $archive_info->{notesfilename};
Both $logfn and $notesfn are unused.
>
> - unlink $archive_path or die "removing archive $archive_path failed: $!\n";
> + for my $type (qw(log notes)) {
> + my $filename = $archive_info->{"${type}filename"} or next;
> + my $path = "$dirname/$filename";
>
> - if (defined($logfn)) {
> - my $logpath = "$dirname/$logfn";
> - if (-e $logpath) {
> - unlink $logpath or warn "removing log file $logpath failed: $!\n";
> + if (-e $path) {
> + unlink $path or warn "Removing $type file failed: $!\n";
> }
> }
> }
prev parent reply other threads:[~2022-06-13 8:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 13:28 Daniel Tschlatscher
2022-05-20 13:28 ` [pve-devel] [PATCH storage v3 2/4] fix #3972: Adapted unlink calls for archive files in case of ENOENT Daniel Tschlatscher
2022-06-13 8:34 ` Fabian Ebner
2022-05-20 13:28 ` [pve-devel] [PATCH storage v3 3/4] fix #3972: Switched to using log_warn of PVE::RESTEnvironment Daniel Tschlatscher
2022-06-13 8:34 ` Fabian Ebner
2022-05-20 13:28 ` [pve-devel] [PATCH storage v3 4/4] Added a LOG_EXT constant as a counterpart to NOTES_EXT Daniel Tschlatscher
2022-06-13 8:34 ` Fabian Ebner
2022-05-25 15:06 ` [pve-devel] [PATCH storage v3 1/4] fix #3972: Remove the .notes file when a backup is deleted Thomas Lamprecht
2022-05-25 16:25 ` Daniel Tschlatscher
2022-06-13 8:33 ` 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=a170eb53-2592-7f5f-144a-e33ece087017@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.