summaryrefslogtreecommitdiff
path: root/ctdb/config/events.d/11.natgw
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2013-01-11 16:02:31 +1100
committerAmitay Isaacs <amitay@gmail.com>2013-05-24 14:08:07 +1000
commita989a299d196ac6cb2de17cfacf26c5075e0d853 (patch)
treed65ee4fdbf9f225b5f3a499450504e85c9e2c4b6 /ctdb/config/events.d/11.natgw
parent6d9667f01ca492b0623b23ea35f612bcc5da893e (diff)
downloadsamba-a989a299d196ac6cb2de17cfacf26c5075e0d853.tar.gz
eventscripts: 11.natgw should not call ctdb tool in "init" event
The current code calls "ctdb setnatgwstate ..." on every event. However, calling the ctdb tool in the "init" event is not permitted. Instead, update the capability when it is needed and at regular intervals via the "monitor" event. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 39a43feae7c7de07ddaf2d6cb962f923d47d0c19)
Diffstat (limited to 'ctdb/config/events.d/11.natgw')
-rwxr-xr-xctdb/config/events.d/11.natgw17
1 files changed, 13 insertions, 4 deletions
diff --git a/ctdb/config/events.d/11.natgw b/ctdb/config/events.d/11.natgw
index a6e05238f90..c6c45cabf9f 100755
--- a/ctdb/config/events.d/11.natgw
+++ b/ctdb/config/events.d/11.natgw
@@ -13,12 +13,15 @@ loadconfig
[ -z "$CTDB_NATGW_NODES" ] && exit 0
-# Update capabilities to show whether we support teh NATGW capability or not
-if [ "$CTDB_NATGW_SLAVE_ONLY" = "yes" ] ; then
+set_natgw_capability ()
+{
+ # Set NATGW capability depending on configuration
+ if [ "$CTDB_NATGW_SLAVE_ONLY" = "yes" ] ; then
ctdb setnatgwstate off
-else
+ else
ctdb setnatgwstate on
-fi
+ fi
+}
delete_all() {
_ip="${CTDB_NATGW_PUBLIC_IP%/*}"
@@ -58,6 +61,10 @@ ensure_natgwmaster ()
}
case "$1" in
+ setup)
+ set_natgw_capability
+ ;;
+
startup)
# Error if CTDB_NATGW_PUBLIC_IP is listed in public addresses
grep -q "^$CTDB_NATGW_PUBLIC_IP[[:space:]]" "${CTDB_PUBLIC_ADDRESSES:-/etc/ctdb/public_addresses}" && \
@@ -70,6 +77,7 @@ case "$1" in
recovered|updatenatgw|ipreallocated)
mypnn=$(ctdb pnn | cut -d: -f2)
+ set_natgw_capability
ensure_natgwmaster "$1"
delete_all
@@ -103,6 +111,7 @@ case "$1" in
;;
monitor)
+ set_natgw_capability
ensure_natgwmaster "$1"
;;