1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-26 18:50:30 +03:00

Eventscripts - 10.interfaces should not check orphaned interfaces.

If the last IP address on an interfaces is removed then that
interfaces should no longer be checked by 10.interfaces.  However,
"ctdb ifaces" still lists such interfaces so they are currently
checked.

The problem really needs to be addressed in ctdbd but a neat quick
eventscript fix will be minimally invasive...

This changes the code to use "ctdb -Y ip -v" instead of "ctdb -Y
ifaces".  The former includes details of all public addresses and
associated interfaces, so when an address is removed there is no
output for it.  This avoids orphaned interfaces from being listed.

The logic is also slightly improved so that $IFACES includes just a
(non-uniquified) list of interfaces, allowing an existing loop to be
removed.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 49b2d1bd9554461ed8edbfc21e777c0eca9e1443)
This commit is contained in:
Martin Schwenke 2011-08-01 13:37:06 +10:00 committed by Ronnie Sahlberg
parent a17ae8a8be
commit 652bf326e1

View File

@ -24,17 +24,14 @@ monitor_interfaces()
[ "$CTDB_PUBLIC_INTERFACE" ] && INTERFACES="$CTDB_PUBLIC_INTERFACE $INTERFACES"
[ "$CTDB_NATGW_PUBLIC_IFACE" ] && INTERFACES="$CTDB_NATGW_PUBLIC_IFACE $INTERFACES"
local IFACES=`ctdb ifaces -Y | grep -v '^:Name:LinkStatus:References:'`
local I
# For all but the 1st line, get the 2nd last field with commas
# changes to spaces.
local IFACES=`ctdb -Y ip -v | sed -e '1d' -e 's/:[^:]*:$//' -e 's/^.*://' -e 's/,/ /g'`
local IFACE
for I in $IFACES; do
IFACE=`echo -n "$I" | cut -d ':' -f2`
INTERFACES="$IFACE $INTERFACES"
done
INTERFACES=`for IFACE in $INTERFACES ; do echo $IFACE ; done | sort | uniq`
INTERFACES=`for IFACE in $INTERFACES $IFACES ; do echo $IFACE ; done | sort | uniq`
local fail=0
local ok=0