cloudstack/patches/xenserver/root/clearUsageRules.sh
Manuel Amador (Rudd-O) 05c020e1f6 Source code committed
2010-08-11 09:13:29 -07:00

23 lines
590 B
Bash
Executable File

#!/usr/bin/env bash
# clearUsageRules.sh - remove iptable rules for removed public interfaces
#
#
# @VERSION@
# if removedVifs file doesn't exist, no rules to be cleared
if [ -f /root/removedVifs ]
then
var=`cat /root/removedVifs`
# loop through even vif to be cleared
for i in $var; do
# Make sure vif doesn't exist
if [ ! -f /sys/class/net/$i ]
then
# remove rules
iptables -D NETWORK_STATS -i eth0 -o $i > /dev/null;
iptables -D NETWORK_STATS -i $i -o eth0 > /dev/null;
fi
done
rm /root/removedVifs
fi