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


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8d8a0ebe
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8d8a0ebe
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8d8a0ebe

Branch: refs/heads/ui-vm-affinity
Commit: 8d8a0ebe109ae6e9896caee945e29fd8ac778d2c
Parents: ff4a487
Author: Likitha Shetty <[email protected]>
Authored: Fri Apr 19 23:16:47 2013 +0530
Committer: Likitha Shetty <[email protected]>
Committed: Fri Apr 19 23:31:52 2013 +0530

----------------------------------------------------------------------
 .../configuration/ConfigurationManagerImpl.java    |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d8a0ebe/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 d142ca6..b5734a2 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -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");

Reply via email to