You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ja...@apache.org on 2014/07/01 11:48:18 UTC

[2/2] git commit: updated refs/heads/master to f45c9f9

CLOUDSTACK-7027: Removing left over static nat rule


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

Branch: refs/heads/master
Commit: f45c9f9d2f4185a5e8fb631065700d6dc5987ae4
Parents: 2f1b40d
Author: Jayapal <ja...@apache.org>
Authored: Tue Jul 1 12:28:35 2014 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Tue Jul 1 15:16:35 2014 +0530

----------------------------------------------------------------------
 .../router/VirtualNetworkApplianceManagerImpl.java     | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f45c9f9d/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 885de83..1068a2f 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -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();