[SCM] CTDB repository - branch master updated - ctdb-1.13-243-gc29a943
Amitay Isaacs
amitay at samba.org
Mon Jul 30 00:03:57 MDT 2012
The branch, master has been updated
via c29a943f9bbcfecb861e71d007c7698a53dc8773 (commit)
via c64c6c77c3f6aa2898e5a575547b587bea868c76 (commit)
via 5277d749c9111716fd723647d5421907476422bf (commit)
from 076282622fcb2663d378e0c90ed0d9c19f73c005 (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit c29a943f9bbcfecb861e71d007c7698a53dc8773
Author: Martin Schwenke <martin at meltin.net>
Date: Mon Jul 30 12:51:43 2012 +1000
tests/eventscripts: Extra cases for policy routing missing config test
Test the startup and monitor events too.
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit c64c6c77c3f6aa2898e5a575547b587bea868c76
Author: Martin Schwenke <martin at meltin.net>
Date: Mon Jul 30 12:51:12 2012 +1000
Eventscripts: 13.per_ip_routing should always fail if config is missing
Currently, if the configuration file is specified by
$CTDB_PER_IP_ROUTING_CONF but is missing, takeip fails but (the
absent) monitor event "succeeds", so the state of a node will
flip-flop.
Instead of this, if the configuration file is missing then fail early
on for all events.
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit 5277d749c9111716fd723647d5421907476422bf
Author: Martin Schwenke <martin at meltin.net>
Date: Mon Jul 30 11:50:53 2012 +1000
Revert "Eventscripts - make 13.per_ip_routing fail gracefully if config is missing"
When the configuration file is missing this causes the node to
flip-flop betwen unhealthy (when takeip fails) and healthy (no monitor
event here).
Will reimplement this properly.
This reverts commit 351ca413eec460330571ca8b01ad269728fe15df.
-----------------------------------------------------------------------
Summary of changes:
config/events.d/13.per_ip_routing | 18 +++++++++++-------
tests/eventscripts/13.per_ip_routing.002.sh | 7 +++++--
2 files changed, 16 insertions(+), 9 deletions(-)
Changeset truncated at 500 lines:
diff --git a/config/events.d/13.per_ip_routing b/config/events.d/13.per_ip_routing
index 07687c0..cfde403 100755
--- a/config/events.d/13.per_ip_routing
+++ b/config/events.d/13.per_ip_routing
@@ -14,6 +14,15 @@ table_id_prefix="ctdb."
[ "$CTDB_PER_IP_ROUTING_TABLE_ID_LOW" -lt "$CTDB_PER_IP_ROUTING_TABLE_ID_HIGH" ] 2>/dev/null || \
die "error: CTDB_PER_IP_ROUTING_TABLE_ID_LOW[$CTDB_PER_IP_ROUTING_TABLE_ID_LOW] and/or CTDB_PER_IP_ROUTING_TABLE_ID_HIGH[$CTDB_PER_IP_ROUTING_TABLE_ID_HIGH] improperly configured"
+have_link_local_config ()
+{
+ [ "$CTDB_PER_IP_ROUTING_CONF" = "__auto_link_local__" ]
+}
+
+if ! have_link_local_config && [ ! -r "$CTDB_PER_IP_ROUTING_CONF" ] ; then
+ die "error: CTDB_PER_IP_ROUTING_CONF=$CTDB_PER_IP_ROUTING_CONF file not found"
+fi
+
######################################################################
ipv4_is_valid_addr()
@@ -166,12 +175,11 @@ clean_up_table_ids ()
# This prints the config for an IP, which is either relevant entries
# from the config file or, if set to the magic link local value, some
# link local routing config for the IP.
-# NOTE: non-zero return indicates missing configuration file
get_config_for_ip ()
{
_ip="$1"
- if [ "$CTDB_PER_IP_ROUTING_CONF" = "__auto_link_local__" ] ; then
+ if have_link_local_config ; then
# When parsing public_addresses also split on '/'. This means
# that we get the maskbits as item #2 without further parsing.
while IFS="/$IFS" read _i _maskbits _x ; do
@@ -180,8 +188,6 @@ get_config_for_ip ()
fi
done <"${CTDB_PUBLIC_ADDRESSES:-${CTDB_BASE:-/dev/null}${CTDB_BASE:+/public_addresses}}"
else
- [ -f "$CTDB_PER_IP_ROUTING_CONF" ] || return 1
-
while read _i _rest ; do
if [ "$_ip" = "$_i" ] ; then
printf "%s\t%s\n" "$_ip" "$_rest"
@@ -194,9 +200,7 @@ ip_has_configuration ()
{
_ip="$1"
- _config="$(get_config_for_ip $_ip)" || \
- die "error: CTDB_PER_IP_ROUTING_CONF=$CTDB_PER_IP_ROUTING_CONF file not found"
- [ -n "$_config" ]
+ [ -n "$(get_config_for_ip $_ip)" ]
}
add_routing_for_ip ()
diff --git a/tests/eventscripts/13.per_ip_routing.002.sh b/tests/eventscripts/13.per_ip_routing.002.sh
index 62a4c65..4d5c68c 100755
--- a/tests/eventscripts/13.per_ip_routing.002.sh
+++ b/tests/eventscripts/13.per_ip_routing.002.sh
@@ -2,7 +2,7 @@
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "missing config, no takeip, ipreallocated"
+define_test "missing config file"
setup_ctdb
setup_ctdb_policy_routing
@@ -11,4 +11,7 @@ required_result 1 <<EOF
error: CTDB_PER_IP_ROUTING_CONF=${CTDB_BASE}/policy_routing file not found
EOF
-simple_test_event "ipreallocated"
+for i in "startup" "ipreallocated" "monitor" ; do
+ simple_test_event "$i"
+done
+
--
CTDB repository
More information about the samba-cvs
mailing list