Cloudstack-2732 [Multiple_IP_Ranges] Deleting guest IP range is not throwing any error message to user while the ip addresses are being used
Signed-off-by: Jayapal <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/97424599 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/97424599 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/97424599 Branch: refs/heads/master Commit: 974245991c4c3fe51e63fe18b19853f5f8a0c6fa Parents: 6b0df25 Author: Bharat Kumar <[email protected]> Authored: Thu Jun 27 19:12:20 2013 +0530 Committer: Jayapal <[email protected]> Committed: Fri Jun 28 19:05:55 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/configuration/ConfigurationManagerImpl.java | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97424599/server/src/com/cloud/configuration/ConfigurationManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 51c323d..3840c12 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -3267,6 +3267,10 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } else { ipAlias = _nicIpAliasDao.findByGatewayAndNetworkIdAndState(vlanRange.getVlanGateway(), vlanRange.getNetworkId(), NicIpAlias.state.active); + if (ipAlias == null) { + throw new InvalidParameterValueException ("Cannot delete this range as some of the Ips are in use."); + } + //check if this ip belongs to this vlan and is allocated. ip = _publicIpAddressDao.findByIpAndVlanId(ipAlias.getIp4Address(), vlanDbId); if (ip != null && ip.getState() == IpAddress.State.Allocated) {
