]> git.proxmox.com Git - pve-storage.git/commitdiff
list_volumes: try to return vmid also for backups
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 21 Feb 2020 10:02:09 +0000 (11:02 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 21 Feb 2020 15:00:58 +0000 (16:00 +0100)
this way the content listing api also returns the vmid on content
listings which, among other things, is useful for the gui for
filtering

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/Storage/Plugin.pm

index fb06c3893dc08d1fe8aed60cb9f1b4544145761e..83bbf69af84766ae03838c2c5156cf9be828d9c4 100644 (file)
@@ -921,7 +921,13 @@ my $get_subdir_files = sub {
            next if defined($vmid) && $fn !~  m/\S+-$vmid-\S+/;
            next if $fn !~ m!/([^/]+\.(tar|tar\.gz|tar\.lzo|tgz|vma|vma\.gz|vma\.lzo))$!;
 
-           $info = { volid => "$sid:backup/$1", format => $2 };
+           my $format = $2;
+           $info = { volid => "$sid:backup/$1", format => $format };
+
+           if (defined($vmid) || $fn =~ m!\-([0-9]{3,})\-[^/]+\.${format}$!) {
+               $info->{vmid} = $vmid // $1;
+           }
+
 
        } elsif ($tt eq 'snippets') {