mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
ensure that we pick an idle elb vm in the same pod as the ip
This commit is contained in:
parent
ec7c9a2f7e
commit
b4a6f2103a
@ -429,7 +429,12 @@ public class ElasticLoadBalancerManagerImpl implements
|
||||
private DomainRouterVO findELBVmWithCapacity(Network guestNetwork, IPAddressVO ipAddr) {
|
||||
List<DomainRouterVO> unusedElbVms = _elbVmMapDao.listUnusedElbVms();
|
||||
if (unusedElbVms.size() > 0) {
|
||||
return unusedElbVms.get(new Random().nextInt(unusedElbVms.size()));
|
||||
List<DomainRouterVO> candidateVms = new ArrayList<DomainRouterVO>();
|
||||
for (DomainRouterVO candidateVm: unusedElbVms) {
|
||||
if (candidateVm.getPodIdToDeployIn() == getPodIdForDirectIp(ipAddr))
|
||||
candidateVms.add(candidateVm);
|
||||
}
|
||||
return candidateVms.size()==0?null:candidateVms.get(new Random().nextInt(candidateVms.size()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user