CLOUDSTACK-7027: Removing left over static nat rule

(cherry picked from commit a69c1ee31d)
This commit is contained in:
Jayapal 2014-07-01 12:28:35 +05:30 committed by Daan Hoogland
parent d5a92454fd
commit 09022344ee
1 changed files with 13 additions and 0 deletions

View File

@ -3391,15 +3391,28 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
final IpAddressTO[] ipsToSend = new IpAddressTO[ipAddrList.size()];
int i = 0;
boolean firstIP = true;
boolean isSourceNatNw = false;
for (final PublicIpAddress ipAddr : ipAddrList) {
final boolean add = (ipAddr.getState() == IpAddress.State.Releasing ? false : true);
boolean sourceNat = ipAddr.isSourceNat();
//set the isSourceNatNw from the first ip of ipAddrList
//For non source network ips the isSourceNatNw is always false
if (sourceNat) {
isSourceNatNw = ipAddr.isSourceNat();
}
/* enable sourceNAT for the first ip of the public interface */
if (firstIP) {
sourceNat = true;
}
// setting sourceNat=true to make sure the snat rule of the ip is deleted
if (!isSourceNatNw && !add ) {
sourceNat = true;
}
final String vlanId = ipAddr.getVlanTag();
final String vlanGateway = ipAddr.getGateway();
final String vlanNetmask = ipAddr.getNetmask();