X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=PVE%2FStorage.pm;h=ace3340179327a252c266c71a52e4c9f463653f1;hb=ffc31266da8854be3e9063d5f44dcbd1decbe4f9;hp=e109c02101bd873b473efa97d972ead7ffc2364e;hpb=bbadd1659d5067df851d8a0953511fa017372274;p=pve-storage.git diff --git a/PVE/Storage.pm b/PVE/Storage.pm index e109c02..ace3340 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -73,10 +73,8 @@ if ( -d '/usr/share/perl5/PVE/Storage/Custom' ) { require $file; # Check perl interface: - die "not derived from PVE::Storage::Plugin\n" - if !$modname->isa('PVE::Storage::Plugin'); - die "does not provide an api() method\n" - if !$modname->can('api'); + die "not derived from PVE::Storage::Plugin\n" if !$modname->isa('PVE::Storage::Plugin'); + die "does not provide an api() method\n" if !$modname->can('api'); # Check storage API version and that file is really storage plugin. my $version = $modname->api(); die "implements an API version newer than current ($version > " . APIVER . ")\n" @@ -84,11 +82,11 @@ if ( -d '/usr/share/perl5/PVE/Storage/Custom' ) { my $min_version = (APIVER - APIAGE); die "API version too old, please update the plugin ($version < $min_version)\n" if $version < $min_version; + # all OK, do import and register (i.e., "use") import $file; $modname->register(); - # If we got this far and the API version is not the same, make some - # noise: + # If we got this far and the API version is not the same, make some noise: warn "Plugin \"$modname\" is implementing an older storage API, an upgrade is recommended\n" if $version != APIVER; }; @@ -192,7 +190,7 @@ sub storage_check_enabled { # storage_can_replicate: # return true if storage supports replication -# (volumes alocated with vdisk_alloc() has replication feature) +# (volumes allocated with vdisk_alloc() has replication feature) sub storage_can_replicate { my ($cfg, $storeid, $format) = @_; @@ -936,7 +934,7 @@ sub vdisk_list { storage_check_enabled($cfg, $storeid) if ($storeid); - my $res = {}; + my $res = $storeid ? { $storeid => [] } : {}; # prepare/activate/refresh all storages @@ -963,12 +961,8 @@ sub vdisk_list { activate_storage_list($cfg, $storage_list, $cache); - # FIXME PVE 7.0: only scan storages with the correct content types - my $scan = defined($ctype) ? $storage_list : [ keys %{$ids} ]; - - foreach my $sid (@{$scan}) { + for my $sid ($storage_list->@*) { next if $storeid && $storeid ne $sid; - next if !storage_check_enabled($cfg, $sid, undef, 1); my $scfg = $ids->{$sid}; my $plugin = PVE::Storage::Plugin->lookup($scfg->{type}); @@ -1852,7 +1846,7 @@ sub get_bandwidth_limit { my ($operation, $storage_list, $override) = @_; # called for each limit (global, per-storage) with the 'default' and the - # $operation limit and should udpate $override for every limit affecting + # $operation limit and should update $override for every limit affecting # us. my $use_global_limits = 0; my $apply_limit = sub {