X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=PVE%2FStorage.pm;h=7b3dc701eccbada26fc93d6dc0b66e4ceec15847;hb=9f20a8a643aa30241b2be2d180fcf41ae53eda9b;hp=dee0d59e05893e3060151a786f77fdedd4b4aa94;hpb=ee302b1caab124f2ef57a3de944ad19949f59f5a;p=pve-storage.git diff --git a/PVE/Storage.pm b/PVE/Storage.pm index dee0d59..7b3dc70 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -587,7 +587,11 @@ sub vdisk_alloc { # lock shared storage return $plugin->cluster_lock_storage($storeid, $scfg->{shared}, undef, sub { - my $volname = $plugin->alloc_image($storeid, $scfg, $vmid, $fmt, $name, $size); + my $old_umask = umask(umask|0037); + my $volname = eval { $plugin->alloc_image($storeid, $scfg, $vmid, $fmt, $name, $size) }; + my $err = $@; + umask $old_umask; + die $err if $err; return "$storeid:$volname"; }); } @@ -683,9 +687,9 @@ sub template_list { $info = { volid => "$sid:iso/$1", format => 'iso' }; } elsif ($tt eq 'vztmpl') { - next if $fn !~ m!/([^/]+\.tar\.gz)$!; + next if $fn !~ m!/([^/]+\.tar\.([gx]z))$!; - $info = { volid => "$sid:vztmpl/$1", format => 'tgz' }; + $info = { volid => "$sid:vztmpl/$1", format => "t$2" }; } elsif ($tt eq 'backup') { next if $fn !~ m!/([^/]+\.(tar|tar\.gz|tar\.lzo|tgz|vma|vma\.gz|vma\.lzo))$!; @@ -878,14 +882,23 @@ sub storage_info { my $ids = $cfg->{ids}; my $info = {}; - + + my @ctypes = PVE::Tools::split_list($content); + my $slist = []; foreach my $storeid (keys %$ids) { - next if $content && !$ids->{$storeid}->{content}->{$content}; - next if !storage_check_enabled($cfg, $storeid, undef, 1); + my $want_ctype = 0; + foreach my $ctype (@ctypes) { + if ($ids->{$storeid}->{content}->{$ctype}) { + $want_ctype = 1; + last; + } + } + next if !$want_ctype; + my $type = $ids->{$storeid}->{type}; $info->{$storeid} = {