Rush has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311725

Change subject: labs: tc-setup add 'clean' option to remove shaping
......................................................................

labs: tc-setup add 'clean' option to remove shaping

This is sometimes needed for debugging or testing and performance
testing against NFS.

Change-Id: I4da29e45b41be0ae50465210cf0e1447a41e87a7
---
M modules/labstore/files/tc-setup.sh
1 file changed, 29 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/25/311725/1

diff --git a/modules/labstore/files/tc-setup.sh 
b/modules/labstore/files/tc-setup.sh
index a8982f8..873dca4 100644
--- a/modules/labstore/files/tc-setup.sh
+++ b/modules/labstore/files/tc-setup.sh
@@ -16,6 +16,17 @@
 nfs_dumps_read='15000kbps'
 eth0_egress='30000kbps'
 
+TC=$(which tc)
+
+function clean_ingress {
+    $TC qdisc del dev eth0 handle ffff: ingress
+    $TC qdisc del dev ifb0 root
+}
+
+function clean_egress {
+    $TC qdisc del dev eth0 root
+}
+
 function ensure_mod {
     value=$(/sbin/lsmod | /bin/grep $1)
     retcode=$?
@@ -26,14 +37,19 @@
     fi
 }
 
+if [ "$1" == "clean" ]
+then
+    echo "clean"
+    clean_ingress
+    clean_egress
+    exit 0
+fi
+
 for m in $modules; do
     ensure_mod $m
 done
 
-TC=$(which tc)
-
-# clear out old config
-$TC qdisc del dev eth0 root
+clean_egress
 
 $TC qdisc add dev eth0 root handle 1: htb default 100
 
@@ -46,19 +62,17 @@
 $TC class add dev eth0 parent 1: classid 1:100 htb rate $eth0_egress
 
 $TC filter add dev eth0 parent 1: protocol ip prio 0 u32 \
-         match ip dst 10.64.37.6 flowid 1:1
+      match ip dst 10.64.37.6 flowid 1:1
 
 $TC filter add dev eth0 parent 1: protocol ip prio 0 u32 \
-         match ip dst 10.64.37.7 flowid 1:2
+      match ip dst 10.64.37.7 flowid 1:2
 
 $TC filter add dev eth0 parent 1: protocol ip prio 0 u32 \
-         match ip dst 10.64.37.10 flowid 1:3
+      match ip dst 10.64.37.10 flowid 1:3
 
 #-------------------------------------
 
-# clear out config
-$TC qdisc del dev eth0 handle ffff: ingress
-$TC qdisc del dev ifb0 root
+clean_ingress
 
 # Create ingress on external interface
 $TC qdisc add dev eth0 handle ffff: ingress
@@ -69,8 +83,7 @@
 if [ $retcode != 0 ]
 then
     echo "ifb0 is not coming up"
-    $TC qdisc del dev eth0 handle ffff: ingress
-    $TC qdisc del dev ifb0 root
+    clean_ingress
     exit 1
 fi
 
@@ -89,13 +102,13 @@
 $TC class add dev ifb0 parent 1: classid 1:4 htb rate $nfs_dumps_read
 
 $TC filter add dev ifb0 parent 1: protocol ip prio 0 u32 \
-         match ip src 10.64.37.6 flowid 1:1
+      match ip src 10.64.37.6 flowid 1:1
 
 $TC filter add dev ifb0 parent 1: protocol ip prio 0 u32 \
-         match ip src 10.64.37.7 flowid 1:2
+      match ip src 10.64.37.7 flowid 1:2
 
 $TC filter add dev ifb0 parent 1: protocol ip prio 0 u32 \
-         match ip src 10.64.37.10 flowid 1:3
+      match ip src 10.64.37.10 flowid 1:3
 
 $TC filter add dev ifb0 parent 1: protocol ip prio 0 u32 \
-         match ip src 10.64.4.10 flowid 1:4
+      match ip src 10.64.4.10 flowid 1:4

-- 
To view, visit https://gerrit.wikimedia.org/r/311725
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4da29e45b41be0ae50465210cf0e1447a41e87a7
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Rush <r...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to