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"
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;
};
# 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) = @_;
storage_check_enabled($cfg, $storeid) if ($storeid);
- my $res = {};
+ my $res = $storeid ? { $storeid => [] } : {};
# prepare/activate/refresh all storages
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});
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 {