CLOUDSTACK-5142: Guest IP address for F5 is not being selected from the

defined IP Range in Shared Network

ensure that for shared network, acuqire guest ip should return IP from
the 'startip'-'endip' range of the network.
This commit is contained in:
Murali Reddy 2013-11-13 18:20:10 +05:30
parent 52b0484812
commit 0068da7198
1 changed files with 14 additions and 1 deletions

View File

@ -778,7 +778,20 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
String loadBalancingIpAddress = existedGuestIp;
if (loadBalancingIpAddress == null) {
loadBalancingIpAddress = _ipAddrMgr.acquireGuestIpAddress(network, null);
if (network.getGuestType() == Network.GuestType.Isolated) {
loadBalancingIpAddress = _ipAddrMgr.acquireGuestIpAddress(network, null);
} else if (network.getGuestType() == Network.GuestType.Shared) {
try {
PublicIp directIp = _ipAddrMgr.assignPublicIpAddress(network.getDataCenterId(),
null, _accountDao.findById(network.getAccountId()), VlanType.DirectAttached, network.getId(),
null, true);
loadBalancingIpAddress = directIp.getAddress().addr();
} catch (InsufficientCapacityException capException) {
String msg = "Ran out of guest IP addresses from the shared network.";
s_logger.error(msg);
throw new ResourceUnavailableException(msg, DataCenter.class, network.getDataCenterId());
}
}
}
if (loadBalancingIpAddress == null) {