vdisk list: allow specifying content type
and only scan storages that support it if specified. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
26d7314be0
commit
2c5246e1ea
@ -932,7 +932,7 @@ sub vdisk_free {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub vdisk_list {
|
sub vdisk_list {
|
||||||
my ($cfg, $storeid, $vmid, $vollist) = @_;
|
my ($cfg, $storeid, $vmid, $vollist, $ctype) = @_;
|
||||||
|
|
||||||
my $ids = $cfg->{ids};
|
my $ids = $cfg->{ids};
|
||||||
|
|
||||||
@ -955,6 +955,7 @@ sub vdisk_list {
|
|||||||
next if $storeid && $storeid ne $sid;
|
next if $storeid && $storeid ne $sid;
|
||||||
next if !storage_check_enabled($cfg, $sid, undef, 1);
|
next if !storage_check_enabled($cfg, $sid, undef, 1);
|
||||||
my $content = $ids->{$sid}->{content};
|
my $content = $ids->{$sid}->{content};
|
||||||
|
next if defined($ctype) && !$content->{$ctype};
|
||||||
next if !($content->{rootdir} || $content->{images});
|
next if !($content->{rootdir} || $content->{images});
|
||||||
push @$storage_list, $sid;
|
push @$storage_list, $sid;
|
||||||
}
|
}
|
||||||
@ -965,7 +966,9 @@ sub vdisk_list {
|
|||||||
activate_storage_list($cfg, $storage_list, $cache);
|
activate_storage_list($cfg, $storage_list, $cache);
|
||||||
|
|
||||||
# FIXME PVE 7.0: only scan storages with the correct content types
|
# FIXME PVE 7.0: only scan storages with the correct content types
|
||||||
foreach my $sid (keys %$ids) {
|
my $scan = defined($ctype) ? $storage_list : [ keys %{$ids} ];
|
||||||
|
|
||||||
|
foreach my $sid (@{$scan}) {
|
||||||
next if $storeid && $storeid ne $sid;
|
next if $storeid && $storeid ne $sid;
|
||||||
next if !storage_check_enabled($cfg, $sid, undef, 1);
|
next if !storage_check_enabled($cfg, $sid, undef, 1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user