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.tschlatsc...@proxmox.com>

Only found small nits, so consider the series:
Reviewed-by: Fabian Ebner <f.eb...@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";
>       }
>      }
>  }


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to