[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.9.1-570-g8c3aed3
Ronnie Sahlberg
sahlberg at samba.org
Thu Jun 28 20:40:55 MDT 2012
The branch, 1.2.40 has been updated
via 8c3aed36615e083e0b91efd70380b7711f9f9f7e (commit)
via 0aa9a450ef8919acf9c6e3309712ed31fc7e70cc (commit)
via 9d8a6d792c40eed02f01a657c4fd252e9aae7039 (commit)
via bf0ce09db2302ef52ea0861cb8079c8b7220ec79 (commit)
via ee3cbeb874cf0dd1d91ddf3ebb9e4bd94fb15169 (commit)
via 183650afc505f5a3025ccbf7c6e07778761223c7 (commit)
via ce82656a88ec6cd3955b071f87bfa611abe0a94a (commit)
via c016f65ff147f3e92a39a26fcc086ca7992b1663 (commit)
via 47197d7571a20d047b6cf19597e8c9d7c3064f24 (commit)
via 7e6a846aca704aa5394631e1fe35d893b881b8a6 (commit)
via b00fcf9af9a2e2dad0b2ca282ab03b7b70a1493b (commit)
from b54938c8dfaac046aee9eec92724e7ba2153d65a (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40
- Log -----------------------------------------------------------------
commit 8c3aed36615e083e0b91efd70380b7711f9f9f7e
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Jun 29 12:31:13 2012 +1000
New version 1.2.44
commit 0aa9a450ef8919acf9c6e3309712ed31fc7e70cc
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Jun 21 14:18:35 2012 +1000
eventscripts: 13.per_ip_routing - flock should have a timeout
... and flock failure should be fatal.
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit 9d8a6d792c40eed02f01a657c4fd252e9aae7039
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Jun 21 14:17:06 2012 +1000
eventscripts: 13.per_ip_routing - readability improvement
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit bf0ce09db2302ef52ea0861cb8079c8b7220ec79
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Jun 15 17:22:02 2012 +1000
eventscripts: 13.per_ip_routing should remove bogus routes on ipreallocated
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit ee3cbeb874cf0dd1d91ddf3ebb9e4bd94fb15169
Author: Martin Schwenke <martin at meltin.net>
Date: Wed Jun 13 13:49:49 2012 +1000
eventscripts: Print a warning on failure to delete a routing rule
del_routing_for_ip() currently fails silently, which could hide real
errors.
In add_routing_for_ip() we don't want to see any error when calling
del_routing_for_ip(), since we don't expect the rule to be there.
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit 183650afc505f5a3025ccbf7c6e07778761223c7
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Apr 24 17:17:07 2012 +1000
Eventscripts: fix basename -> dirname typo
I fixed one of these previously but didn't notice this one... :-(
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit ce82656a88ec6cd3955b071f87bfa611abe0a94a
Author: Martin Schwenke <martin at meltin.net>
Date: Wed Apr 18 16:49:48 2012 +1000
Eventscripts - Fix typo in 13.per_ip_routing support for __auto_link_local__
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit c016f65ff147f3e92a39a26fcc086ca7992b1663
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Mar 20 16:23:24 2012 +1100
Eventscripts - make 13.per_ip_routing fail gracefully if config is missing
Currently it spews out random messages about the file being missing.
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit 47197d7571a20d047b6cf19597e8c9d7c3064f24
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Mar 20 16:21:09 2012 +1100
Eventscripts - make 13.per_ip_routing try harder to find public_addresses
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit 7e6a846aca704aa5394631e1fe35d893b881b8a6
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Mar 20 16:20:10 2012 +1100
Eventscripts - use set_proc() rather than accessing /proc directly
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit b00fcf9af9a2e2dad0b2ca282ab03b7b70a1493b
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Mar 20 16:18:49 2012 +1100
Eventscripts - 13.per_ip_routing should use dirname not basename for mkdir
Signed-off-by: Martin Schwenke <martin at meltin.net>
-----------------------------------------------------------------------
Summary of changes:
config/events.d/13.per_ip_routing | 75 +++++++++++++++++++++++++++++--------
packaging/RPM/ctdb.spec.in | 4 +-
2 files changed, 62 insertions(+), 17 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 d17342d..f16a74e 100755
--- a/config/events.d/13.per_ip_routing
+++ b/config/events.d/13.per_ip_routing
@@ -93,7 +93,7 @@ ensure_table_id_for_ip ()
_f="$CTDB_ETCDIR/iproute2/rt_tables"
# This file should always exist, but...
if [ ! -f "$_f" ] ; then
- mkdir -p $(basename "$_f")
+ mkdir -p $(dirname "$_f")
touch "$_f"
fi
@@ -105,7 +105,9 @@ ensure_table_id_for_ip ()
# new unused one (that is greater than all the used ones in the
# range).
(
- flock 0
+ # Note that die() just gets us out of the subshell...
+ flock --timeout 30 0 || \
+ die "ensure_table_id_for_ip: failed to lock file $_f"
_new=$CTDB_PER_IP_ROUTING_TABLE_ID_LOW
while read _t _l ; do
@@ -143,12 +145,14 @@ clean_up_table_ids ()
# Even if this didn't exist on the system, adding a route will
# have created it. What if we startup and immediately shutdown?
if [ ! -f "$_f" ] ; then
- mkdir -p $(basename "$_f")
+ mkdir -p $(dirname "$_f")
touch "$_f"
fi
(
- flock 0
+ # Note that die() just gets us out of the subshell...
+ flock --timeout 30 0 || \
+ die "clean_up_table_ids: failed to lock file $_f"
# Delete any items from the file that have a table id in our
# range or a label matching our label. Preserve comments.
@@ -156,7 +160,7 @@ clean_up_table_ids ()
awk -v min="$CTDB_PER_IP_ROUTING_TABLE_ID_LOW" \
-v max="$CTDB_PER_IP_ROUTING_TABLE_ID_HIGH" \
-v pre="$table_id_prefix" \
- 'index($0, "#") == 1 || \
+ '/^#/ || \
!(min <= $1 && $1 <= max) && \
!(index($2, pre) == 1) \
{ print $0 }' "$_f" >"$_tmp"
@@ -171,6 +175,7 @@ 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"
@@ -182,8 +187,10 @@ get_config_for_ip ()
if [ "$_ip" = "$_i" ] ; then
echo -n "$_ip "; ipv4_host_addr_to_net "$_ip" "$_maskbits"
fi
- done <"${CTDB_PUBLIC_ADDRESSES:-/dev/null}"
+ 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"
@@ -196,7 +203,9 @@ ip_has_configuration ()
{
_ip="$1"
- [ -n "$(get_config_for_ip $_ip)" ]
+ _config="$(get_config_for_ip $_ip)" || \
+ die "error: CTDB_PER_IP_ROUTING_CONF=$CTDB_PER_IP_ROUTING_CONF file not found"
+ [ -n "$_config" ]
}
add_routing_for_ip ()
@@ -213,7 +222,7 @@ add_routing_for_ip ()
_pref="$CTDB_PER_IP_ROUTING_RULE_PREF"
_table_id="${table_id_prefix}${_ip}"
- del_routing_for_ip "$_ip"
+ del_routing_for_ip "$_ip" >/dev/null 2>&1
ip rule add from "$_ip" pref "$_pref" table "$_table_id" || \
die "add_routing_for_ip: failed to add rule for $_ip"
@@ -234,9 +243,17 @@ del_routing_for_ip ()
_pref="$CTDB_PER_IP_ROUTING_RULE_PREF"
_table_id="${table_id_prefix}${_ip}"
- # Do this unconditionally since we own any matching table ids...
- ip rule del from $_ip pref $_pref table $_table_id 2>/dev/null
- ip route flush table $_table_id 2>/dev/null
+ # Do this unconditionally since we own any matching table ids.
+ # However, print a meaningful message if something goes wrong.
+ _cmd="ip rule del from $_ip pref $_pref table $_table_id"
+ _out=$($_cmd 2>&1) || \
+ cat <<EOF
+WARNING: Failed to delete policy routing rule
+ Command "$_cmd" failed:
+ $_out
+EOF
+ # This should never fail, so don't redirect output.
+ ip route flush table $_table_id
}
######################################################################
@@ -278,7 +295,32 @@ add_missing_routes ()
add_routing_for_ip "$_iface" "$_ip"
fi
done
- }
+ } || exit $?
+}
+
+# Remove rules/routes for addresses that we're not hosting. If a
+# releaseip event failed in an earlier script then we might not have
+# had a chance to remove the corresponding rules/routes.
+remove_bogus_routes ()
+{
+ # Get a IPs current hosted by this node, each anchored with '@'.
+ _ips=$(ctdb ip -v -Y | awk -F: 'NR > 1 && $4 != "" {printf "@%s@\n", $2}')
+
+ ip rule show |
+ while read _p _x _i _x _t ; do
+ # Remove trailing colon after priority/preference.
+ _p="${_p%:}"
+ # Only remove rules that match our priority/preference.
+ [ "$CTDB_PER_IP_ROUTING_RULE_PREF" = "$_p" ] || continue
+ # Only remove rules for which we don't have an IP. This could
+ # be done with grep, but let's do it with shell prefix removal
+ # to avoid unnecessary processes. This falls through if
+ # "@${_i}@" isn't present in $_ips.
+ [ "$_ips" = "${_ips#*@${_i}@}" ] || continue
+
+ echo "Removing ip rule/routes for unhosted public address $_i"
+ del_routing_for_ip "$_i"
+ done
}
######################################################################
@@ -291,8 +333,8 @@ case "$1" in
# make sure that we only respond to ARP messages from the NIC
# where a particular ip address is associated.
- [ -f /proc/sys/net/ipv4/conf/all/arp_filter ] && {
- echo 1 > /proc/sys/net/ipv4/conf/all/arp_filter
+ get_proc sys/net/ipv4/conf/all/arp_filter >/dev/null 2>&1 && {
+ set_proc sys/net/ipv4/conf/all/arp_filter 1
}
;;
@@ -310,7 +352,7 @@ case "$1" in
add_routing_for_ip "$iface" "$ip"
# flush our route cache
- echo 1 > /proc/sys/net/ipv4/route/flush
+ set_proc sys/net/ipv4/route/flush 1
ctdb gratiousarp "$ip" "$iface"
;;
@@ -325,7 +367,7 @@ case "$1" in
add_routing_for_ip "$niface" "$ip"
# flush our route cache
- echo 1 > /proc/sys/net/ipv4/route/flush
+ set_proc sys/net/ipv4/route/flush 1
ctdb gratiousarp "$ip" "$niface"
tickle_tcp_connections "$ip"
@@ -342,6 +384,7 @@ case "$1" in
ipreallocated)
add_missing_routes
+ remove_bogus_routes
;;
*)
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 9ec9192..575872c 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.43
+Version: 1.2.44
Release: 1GITHASH
Epoch: 0
License: GNU GPL version 3
@@ -144,6 +144,8 @@ development libraries for ctdb
%{_libdir}/libctdb.a
%changelog
+* Fri Jun 29 2012 : Version 1.2.44
+ - improvements to the policy routing support
* Thu Mar 29 2012 : Version 1.2.43
- Add CTDB_CONTROL_CHECK_SRVID control
* Mon Mar 12 2012 : Version 1.2.42
--
CTDB repository
More information about the samba-cvs
mailing list