[pve-devel] applied: Re: [PATCH storage 2/6] Expand archive_info to include ctime, vmid and is_std_name

Thomas Lamprecht t.lamprecht at proxmox.com
Sat Jun 6 19:42:12 CEST 2020


On 6/4/20 11:08 AM, Fabian Ebner wrote:
> where 'is_std_name' shows whether the backup name uses the standard naming
> schema and most likely was created by our tools.
> 
> Also adds a '^' to the existing filename matching regex, which
> should be fine since basename() is used beforehand.
> 
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
>  PVE/Storage.pm            | 17 ++++++++++++++---
>  PVE/Storage/Plugin.pm     | 11 ++++-------
>  test/archive_info_test.pm | 10 ++++++++++
>  3 files changed, 28 insertions(+), 10 deletions(-)
> 
>

applied, thanks!

> diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
> @@ -942,21 +941,19 @@ my $get_subdir_files = sub {
>  	} elsif ($tt eq 'backup') {
>  	    next if defined($vmid) && $fn !~  m/\S+-$vmid-\S+/;
>  	    next if $fn !~ m!/([^/]+\.(tgz|(?:(?:tar|vma)(?:\.(${\COMPRESSOR_RE}))?)))$!;
> -
>  	    my $format = $2;
>  	    $fn = $1;
>  	    $info = { volid => "$sid:backup/$fn", format => $format };
>  
> -	    if ($fn =~ m!^vzdump\-(?:lxc|qemu)\-(?:[1-9][0-9]{2,8})\-(\d{4})_(\d{2})_(\d{2})\-(\d{2})_(\d{2})_(\d{2})\.${format}$!) {
> -		my $epoch = timelocal($6, $5, $4, $3, $2-1, $1 - 1900);
> -		$info->{ctime} = $epoch;
> -	    }
> +	    my $archive_info = eval { PVE::Storage::archive_info($fn) };

added fallback to empty hash here (// {}) to avoid checking definedness below.




More information about the pve-devel mailing list