incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject git commit: bug CS-16112: During unplug nic iptables rules are cleaned up in both cloud_nic.sh and vpc_netusage.sh. Consolidated this code in cloud_nic.sh status CS-16112: resolved fixed
Date Wed, 22 Aug 2012 06:37:34 GMT
Updated Branches:
  refs/heads/master 95347d2a5 -> b42a813ff


bug CS-16112: During unplug nic iptables rules are cleaned up in both cloud_nic.sh and vpc_netusage.sh.
Consolidated this code in cloud_nic.sh
status CS-16112: resolved fixed

Conflicts:
	patches/systemvm/debian/config/opt/cloud/bin/vpc_netusage.sh


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

Branch: refs/heads/master
Commit: b42a813ff1d1227767acb8dbd29bc925e2cab12b
Parents: 95347d2
Author: kishan <kishan@cloud.com>
Authored: Tue Aug 21 20:16:35 2012 +0530
Committer: kishan <kishan@cloud.com>
Committed: Wed Aug 22 12:00:02 2012 +0530

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/cloud-nic.sh       |   14 +++++++--
 .../debian/config/opt/cloud/bin/vpc_netusage.sh    |   22 +--------------
 .../VpcVirtualNetworkApplianceManagerImpl.java     |   11 -------
 3 files changed, 12 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b42a813f/patches/systemvm/debian/config/opt/cloud/bin/cloud-nic.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/cloud-nic.sh b/patches/systemvm/debian/config/opt/cloud/bin/cloud-nic.sh
index 24596f7..b067a98 100755
--- a/patches/systemvm/debian/config/opt/cloud/bin/cloud-nic.sh
+++ b/patches/systemvm/debian/config/opt/cloud/bin/cloud-nic.sh
@@ -17,13 +17,21 @@ unplug_nic() {
   sudo sed -i /"$tableNo $tableName"/d /etc/iproute2/rt_tables 2>/dev/null
   sudo ip route flush cache
   # remove network usage rules
-  sudo iptables -t mangle -F NETWORK_STATS_$dev 2>/dev/null
-  iptables-save -t mangle | grep NETWORK_STATS_$dev | grep "\-A"  | while read rule
+  sudo iptables -F NETWORK_STATS_$dev 2>/dev/null
+  iptables-save | grep NETWORK_STATS_$dev | grep "\-A"  | while read rule
+  do
+    rule=$(echo $rule | sed 's/\-A/\-D/')
+    sudo iptables $rule
+  done
+  sudo iptables -X NETWORK_STATS_$dev 2>/dev/null
+  # remove vpn network usage rules
+  sudo iptables -t mangle -F VPN_STATS_$dev 2>/dev/null
+  iptables-save -t mangle | grep VPN_STATS_$dev | grep "\-A"  | while read rule
   do
     rule=$(echo $rule | sed 's/\-A/\-D/')
     sudo iptables -t mangle $rule
   done
-  sudo iptables -t mangle -X NETWORK_STATS_$dev 2>/dev/null
+  sudo iptables -t mangle -X VPN_STATS_$dev 2>/dev/null  
   # remove rules on this dev
   iptables-save -t mangle | grep $dev | grep "\-A"  | while read rule
   do

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b42a813f/patches/systemvm/debian/config/opt/cloud/bin/vpc_netusage.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vpc_netusage.sh b/patches/systemvm/debian/config/opt/cloud/bin/vpc_netusage.sh
index 743ad32..393b4bb 100755
--- a/patches/systemvm/debian/config/opt/cloud/bin/vpc_netusage.sh
+++ b/patches/systemvm/debian/config/opt/cloud/bin/vpc_netusage.sh
@@ -53,31 +53,11 @@ create_vpn_usage_rules () {
 }
 
 remove_usage_rules () {
-  echo $ethDev >> /root/removedVifs
-  return $?
+  return 0
 }
 
 get_usage () {
   iptables -L NETWORK_STATS_$ethDev -n -v -x 2> /dev/null | awk '$1 ~ /^[0-9]+$/ { printf
"%s:", $2}'; > /dev/null
-  if [ -f /root/removedVifs ]
-  then
-    var=`cat /root/removedVifs`
-    # loop through vifs to be cleared
-    for i in $var; do
-      # Make sure vif doesn't exist
-      if [ ! -f /sys/class/net/$i ]
-      then
-        # flush rules and remove chain
-        iptables -F NETWORK_STATS_$i > /dev/null;
-        iptables -D FORWARD -j NETWORK_STATS_$i > /dev/null;
-        iptables -X NETWORK_STATS_$i > /dev/null;
-        iptables -t mangle -F VPN_STATS_$i > /dev/null;
-        iptables -t mangle -D FORWARD -j VPN_STATS_$i > /dev/null;
-        iptables -t mangle -X VPN_STATS_$i > /dev/null;
-      fi
-    done
-    rm /root/removedVifs
-  fi     
   return 0
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b42a813f/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index a915561..98613b8 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -366,10 +366,6 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
         if (router.getState() == State.Running) {
             try {
                 Commands cmds = new Commands(OnError.Stop);            	
-            	if(network.getTrafficType() == TrafficType.Public){
-            		NetworkUsageCommand netUsageCmd = new NetworkUsageCommand(router.getPrivateIpAddress(),
router.getInstanceName(), "remove", true, nic.getIp());
-            		cmds.addCommand(netUsageCmd);
-            	}            	
                 UnPlugNicCommand unplugNicCmd = new UnPlugNicCommand(nic, vm.getName());
                 cmds.addCommand("unplugnic", unplugNicCmd);
                 _agentMgr.send(dest.getHost().getId(), cmds);
@@ -378,13 +374,6 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
                 if (!(unplugNicAnswer != null && unplugNicAnswer.getResult())) {
                     s_logger.warn("Unable to unplug nic from router " + router);
                     result = false;
-                } else {
-                	if(network.getTrafficType() == TrafficType.Public){
-                		NetworkUsageCommand netUsageCmd = new NetworkUsageCommand(router.getPrivateIpAddress(),
router.getInstanceName(), "remove", true, nic.getIp());
-                		cmds = new Commands(OnError.Stop);
-                		cmds.addCommand(netUsageCmd);
-                		_agentMgr.send(dest.getHost().getId(), cmds);
-                	}
                 }
             } catch (OperationTimedoutException e) {
                 throw new AgentUnavailableException("Unable to unplug nic from rotuer " +
router + " from network " + network,


Mime
View raw message