]> git.proxmox.com Git - pve-storage.git/commitdiff
base plugin: add ctime for backup files
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 4 Mar 2020 10:46:17 +0000 (11:46 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 6 Mar 2020 18:26:45 +0000 (19:26 +0100)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
PVE/Storage/Plugin.pm

index eab73f527a7f0aeb085111eefdda5c7ce6ec3314..bd4bb8ccd279a0d7e94ea2170b146b61e48542a6 100644 (file)
@@ -6,6 +6,7 @@ use warnings;
 use File::chdir;
 use File::Path;
 use File::Basename;
+use Time::Local qw(timelocal);
 
 use PVE::Tools qw(run_command);
 use PVE::JSONSchema qw(get_standard_option);
@@ -924,6 +925,11 @@ my $get_subdir_files = sub {
            my $format = $2;
            $info = { volid => "$sid:backup/$1", 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;
+           }
+
            if (defined($vmid) || $fn =~ m!\-([1-9][0-9]{2,8})\-[^/]+\.${format}$!) {
                $info->{vmid} = $vmid // $1;
            }