mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-02 13:14:11 +00:00
check_local_storage_availability: only count each unavailable storage once
and some general cleanup Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
c272ba8db3
commit
32075a2cb8
@ -3211,12 +3211,11 @@ __PACKAGE__->register_method({
|
||||
if (!$res->{running}) {
|
||||
$res->{allowed_nodes} = [];
|
||||
my $checked_nodes = PVE::QemuServer::check_local_storage_availability($vmconf, $storecfg);
|
||||
delete $checked_nodes->{$localnode};
|
||||
|
||||
delete $checked_nodes->{$localnode} if $checked_nodes->{$localnode};
|
||||
foreach my $node (keys %$checked_nodes) {
|
||||
if (!defined $checked_nodes->{$node}->{not_available_storages}){
|
||||
if (!defined $checked_nodes->{$node}->{unavailable_storages}) {
|
||||
push @{$res->{allowed_nodes}}, $node;
|
||||
delete $checked_nodes->{$node};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2942,18 +2942,24 @@ sub check_local_storage_availability {
|
||||
|
||||
if ($scfg->{disable}) {
|
||||
foreach my $node (keys %$nodehash) {
|
||||
push @{$nodehash->{$node}->{not_available_storages}}, $storeid;
|
||||
$nodehash->{$node}->{unavailable_storages}->{$storeid} = 1;
|
||||
}
|
||||
} elsif (my $avail = $scfg->{nodes}) {
|
||||
foreach my $node (keys %$nodehash) {
|
||||
if (!$avail->{$node}) {
|
||||
push @{$nodehash->{$node}->{not_available_storages}}, $storeid;
|
||||
$nodehash->{$node}->{unavailable_storages}->{$storeid} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
foreach my $node (values %$nodehash) {
|
||||
if (my $unavail = $node->{unavailable_storages}) {
|
||||
$node->{unavailable_storages} = [ sort keys %$unavail ];
|
||||
}
|
||||
}
|
||||
|
||||
return $nodehash
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user