The branch, master has been updated via 1c0a627df1b510f49c65ffeb4474240c8856cdf2 (commit) via 30d9b634b16c3cc740e5e453ea5c21012b1fde88 (commit) via 516cdea0e73cf3f63b3303e22809834c8cbc64e4 (commit) via 45e2bc66abf9fcfeadcc279a656ed7fd1838920a (commit) via 1152215fc69217e4292762e28d193b7ea0e06ee3 (commit) via 542c70d6281d636ecd51502fbbf219f418bfac66 (commit) via 00736a21fc268c10b6a718731e56b3dbb7e60554 (commit) via 2ea9d3acfe7e8665685f54294f5edc9b8ffc2f3f (commit) via 41df1637c1d8a7b2f5a9974408db71b1f74cb2f2 (commit) via 5b77fd95bda5f1960aca952e1b759231890b56f3 (commit) via 044d302b41a2040642355401e3236fcecc3a620a (commit) via 50e330d0679614bee2e7bab028436e929f74ca50 (commit) via cfbff39e22e42f3997f637290748290833525714 (commit) via 9437d4809bfbbb5c6a32a610665333d2f641881d (commit) via 212d4b201c30804f69cffe4b7150d4b74bf2e54f (commit) via 49f077c475b078889ff0492fe7d567a64d6cb87c (commit) via e574b30257126679704b088c4334a8e7a53a9c3f (commit) via 79e2029f9bc078126e865aa715100a3870c7604b (commit) via e55f3a1577eff0182802b0341d865d961aeae1c7 (commit) via bda0da41aaf629a252cc361b73ebc5328f26ed04 (commit) via f12658aff125996ae45eea23241d8c3d0567b893 (commit) via 4a5d5935f4410a93a3343d85a24dbcddae2c4c20 (commit) via 25fd05505f61dc595c0ef25bb6e332274d5530e8 (commit) via f3413fb8b90c4d9f0c2c2a69825c66d080117193 (commit) via 484c46eaae056480baf050fd91868f2fd0537985 (commit) via 7764cf67a61bbf1caad5aa8e2d75a262b9da654c (commit) via b9af66032f3d96f2fe12b7a4fcc5e71d4a282365 (commit) via 63924ff372b066cd878b79e71f06de4c24c814a2 (commit) via 0a79ba2f1277a776347e2c3f04ce8419e0be62de (commit) via d0dec5b8e60316701fdd02150c4dd8f01aacbfda (commit) via 588172bcb6bf267339e2bd09e23d2c4904a27a41 (commit) from ed7d999214ee009e480c26410a04fa105028cb8e (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 1c0a627df1b510f49c65ffeb4474240c8856cdf2 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Oct 21 19:42:32 2013 +1100 ctdbd: Fix some errors in the popt configuration That 4th argument isn't a default or similar, so consistently make it 0. Signed-off-by: Martin Schwenke <mar...@meltin.net> Pair-programmed-with: Amitay Isaacs <ami...@gmail.com> commit 30d9b634b16c3cc740e5e453ea5c21012b1fde88 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Oct 18 16:43:26 2013 +1100 initscript: New configuration variable CTDB_DBDIR_STATE Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 516cdea0e73cf3f63b3303e22809834c8cbc64e4 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Oct 18 13:24:03 2013 +1100 scripts: Make detect_init_style() more readable Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 45e2bc66abf9fcfeadcc279a656ed7fd1838920a Author: Martin Schwenke <mar...@meltin.net> Date: Thu Oct 17 16:44:24 2013 +1100 eventscripts: Rework the iSCSI eventscript * It should run on "ipreallocated" instead of "recovered" * Variable name NODE -> ip since that's what it is * Simplify some logic Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 1152215fc69217e4292762e28d193b7ea0e06ee3 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Oct 17 16:20:18 2013 +1100 eventscripts: Don't update static routes on "recovered" event Routes only need to be updated when IPs have moved. IP takeover runs will generate "ipreallocated", which is enough. "recovered" always follows "ipreallocated" anyway, so avoid the redundancy. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 542c70d6281d636ecd51502fbbf219f418bfac66 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Oct 17 16:17:26 2013 +1100 eventscripts: NAT gateway script doesn't need to handle "recovered" event Any time a node changes flags in any significant way there will be a takeover run, which will generate an "ipreallocated" event. The "recovered" event always happens straight after a takeover run so we update the NAT gateway twice. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 00736a21fc268c10b6a718731e56b3dbb7e60554 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Oct 17 16:14:14 2013 +1100 eventscripts: Delete placeholder "recovered" and "shutdown" events Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 2ea9d3acfe7e8665685f54294f5edc9b8ffc2f3f Author: Martin Schwenke <mar...@meltin.net> Date: Thu Oct 17 16:13:21 2013 +1100 eventscripts: Clean up comment at the top of 00.ctdb Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 41df1637c1d8a7b2f5a9974408db71b1f74cb2f2 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Oct 17 16:00:39 2013 +1100 eventscripts: Remove reconfigure check from samba and winbind eventscripts There is no reconfigure code for these scripts so no need to check for reconfiguration. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 5b77fd95bda5f1960aca952e1b759231890b56f3 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Oct 17 15:58:25 2013 +1100 eventscripts: Remove reconfigure code from httpd eventscript Nothing ever (or has ever) set the "needs reconfigure" flag, so this code is unnecessary. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 044d302b41a2040642355401e3236fcecc3a620a Author: Martin Schwenke <mar...@meltin.net> Date: Thu Oct 17 15:23:35 2013 +1100 eventscripts: Fold ctdb_check_tcp_ports_ctdb() into ctdb_check_tcp_ports() A generic framework is no longer needed now that the "ctdb" checker is the only one left. Simplify the code. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 50e330d0679614bee2e7bab028436e929f74ca50 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Oct 17 11:02:54 2013 +1100 eventscripts: Remove TCP port checks other than the built-in CTDB one "ctdb checktcpport" is no longer experimental so the other checkers are no longer required. Remove tests related to the removed checkers. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit cfbff39e22e42f3997f637290748290833525714 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Oct 17 10:52:00 2013 +1100 scripts: Remove setting of PATH from functions file The current setting is inconsistent with settings on most systems, putting /bin before /sbin. Use of /usr/local/bin, which may be required on some systems, is also overridden. This can make it difficult to do interactive debugging of script problems. Rely on the system PATH instead. If system-specific changes need to be made then this can be done in a configuration file. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 9437d4809bfbbb5c6a32a610665333d2f641881d Author: Martin Schwenke <mar...@meltin.net> Date: Thu Oct 17 10:39:09 2013 +1100 tests/eventscripts: Run scripts under sh by default Some scripts are disabled by default so are no executable. Explicitly running them under sh allows them to be run without having to mess around and make them executable or similar. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 212d4b201c30804f69cffe4b7150d4b74bf2e54f Author: Martin Schwenke <mar...@meltin.net> Date: Tue Oct 15 16:44:45 2013 +1100 tests/eventscripts: New tests for 20.multipathd Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 49f077c475b078889ff0492fe7d567a64d6cb87c Author: Martin Schwenke <mar...@meltin.net> Date: Tue Oct 15 16:42:45 2013 +1100 eventscripts: Clean up 20.multipathd Reduce the complexity, including the depth of background processes. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit e574b30257126679704b088c4334a8e7a53a9c3f Author: Martin Schwenke <mar...@meltin.net> Date: Tue Oct 15 12:00:13 2013 +1100 eventscripts: NAT gateway script should export CTDB_NATGW_NODES Otherwise calls to "ctdb natgwlist" will not behave as expected if a non-standard file is used, since that command will use the default file location. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 79e2029f9bc078126e865aa715100a3870c7604b Author: Martin Schwenke <mar...@meltin.net> Date: Tue Oct 15 11:57:28 2013 +1100 scripts: Simplify script_log() to just look at CTDB_SYSLOG variable The old logic was actually wrong. If CTDB_LOGFILE is unset then a default is used, not syslog. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit e55f3a1577eff0182802b0341d865d961aeae1c7 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Oct 15 11:54:58 2013 +1100 scripts: Remove support for CTDB_OPTIONS configuration variable Allowing people to put random options in CTDB_OPTIONS complicates some logic (particularly around use of syslog). If we're going to have variables for options then let's make sure we have a variable for each option and make people use them. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit bda0da41aaf629a252cc361b73ebc5328f26ed04 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Oct 15 11:31:12 2013 +1100 scripts: Remove unused configuration variable CTDB_MANAGES_SCP Signed-off-by: Martin Schwenke <mar...@meltin.net> commit f12658aff125996ae45eea23241d8c3d0567b893 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Oct 15 11:29:23 2013 +1100 eventscripts: Deprecate NFS_SERVER_MODE, use CTDB_NFS_SERVER_MODE instead All CTDB configuration variables should start with CTDB_. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 4a5d5935f4410a93a3343d85a24dbcddae2c4c20 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Oct 14 13:54:39 2013 +1100 recoverd: Remove function reload_nodes_file() It is a 1 line wrapper around ctdb_load_nodes_file(), so use that instead. We need less code... :-) Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 25fd05505f61dc595c0ef25bb6e332274d5530e8 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Oct 14 12:50:08 2013 +1100 Revert "null out the pointer before we reload the nodes file" This reverts commit 4b0f32047e8bece0a052bdbe2209afe91b7e8ce3. This is not necessary. It just causes a memory leak. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit f3413fb8b90c4d9f0c2c2a69825c66d080117193 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Oct 11 15:53:40 2013 +1100 client: Fix a format string argument compiler warning Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 484c46eaae056480baf050fd91868f2fd0537985 Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Sep 27 18:02:39 2013 +1000 recoverd: Ignore failed flag updates on inactive nodes Signed-off-by: Amitay Isaacs <ami...@gmail.com> Pair-programmed-with: Martin Schwenke <mar...@meltin.net> commit 7764cf67a61bbf1caad5aa8e2d75a262b9da654c Author: Amitay Isaacs <ami...@gmail.com> Date: Thu Sep 26 18:47:27 2013 +1000 common/util: Use AIX specific code for setting high priority for CTDB daemon Signed-off-by: Amitay Isaacs <ami...@gmail.com> commit b9af66032f3d96f2fe12b7a4fcc5e71d4a282365 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Oct 11 15:09:11 2013 +1100 git: Ignore generated documentation files Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 63924ff372b066cd878b79e71f06de4c24c814a2 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Oct 11 15:05:54 2013 +1100 tests: When running local tests with run_tests.sh, use fixed TEST_VAR_DIR Otherwise we end up with lots of useless temporary directories. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 0a79ba2f1277a776347e2c3f04ce8419e0be62de Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 26 20:58:50 2013 +1000 eventscripts: Fix comment - CTDB_TCP_PORT_CHECKS -> CTDB_TCP_PORT_CHECKERS Signed-off-by: Martin Schwenke <mar...@meltin.net> commit d0dec5b8e60316701fdd02150c4dd8f01aacbfda Author: Martin Schwenke <mar...@meltin.net> Date: Mon Sep 23 16:24:46 2013 +1000 tests/integration: Tweak ctdbd startup options * --public-interface is not needed * Add --sloppy-start to speed up restarts Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 588172bcb6bf267339e2bd09e23d2c4904a27a41 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 26 13:11:04 2013 +1000 recoverd: Fix the VNN lmaster consistency check It does cope with node that don't have the lmaster capability. Signed-off-by: Martin Schwenke <mar...@meltin.net> Pair-programmed-with: Amitay Isaacs <ami...@gmail.com> ----------------------------------------------------------------------- Summary of changes: .gitignore | 2 + client/ctdb_client.c | 2 +- common/ctdb_util.c | 54 ++++++++- config/ctdb.sysconfig | 4 - config/ctdbd_wrapper | 20 ++-- config/events.d/00.ctdb | 12 +-- config/events.d/10.interface | 11 -- config/events.d/11.natgw | 15 +-- config/events.d/11.routing | 2 +- config/events.d/20.multipathd | 101 +++++++--------- config/events.d/41.httpd | 7 - config/events.d/49.winbind | 2 - config/events.d/50.samba | 2 - config/events.d/60.ganesha | 2 +- config/events.d/60.nfs | 2 +- config/events.d/70.iscsi | 24 ++-- config/functions | 152 +++-------------------- config/statd-callout | 2 +- configure.ac | 3 + server/ctdb_recoverd.c | 37 +++--- server/ctdbd.c | 4 +- tests/eventscripts/20.multipathd.monitor.001.sh | 11 ++ tests/eventscripts/20.multipathd.monitor.002.sh | 11 ++ tests/eventscripts/20.multipathd.monitor.003.sh | 14 ++ tests/eventscripts/20.multipathd.monitor.004.sh | 15 +++ tests/eventscripts/50.samba.monitor.108.sh | 15 --- tests/eventscripts/50.samba.monitor.109.sh | 29 ----- tests/eventscripts/50.samba.monitor.110.sh | 32 ----- tests/eventscripts/50.samba.monitor.111.sh | 20 --- tests/eventscripts/scripts/local.sh | 41 +++++- tests/eventscripts/stubs/multipath | 36 ++++++ tests/run_tests.sh | 6 + tests/scripts/integration.bash | 12 +-- 33 files changed, 304 insertions(+), 398 deletions(-) create mode 100755 tests/eventscripts/20.multipathd.monitor.001.sh create mode 100755 tests/eventscripts/20.multipathd.monitor.002.sh create mode 100755 tests/eventscripts/20.multipathd.monitor.003.sh create mode 100755 tests/eventscripts/20.multipathd.monitor.004.sh delete mode 100755 tests/eventscripts/50.samba.monitor.108.sh delete mode 100755 tests/eventscripts/50.samba.monitor.109.sh delete mode 100755 tests/eventscripts/50.samba.monitor.110.sh delete mode 100755 tests/eventscripts/50.samba.monitor.111.sh create mode 100755 tests/eventscripts/stubs/multipath Changeset truncated at 500 lines: diff --git a/.gitignore b/.gitignore index a76dc38..9e8c581 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,5 @@ tests/eventscripts/etc/iproute2 tests/eventscripts/etc-ctdb/policy_routing include/ctdb_version.h packaging/RPM/ctdb.spec +doc/*.[1-7] +doc/*.[1-7].html diff --git a/client/ctdb_client.c b/client/ctdb_client.c index 9c1c27d..6ccc4c9 100644 --- a/client/ctdb_client.c +++ b/client/ctdb_client.c @@ -3827,7 +3827,7 @@ static bool g_lock_parse(TALLOC_CTX *mem_ctx, TDB_DATA data, if (data.dsize % sizeof(struct g_lock_rec) != 0) { DEBUG(DEBUG_ERR, (__location__ "invalid data size %lu in g_lock record\n", - data.dsize)); + (unsigned long)data.dsize)); talloc_free(recs); return false; } diff --git a/common/ctdb_util.c b/common/ctdb_util.c index d4bfeeb..d4f8541 100644 --- a/common/ctdb_util.c +++ b/common/ctdb_util.c @@ -322,17 +322,45 @@ struct ctdb_rec_data *ctdb_marshall_loop_next(struct ctdb_marshall_buffer *m, st #include <sched.h> #endif +#if HAVE_PROCINFO_H +#include <procinfo.h> +#endif + /* if possible, make this task real time */ void ctdb_set_scheduler(struct ctdb_context *ctdb) { -#if HAVE_SCHED_SETSCHEDULER +#ifdef _AIX_ +#if HAVE_THREAD_SETSCHED + struct thrdentry64 te; + tid64_t ti; + + ti = 0ULL; + if (getthrds64(getpid(), &te, sizeof(te), &ti, 1) != 1) { + DEBUG(DEBUG_ERR, ("Unable to get thread information\n")); + return; + } + + if (ctdb->saved_scheduler_param == NULL) { + ctdb->saved_scheduler_param = talloc_size(ctdb, sizeof(te)); + } + *(struct thrdentry64 *)ctdb->saved_scheduler_param = te; + + if (thread_setsched(te.ti_tid, 0, SCHED_RR) == -1) { + DEBUG(DEBUG_ERR, ("Unable to set scheduler to SCHED_RR (%s)\n", + strerror(errno))); + } else { + DEBUG(DEBUG_NOTICE, ("Set scheduler to SCHED_RR\n")); + } +#endif +#else /* no AIX */ +#if HAVE_SCHED_SETSCHEDULER struct sched_param p; if (ctdb->saved_scheduler_param == NULL) { ctdb->saved_scheduler_param = talloc_size(ctdb, sizeof(p)); } - + if (sched_getparam(0, (struct sched_param *)ctdb->saved_scheduler_param) == -1) { DEBUG(DEBUG_ERR,("Unable to get old scheduler params\n")); return; @@ -348,6 +376,7 @@ void ctdb_set_scheduler(struct ctdb_context *ctdb) DEBUG(DEBUG_NOTICE,("Set scheduler to SCHED_FIFO\n")); } #endif +#endif } /* @@ -355,7 +384,25 @@ void ctdb_set_scheduler(struct ctdb_context *ctdb) */ void ctdb_restore_scheduler(struct ctdb_context *ctdb) { -#if HAVE_SCHED_SETSCHEDULER +#ifdef _AIX_ +#if HAVE_THREAD_SETSCHED + struct thrdentry64 te, *saved; + tid64_t ti; + + ti = 0ULL; + if (getthrds64(getpid(), &te, sizeof(te), &ti, 1) != 1) { + ctdb_fatal(ctdb, "Unable to get thread information\n"); + } + if (ctdb->saved_scheduler_param == NULL) { + ctdb_fatal(ctdb, "No saved scheduler parameters\n"); + } + saved = (struct thrdentry64 *)ctdb->saved_scheduler_param; + if (thread_setsched(te.ti_tid, saved->ti_pri, saved->ti_policy) == -1) { + ctdb_fatal(ctdb, "Unable to restore old scheduler parameters\n"); + } +#endif +#else /* no AIX */ +#if HAVE_SCHED_SETSCHEDULER if (ctdb->saved_scheduler_param == NULL) { ctdb_fatal(ctdb, "No saved scheduler parameters\n"); } @@ -363,6 +410,7 @@ void ctdb_restore_scheduler(struct ctdb_context *ctdb) ctdb_fatal(ctdb, "Unable to restore old scheduler parameters\n"); } #endif +#endif } void set_nonblocking(int fd) diff --git a/config/ctdb.sysconfig b/config/ctdb.sysconfig index 6b7af67..8233f27 100644 --- a/config/ctdb.sysconfig +++ b/config/ctdb.sysconfig @@ -334,7 +334,3 @@ CTDB_SERVICE_AUTOSTARTSTOP=yes # for example # CTDB_SET_TRAVERSETIMEOUT=60 # you can get a list of variables using "ctdb listvars" - -# any other options you might want. Run ctdbd --help for a list -# CTDB_OPTIONS= - diff --git a/config/ctdbd_wrapper b/config/ctdbd_wrapper index fbc76cf..f0b032d 100755 --- a/config/ctdbd_wrapper +++ b/config/ctdbd_wrapper @@ -79,6 +79,7 @@ ctdbd_is_running () build_ctdb_options () { + ctdb_options="" maybe_set () { @@ -99,7 +100,7 @@ build_ctdb_options () sep="" fi - CTDB_OPTIONS="${CTDB_OPTIONS}${CTDB_OPTIONS:+ }${1}${sep}${val}" + ctdb_options="${ctdb_options}${ctdb_options:+ }${1}${sep}${val}" } if [ -z "$CTDB_RECOVERY_LOCK" ] ; then @@ -109,7 +110,7 @@ build_ctdb_options () maybe_set "--pidfile" "$pidfile" - # build up CTDB_OPTIONS variable from optional parameters + # build up ctdb_options variable from optional parameters maybe_set "--logfile" "$CTDB_LOGFILE" maybe_set "--nlist" "$CTDB_NODES" maybe_set "--socket" "$CTDB_SOCKET" @@ -117,6 +118,7 @@ build_ctdb_options () maybe_set "--public-interface" "$CTDB_PUBLIC_INTERFACE" maybe_set "--dbdir" "$CTDB_DBDIR" maybe_set "--dbdir-persistent" "$CTDB_DBDIR_PERSISTENT" + maybe_set "--dbdir-state" "$CTDB_DBDIR_STATE" maybe_set "--event-script-dir" "$CTDB_EVENT_SCRIPT_DIR" maybe_set "--transport" "$CTDB_TRANSPORT" maybe_set "-d" "$CTDB_DEBUGLEVEL" @@ -181,18 +183,14 @@ start() else ctdbd="${CTDB_VALGRIND} ${ctdbd}" fi - CTDB_OPTIONS="${CTDB_OPTIONS} --valgrinding" + ctdb_options="${ctdb_options} --valgrinding" fi - # This is ugly but will improve when we get rid of $CTDB_OPTIONS - # and use only $CTDB_SYSLOG. - case "$CTDB_OPTIONS" in - *--syslog*) : ;; - *) - logger -t ctdbd "CTDB is being run without syslog enabled. Logs will be in ${CTDB_LOGFILE:-/var/log/log.ctdb}" - esac + if [ "$CTDB_SYSLOG" != "yes" ] ; then + logger -t ctdbd "CTDB is being run without syslog enabled. Logs will be in ${CTDB_LOGFILE:-/var/log/log.ctdb}" + fi - eval "$ctdbd" "$CTDB_OPTIONS" || return 1 + eval "$ctdbd" "$ctdb_options" || return 1 # Wait until ctdbd has started and is ready to respond to clients. _pid="" diff --git a/config/events.d/00.ctdb b/config/events.d/00.ctdb index 6bd35ed..880d07f 100755 --- a/config/events.d/00.ctdb +++ b/config/events.d/00.ctdb @@ -1,13 +1,7 @@ #!/bin/sh -############################ -# main event script for ctdb -# -# This script is called with one of the following sets of arguments -# startup : called when ctdb starts -# shutdown : called when ctdb shuts down -# takeip : called when an IP address is taken over -# releaseip : called when an IP address is released -# recovered : called when ctdb has finished a recovery event + +# Event script for ctdb-specific setup and other things that don't fit +# elsewhere. [ -n "$CTDB_BASE" ] || \ export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD") diff --git a/config/events.d/10.interface b/config/events.d/10.interface index 5379ea8..f44c674 100755 --- a/config/events.d/10.interface +++ b/config/events.d/10.interface @@ -262,17 +262,6 @@ case "$1" in ;; - - ########################################### - # called when ctdbd has finished a recovery - recovered) - ;; - - #################################### - # called when ctdbd is shutting down - shutdown) - ;; - monitor) monitor_interfaces || exit 1 ;; diff --git a/config/events.d/11.natgw b/config/events.d/11.natgw index 9faba80..8555005 100755 --- a/config/events.d/11.natgw +++ b/config/events.d/11.natgw @@ -11,7 +11,8 @@ . $CTDB_BASE/functions loadconfig -[ -z "$CTDB_NATGW_NODES" ] && exit 0 +[ -n "$CTDB_NATGW_NODES" ] || exit 0 +export CTDB_NATGW_NODES set_natgw_capability () { @@ -49,14 +50,8 @@ ensure_natgwmaster () natgwip="$2" if [ "$natgwmaster" = "-1" ]; then - echo "There is no NATGW master node" - # The recovered event should never fail - we'll catch this - # failure in the monitor event. - if [ "$_event" = "recovered" ] ; then - exit 0 - else - exit 1 - fi + # Fail... + die "There is no NATGW master node" fi } @@ -74,7 +69,7 @@ case "$1" in echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce ;; - recovered|updatenatgw|ipreallocated) + updatenatgw|ipreallocated) mypnn=$(ctdb pnn | cut -d: -f2) set_natgw_capability diff --git a/config/events.d/11.routing b/config/events.d/11.routing index f3e972b..ccc60e7 100755 --- a/config/events.d/11.routing +++ b/config/events.d/11.routing @@ -23,7 +23,7 @@ loadconfig } case "$1" in - recovered|ipreallocated) + ipreallocated) while read iface dest gw; do ip route add "$dest" via "$gw" dev "$iface" >/dev/null 2>&1 done <"${CTDB_BASE}/static-routes" diff --git a/config/events.d/20.multipathd b/config/events.d/20.multipathd index c2956d2..64748da 100755 --- a/config/events.d/20.multipathd +++ b/config/events.d/20.multipathd @@ -15,78 +15,65 @@ service_name="multipathd" loadconfig -[ -z "$CTDB_MONITOR_MPDEVICES" ] && { - exit 0 -} +[ -n "$CTDB_MONITOR_MPDEVICES" ] || exit 0 ctdb_setup_service_state_dir -MPFAILURE="$service_state_dir/failure" +multipath_fail="${service_state_dir}/fail" multipathd_check_background() { - for DEVICE in $CTDB_MONITOR_MPDEVICES; do - # check that we can see all devices - if [ -z "`multipath -ll $DEVICE`" ]; then - echo Device $DEVICE not known to multipathd - exit 1 - fi - - # check that all devices are active - if [ -z "`multipath -ll $DEVICE|grep prio|grep active`" ]; then - echo Device $DEVICE has no active paths - exit 1 - fi - done - exit 0 + for _device in $CTDB_MONITOR_MPDEVICES; do + # Check multipath knows about the device + _out=$(multipath -ll "$_device") + if [ -z "$_out" ] ; then + echo "device \"${_device}\" not known to multipathd" >"$multipath_fail" + exit 1 + fi + + # Check for at least 1 active path + if ! echo "$_out" | grep 'prio=.* status=active' >/dev/null 2>&1 ; then + echo "multipath device \"${_device}\" has no active paths" >"$multipath_fail" + exit 1 + fi + done + exit 0 } multipathd_check() { - # run the actual check in the background since the call to - # multipath may block. - ( - multipathd_check_background & - pid="$!" - timeleft=10 - - while [ $timeleft -gt 0 ]; do - timeleft=$(($timeleft - 1)) - - # see if the process still exists - kill -0 $pid > /dev/null 2>&1 || { - # it doesn't exist, grab its exit status - wait $pid - [ $? = 0 ] || { - echo "20.multipathd: multipath background update exited with status $?" - touch $MPFAILURE - exit 1 - } - rm $MPFAILURE 2>/dev/null - exit 0 - } - sleep 1 - done - echo "20.multipathd: Callout to multipath checks hung." - touch $MPFAILURE - exit 1 - ) & - - if [ -f $MPFAILURE ]; then - return 1 - else + # Run the actual check in the background since the call to + # multipath may block + multipathd_check_background </dev/null >/dev/null 2>&1 & + _pid="$!" + _timeleft=10 + + while [ $_timeleft -gt 0 ]; do + _timeleft=$(($_timeleft - 1)) + + # see if the process still exists + kill -0 $_pid >/dev/null 2>&1 || { + if wait $_pid ; then return 0 - fi + else + echo -n "ERROR: " + cat "$multipath_fail" + rm -f "$multipath_fail" + return 1 + fi + } + sleep 1 + done + + echo "ERROR: callout to multipath checks hung" + # If hung then this probably won't work, but worth trying... + kill -9 $_pid >/dev/null 2>&1 + return 1 } case "$1" in monitor) - multipathd_check - [ "$?" = "0" ] || { - echo 20.multipathd: monitoring of multipathing failed - exit 1 - } - exit 0 + multipathd_check || die "multipath monitoring failed" ;; *) diff --git a/config/events.d/41.httpd b/config/events.d/41.httpd index 3baa784..ac0c941 100755 --- a/config/events.d/41.httpd +++ b/config/events.d/41.httpd @@ -41,19 +41,12 @@ service_stop () killall -q -9 $service_name || true } -service_reconfigure () -{ - service $service_name restart -} - loadconfig ctdb_start_stop_service is_ctdb_managed_service || exit 0 -ctdb_service_check_reconfigure - case "$1" in startup) ctdb_service_start diff --git a/config/events.d/49.winbind b/config/events.d/49.winbind index ef4eb3f..dee3c90 100755 --- a/config/events.d/49.winbind +++ b/config/events.d/49.winbind @@ -40,8 +40,6 @@ ctdb_start_stop_service is_ctdb_managed_service || exit 0 -ctdb_service_check_reconfigure - ########################### case "$1" in diff --git a/config/events.d/50.samba b/config/events.d/50.samba index ccc6864..117b459 100755 --- a/config/events.d/50.samba +++ b/config/events.d/50.samba @@ -152,8 +152,6 @@ ctdb_start_stop_service is_ctdb_managed_service || exit 0 -ctdb_service_check_reconfigure - ########################### case "$1" in diff --git a/config/events.d/60.ganesha b/config/events.d/60.ganesha index 70c4cdb..aa7db90 100755 --- a/config/events.d/60.ganesha +++ b/config/events.d/60.ganesha @@ -40,7 +40,7 @@ loadconfig "nfs" service_name="nfs-ganesha-$CTDB_CLUSTER_FILESYSTEM_TYPE" -[ "$NFS_SERVER_MODE" = "ganesha" ] || exit 0 +[ "${CTDB_NFS_SERVER_MODE:-${NFS_SERVER_MODE}}" = "ganesha" ] || exit 0 ctdb_setup_service_state_dir diff --git a/config/events.d/60.nfs b/config/events.d/60.nfs index 53f78df..bd6cc7f 100755 --- a/config/events.d/60.nfs +++ b/config/events.d/60.nfs @@ -51,7 +51,7 @@ nfs_check_thread_count () loadconfig -[ "$NFS_SERVER_MODE" != "ganesha" ] || exit 0 +[ "${CTDB_NFS_SERVER_MODE:-${NFS_SERVER_MODE}}" != "ganesha" ] || exit 0 ctdb_setup_service_state_dir diff --git a/config/events.d/70.iscsi b/config/events.d/70.iscsi index a840b4d..cedaf40 100755 --- a/config/events.d/70.iscsi +++ b/config/events.d/70.iscsi @@ -20,31 +20,33 @@ is_ctdb_managed_service || exit 0 } case "$1" in - recovered) -- CTDB repository