diff options
author | Martin Schwenke <martin@meltin.net> | 2015-05-11 15:29:34 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2015-05-13 06:42:13 +0200 |
commit | 3b25face87b01c3013cf40f4b54be0c58aff5b4b (patch) | |
tree | fc4f0f52514e042c27a1e00ecd8138a1ffbbde76 /ctdb | |
parent | a1d6b3fb4bff4251facd52bfe7c03d68562a81a7 (diff) | |
download | samba-3b25face87b01c3013cf40f4b54be0c58aff5b4b.tar.gz |
ctdb-scripts: New eventscript 10.external
This is an alternative to 10.interface and is installed as disabled by
default. It should only be used with DisableIPFailover=yes and when
IP failover is being handled externally. In this mode CTDB can be
informed of public IP address movements using "ctdb moveip".
During the "startup" event, this eventscript currently finds any
public IP addresses configured in $CTDB_PUBLIC_ADDRESSES and tells
CTDB which node they are on using "ctdb moveip". This allows CTDB to
send ARPs and tickle-ACKs.
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/config/events.d/10.external | 49 | ||||
-rw-r--r-- | ctdb/packaging/RPM/ctdb.spec.in | 1 |
2 files changed, 50 insertions, 0 deletions
diff --git a/ctdb/config/events.d/10.external b/ctdb/config/events.d/10.external new file mode 100644 index 00000000000..3fcb0e105b5 --- /dev/null +++ b/ctdb/config/events.d/10.external @@ -0,0 +1,49 @@ +#!/bin/sh + +# Eventscript for CTDB to cope with externally managed public IP addresses + +# If DisableIPFailover is set: +# +# * 10.interface must be disabled. +# * For connection tracking/killing to work this script must be enabled. + +[ -n "$CTDB_BASE" ] || \ + export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD") + +. $CTDB_BASE/functions +loadconfig + +if [ -z "$CTDB_PUBLIC_ADDRESSES" ] ; then + exit 0 +fi + +if [ ! -f "$CTDB_PUBLIC_ADDRESSES" ] ; then + if [ "$1" = "init" ]; then + echo "No public addresses file found. Nothing to do for 10.interfaces.external" + fi + exit 0 +fi + +takeover_assigned_ips () +{ + ctdb_get_pnn + + ctdb -X ip | + awk -F'|' '{print $2}' | + while read ip ; do + if [ -n "$(ip_maskbits_iface $ip)" ] ; then + echo "Assigning $ip to this node ($pnn)" + ctdb moveip "$ip" "$pnn" + fi + done +} + +ctdb_check_args "$@" + +case "$1" in + startup) + takeover_assigned_ips + ;; +esac + +exit 0 diff --git a/ctdb/packaging/RPM/ctdb.spec.in b/ctdb/packaging/RPM/ctdb.spec.in index f6f5d8965d8..98dd3027c12 100644 --- a/ctdb/packaging/RPM/ctdb.spec.in +++ b/ctdb/packaging/RPM/ctdb.spec.in @@ -166,6 +166,7 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/ctdb/events.d/00.ctdb %{_sysconfdir}/ctdb/events.d/01.reclock %{_sysconfdir}/ctdb/events.d/10.interface +%{_sysconfdir}/ctdb/events.d/10.external %{_sysconfdir}/ctdb/events.d/13.per_ip_routing %{_sysconfdir}/ctdb/events.d/11.natgw %{_sysconfdir}/ctdb/events.d/11.routing |