[SCM] CTDB repository - branch 1.2 updated - ctdb-1.9.1-414-g671eff3
Ronnie Sahlberg
sahlberg at samba.org
Sun Apr 10 20:05:20 MDT 2011
The branch, 1.2 has been updated
via 671eff3ccf1914de110909b9eb5d7844c8aebb3b (commit)
via f7da9eaa3916c47d5313c81c268b5438786aa394 (commit)
from 92da906d41086abd1d159769728bae4624c65a34 (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2
- Log -----------------------------------------------------------------
commit 671eff3ccf1914de110909b9eb5d7844c8aebb3b
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Mon Apr 11 07:43:52 2011 +1000
New version 1.2.28
Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>
commit f7da9eaa3916c47d5313c81c268b5438786aa394
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Mon Apr 11 05:56:14 2011 +1000
IFACE handling. Assume links are always good on nstartup (they almost always
Simplify the handling of setting the links in the 10.interface eventscript
and remove the optimization to only call setifacelink on state change
to make the code simpler to read.
If a take ip event fails, flag the node as unhealthy.
Add a check to the interface script to check if the interface exists
or if it has been deleted.
So that we can capture and become UNHELTHY if someone deletes an interface
we are using to host public addresses.
-----------------------------------------------------------------------
Summary of changes:
config/events.d/10.interface | 56 ++++++++++++++++-------------------------
packaging/RPM/ctdb.spec.in | 5 +++-
server/ctdb_takeover.c | 4 +++
3 files changed, 30 insertions(+), 35 deletions(-)
Changeset truncated at 500 lines:
diff --git a/config/events.d/10.interface b/config/events.d/10.interface
index 640d3db..2ca8eae 100755
--- a/config/events.d/10.interface
+++ b/config/events.d/10.interface
@@ -38,13 +38,12 @@ monitor_interfaces()
INTERFACES=`for IFACE in $INTERFACES ; do echo $IFACE ; done | sort | uniq`
local fail=0
- local force_fail=0
local ok=0
for IFACE in $INTERFACES ; do
- local OLDLINK=`echo -n "$IFACES" | grep "^:$IFACE:" | cut -d ':' -f3 | xargs`
- test -z "$OLDLINK" && {
- force_fail=1
+ ip addr show $IFACE 2>/dev/null >/dev/null || {
+ echo Interface $IFACE does not exist but it is used by public addresses.
+ exit 1
}
# These interfaces are sometimes bond devices
@@ -55,44 +54,34 @@ monitor_interfaces()
grep -q 'Currently Active Slave: None' /proc/net/bonding/$REALIFACE && {
echo "ERROR: No active slaves for bond device $REALIFACE"
fail=1
- test -n "$OLDLINK" && {
- ctdb setifacelink $IFACE down
- }
+ ctdb setifacelink $IFACE down
continue;
}
grep -q '^MII Status: up' /proc/net/bonding/$REALIFACE || {
echo "ERROR: public network interface $REALIFACE is down"
fail=1
- test -n "$OLDLINK" && {
- ctdb setifacelink $IFACE down
- }
+ ctdb setifacelink $IFACE down
continue;
}
- test -n "$OLDLINK" && {
- ok=1 # we only set ok for interfaces known to ctdbd
- ctdb setifacelink $IFACE up
- }
+ ok=1 # we only set ok for interfaces known to ctdbd
+ ctdb setifacelink $IFACE up
continue;
}
case $IFACE in
lo*)
# loopback is always working
- test -n "$OLDLINK" && {
- ok=1 # we only set ok for interfaces known to ctdbd
- ctdb setifacelink $IFACE up
- }
+ ok=1 # we only set ok for interfaces known to ctdbd
+ ctdb setifacelink $IFACE up
;;
ib*)
# we dont know how to test ib links
- test -n "$OLDLINK" && {
- ok=1 # we only set ok for interfaces known to ctdbd
- ctdb setifacelink $IFACE up
- }
+ ok=1 # we only set ok for interfaces known to ctdbd
+ ctdb setifacelink $IFACE up
;;
*)
[ -z "$IFACE" ] || {
- [ "$(basename $(readlink /sys/class/net/$IFACE/device/driver))" = virtio_net ] ||
+ [ "$(basename $(readlink /sys/class/net/$IFACE/device/driver) 2>/dev/null)" = virtio_net ] ||
ethtool $IFACE | grep -q 'Link detected: yes' || {
# On some systems, this is not successful when a
# cable is plugged but the interface has not been
@@ -102,16 +91,12 @@ monitor_interfaces()
ethtool $IFACE | grep -q 'Link detected: yes' || {
echo "ERROR: No link on the public network interface $IFACE"
fail=1
- test -n "$OLDLINK" && {
- ctdb setifacelink $IFACE down
- }
+ ctdb setifacelink $IFACE down
continue
}
}
- test -n "$OLDLINK" && {
- ok=1 # we only set ok for interfaces known to ctdbd
- ctdb setifacelink $IFACE up
- }
+ ok=1 # we only set ok for interfaces known to ctdbd
+ ctdb setifacelink $IFACE up
}
;;
esac
@@ -122,10 +107,6 @@ monitor_interfaces()
return 0;
}
- test x"$force_fail" != x"0" && {
- return 1;
- }
-
test x"$ok" = x"1" && {
return 2;
}
@@ -148,6 +129,13 @@ case "$1" in
# called after ctdbd has done its initial recovery
# and we start the services to become healthy
startup)
+ # Assume all links are good initially
+ INTERFACES=`for IFACE in $INTERFACES ; do echo $IFACE ; done | sort | uniq`
+
+ for IFACE in $INTERFACES ; do
+ ctdb setifacelink $IFACE down
+ done
+
monitor_interfaces
;;
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 55c1fe3..6d97420 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -3,7 +3,7 @@ Name: ctdb
Summary: Clustered TDB
Vendor: Samba Team
Packager: Samba Team <samba at samba.org>
-Version: 1.2.27
+Version: 1.2.28
Release: 1GITHASH
Epoch: 0
License: GNU GPL version 3
@@ -142,6 +142,9 @@ development libraries for ctdb
%{_libdir}/libctdb.a
%changelog
+* Mon Apr 11 2011 : Version 1.2.28
+ - Update how we handle interface link status
+ also check for and become unhealthy if an interface has been deleted
* Mon Mar 21 2011 : Version 1.2.27
- Fix a tdb_lock all bug in the ctdb_req_dmaster from non-master code.
CQ S1022545
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index 3dac1f7..bed2ab9 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -334,6 +334,8 @@ static void ctdb_do_takeip_callback(struct ctdb_context *ctdb, int status,
TDB_DATA data;
if (status != 0) {
+ struct ctdb_node *node = ctdb->nodes[ctdb->pnn];
+
if (status == -ETIME) {
ctdb_ban_self(ctdb);
}
@@ -341,6 +343,8 @@ static void ctdb_do_takeip_callback(struct ctdb_context *ctdb, int status,
ctdb_addr_to_str(&state->vnn->public_address),
ctdb_vnn_iface_string(state->vnn)));
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
+
+ node->flags |= NODE_FLAGS_UNHEALTHY;
talloc_free(state);
return;
}
--
CTDB repository
More information about the samba-cvs
mailing list