include not yet routed servers as failover target candidate

main
lub 3 years ago
parent 63718d81a1
commit 918522f4d0

@ -11,12 +11,12 @@ $offlineAddressList = $failoverAddressList | Where-Object active_server_ip -noti
$maximumAddressCount = [Math]::Ceiling($failoverAddressList.Count / $onlineNodeList.Count) $maximumAddressCount = [Math]::Ceiling($failoverAddressList.Count / $onlineNodeList.Count)
$i = 0 $i = 0
$addressGroupList = $failoverAddressList ` $addressGroupList = $failoverAddressList+($onlineNodeList.Status.Addr | ForEach-Object {@{active_server_ip=$_}}) `
| Where-Object active_server_ip -in $onlineNodeList.Status.Addr ` | Where-Object active_server_ip -in $onlineNodeList.Status.Addr `
| Group-Object active_server_ip ` | Group-Object active_server_ip `
| Sort-Object Count | Sort-Object Count
$distributionTarget = :distribution foreach ($addressGroup in $addressGroupList) { $distributionTarget = :distribution foreach ($addressGroup in $addressGroupList) {
$currentAddressCount = $addressGroup.Count $currentAddressCount = $addressGroup.Count - 1
while ($currentAddressCount -lt $maximumAddressCount) { while ($currentAddressCount -lt $maximumAddressCount) {
if (!$offlineAddressList[$i]) { if (!$offlineAddressList[$i]) {