Skip to content

Commit 8d8a0eb

Browse files
author
Likitha Shetty
committed
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
1 parent ff4a487 commit 8d8a0eb

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

server/src/com/cloud/configuration/ConfigurationManagerImpl.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2673,9 +2673,9 @@ public boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId, Account ca
26732673
" as ip " + ip + " belonging to the range is used for static nat purposes. Cleanup the rules first");
26742674
}
26752675

2676-
if (ip.isSourceNat() && _networkModel.getNetwork(ip.getAssociatedWithNetworkId()) != null) {
2677-
throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId +
2678-
" as ip " + ip + " belonging to the range is a source nat ip for the network id=" + ip.getSourceNetworkId() +
2676+
if (ip.isSourceNat()) {
2677+
throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId +
2678+
" as ip " + ip + " belonging to the range is a source nat ip for the network id=" + ip.getSourceNetworkId() +
26792679
". IP range with the source nat ip address can be removed either as a part of Network, or account removal");
26802680
}
26812681

@@ -2829,8 +2829,7 @@ public boolean releasePublicIpRange(long vlanDbId, long userId, Account caller)
28292829
List<IPAddressVO> ips = _publicIpAddressDao.listByVlanId(vlanDbId);
28302830
for (IPAddressVO ip : ips) {
28312831
// Disassociate allocated IP's that are not in use
2832-
if ( !ip.isOneToOneNat() && !(ip.isSourceNat() && _networkModel.getNetwork(ip.getAssociatedWithNetworkId()) != null) &&
2833-
!(_firewallDao.countRulesByIpId(ip.getId()) > 0) ) {
2832+
if ( !ip.isOneToOneNat() && !ip.isSourceNat() && !(_firewallDao.countRulesByIpId(ip.getId()) > 0) ) {
28342833
if (s_logger.isDebugEnabled()) {
28352834
s_logger.debug("Releasing Public IP addresses" + ip +" of vlan " + vlanDbId + " as part of Public IP" +
28362835
" range release to the system pool");

0 commit comments

Comments
 (0)