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. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0068da71 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0068da71 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0068da71 Branch: refs/heads/ui-restyle Commit: 0068da71985b9ad5e2a5e7706bf7fd3026b5d4e8 Parents: 52b0484 Author: Murali Reddy <[email protected]> Authored: Wed Nov 13 18:20:10 2013 +0530 Committer: Murali Reddy <[email protected]> Committed: Wed Nov 13 18:21:55 2013 +0530 ---------------------------------------------------------------------- .../ExternalLoadBalancerDeviceManagerImpl.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0068da71/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java index 8d54541..3e0cd77 100644 --- a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java +++ b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java @@ -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) {
