[SCM] CTDB repository - branch 1.2 updated - ctdb-1.9.1-452-ga5b8e2c
Ronnie Sahlberg
sahlberg at samba.org
Mon Aug 1 23:57:08 MDT 2011
The branch, 1.2 has been updated
via a5b8e2c1ec1b4fd7ef25e70a919ef4c70f3e1c75 (commit)
from 7467a04eb9fa5c25fea3870d7795c9c00222a6d9 (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2
- Log -----------------------------------------------------------------
commit a5b8e2c1ec1b4fd7ef25e70a919ef4c70f3e1c75
Author: Martin Schwenke <martin at meltin.net>
Date: Mon Aug 1 13:37:06 2011 +1000
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 at meltin.net>
-----------------------------------------------------------------------
Summary of changes:
config/events.d/10.interface | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
Changeset truncated at 500 lines:
diff --git a/config/events.d/10.interface b/config/events.d/10.interface
index f793673..8f0c0bc 100755
--- a/config/events.d/10.interface
+++ b/config/events.d/10.interface
@@ -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
- local IFACE
+ # 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'`
- for I in $IFACES; do
- IFACE=`echo -n "$I" | cut -d ':' -f2`
- INTERFACES="$IFACE $INTERFACES"
- done
+ local IFACE
- 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
--
CTDB repository
More information about the samba-cvs
mailing list