summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2011-06-28 17:07:39 +1000
committerMartin Schwenke <martin@meltin.net>2011-08-12 16:34:13 +1000
commit9bdcdb76be52cf0285fcfb72da93d10fc24d8f16 (patch)
tree2b6b5976b8b387b94f52a33b0fedf95bbdd53700
parent7c33fb17118077d8833c555191b4e0507e9359c8 (diff)
downloadsamba-9bdcdb76be52cf0285fcfb72da93d10fc24d8f16.tar.gz
samba-9bdcdb76be52cf0285fcfb72da93d10fc24d8f16.tar.xz
samba-9bdcdb76be52cf0285fcfb72da93d10fc24d8f16.zip
Eventscripts: 10.interface clean-ups - minor tweaks and new comments.
* sed can read files, it doesn't need a file piped to it * use $() subshells instead of `` - they seem to quote better in dash * tweak the uniquifying code so that it is easier to read * add comments * remove some extraneous semicolons at ends of lines Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 5f49537889a92c3cb68d9203912188bedf00ecd4)
-rwxr-xr-xctdb/config/events.d/10.interface18
1 files changed, 11 insertions, 7 deletions
diff --git a/ctdb/config/events.d/10.interface b/ctdb/config/events.d/10.interface
index 6443f415e5..4e33aa48c3 100755
--- a/ctdb/config/events.d/10.interface
+++ b/ctdb/config/events.d/10.interface
@@ -30,18 +30,19 @@ mark_down ()
monitor_interfaces()
{
- all_interfaces=`cat $CTDB_PUBLIC_ADDRESSES |
- sed -e "s/^[^\t ]*[\t ]*//" -e "s/,/ /g" -e "s/[\t ]*$//"`
+ # Get all the interfaces listed in the public_addresses file
+ all_interfaces=$(sed -e "s/^[^\t ]*[\t ]*//" -e "s/,/ /g" -e "s/[\t ]*$//" $CTDB_PUBLIC_ADDRESSES)
+ # Add some special interfaces if they're defined
[ "$CTDB_PUBLIC_INTERFACE" ] && all_interfaces="$CTDB_PUBLIC_INTERFACE $all_interfaces"
[ "$CTDB_NATGW_PUBLIC_IFACE" ] && all_interfaces="$CTDB_NATGW_PUBLIC_IFACE $all_interfaces"
# For all but the 1st line, get the 2nd last field with commas
# changes to spaces.
- ctdb_ifaces=`ctdb -Y ip -v | sed -e '1d' -e 's/:[^:]*:$//' -e 's/^.*://' -e 's/,/ /g'`
+ ctdb_ifaces=$(ctdb -Y ip -v | sed -e '1d' -e 's/:[^:]*:$//' -e 's/^.*://' -e 's/,/ /g')
- all_interfaces=`for iface in $all_interfaces $ctdb_ifaces ; do echo $iface ; done | sort | uniq`
+ all_interfaces=$(echo $all_interfaces $ctdb_ifaces | tr ' ' '\n' | sort | uniq)
fail=false
up_interfaces_found=false
@@ -61,14 +62,17 @@ monitor_interfaces()
echo "$bi" | grep -q 'Currently Active Slave: None' && {
echo "ERROR: No active slaves for bond device $realiface"
mark_down $iface
- continue;
+ continue
}
echo "$bi" | grep -q '^MII Status: up' || {
echo "ERROR: public network interface $realiface is down"
mark_down $iface
- continue;
+ continue
}
echo "$bi" | grep -q '^Bonding Mode: IEEE 802.3ad Dynamic link aggregation' && {
+ # This works around a bug in the driver where the
+ # overall bond status can be up but none of the actual
+ # physical interfaces have a link.
echo "$bi" | grep 'MII Status:' | tail -n +2 | grep -q '^MII Status: up' || {
echo No active slaves for 802.ad bond device $realiface
mark_down $iface
@@ -76,7 +80,7 @@ monitor_interfaces()
}
}
mark_up $iface
- continue;
+ continue
}
case $iface in