CLOUDSTACK-2105.

While releasing an IP range from an acount if any of the Public IPs in the range is a source nat ip then the IP is not disassociated.
During the check CS also checks if the network the IP is associted with is not null. This results in an NPE for an account that has VPC s
because the public IP of a VPC domain router is common to all VPC tiers and not associated with a network
Remove the check to find the network associted with a source nat IP for both ReleasePublicIpRange and DeleteVlanPublicIpRange
This commit is contained in:
Likitha Shetty 2013-04-19 23:16:47 +05:30
parent ff4a4876c7
commit 8d8a0ebe10
1 changed files with 4 additions and 5 deletions

View File

@ -2673,9 +2673,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
" as ip " + ip + " belonging to the range is used for static nat purposes. Cleanup the rules first");
}
if (ip.isSourceNat() && _networkModel.getNetwork(ip.getAssociatedWithNetworkId()) != null) {
throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId +
" as ip " + ip + " belonging to the range is a source nat ip for the network id=" + ip.getSourceNetworkId() +
if (ip.isSourceNat()) {
throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId +
" as ip " + ip + " belonging to the range is a source nat ip for the network id=" + ip.getSourceNetworkId() +
". IP range with the source nat ip address can be removed either as a part of Network, or account removal");
}
@ -2829,8 +2829,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
List<IPAddressVO> ips = _publicIpAddressDao.listByVlanId(vlanDbId);
for (IPAddressVO ip : ips) {
// Disassociate allocated IP's that are not in use
if ( !ip.isOneToOneNat() && !(ip.isSourceNat() && _networkModel.getNetwork(ip.getAssociatedWithNetworkId()) != null) &&
!(_firewallDao.countRulesByIpId(ip.getId()) > 0) ) {
if ( !ip.isOneToOneNat() && !ip.isSourceNat() && !(_firewallDao.countRulesByIpId(ip.getId()) > 0) ) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Releasing Public IP addresses" + ip +" of vlan " + vlanDbId + " as part of Public IP" +
" range release to the system pool");