CLOUDSTACK-7027: Removing left over static nat rule

This commit is contained in:
Jayapal 2014-07-01 12:28:35 +05:30
parent 2f1b40d2e8
commit f45c9f9d2f
1 changed files with 13 additions and 0 deletions

View File

@ -3389,15 +3389,28 @@ VirtualMachineGuru, Listener, Configurable, StateListener<State, VirtualMachine.
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();