[SCM] Samba Shared Repository - branch master updated

Martin Schwenke martins at samba.org
Thu Mar 1 23:39:04 UTC 2018


The branch, master has been updated
       via  426e4a5 ctdb-pmda: Use modified API in pcp library 4.0
       via  4bb8a62 ctdb-tests: Generalise SM_NOTIFY output format in statd-callout tests
       via  95888c8 ctdb-scripts: Clean up statd-callout
       via  11c4bb1 ctdb-tests: Exit on statd-callout sub-test failure
       via  2ad1604 ctdb-scripts: Avoid no-op "ctdb ptrans" call
       via  9a12d6a ctdb-tools: Reindent parts of onnode
       via  8f9ac94 ctdb-tools: Remove test hooks from onnode
       via  53fea36 ctdb-tests: Use fake ssh script for onnode in local daemons tests
       via  d1ff946 ctdb-tests: Add fake ssh command for local daemons tests
       via  254a184 ctdb-tools: Revisit stray file descriptor avoidance in onnode
       via  248c374 ctdb-tools: Introduce a variable to hold the ssh command
       via  9260ca2 ctdb-tools: Change onnode to use ONNODE_SSH and ONNODE_SSH_OPTS
       via  ca31520 ctdb-common: Drop debugging variable CTDB_EXTERNAL_TRACE
       via  86f6481 ctdb-tests: Avoid creating files in /tmp.
       via  e0e6e40 ctdb-tests: Check for errors when adding stubs/ subdirectory to PATH
       via  99350c1 ctdb-tests: Clean up PATH setting for stubs/ subdirectory
       via  5537b36 ctdb-tests: Drop unneccessary unset of variable
       via  bb03532 ctdb-tests: Use consistent NAT gateway nodes file
       via  1c2361a ctdb-tests: Fix a double-typo bug
       via  c8dfd4f ctdb-scripts: Add default for public addresses file where missing
       via  0519c51 ctdb-scripts: Do not use ctdb_service_reconfigure() for policy routing
       via  61a0ae9 ctdb-packaging: Package event scripts via a wildcard
       via  1e18edc ctdb-packaging: Make the ctdb package own more directories
      from  33fa677 wafsamba: Build with -Wimplicit-fallthrough if supported

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 426e4a5a20cff73a80d80b46f15826deac3f934f
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Mar 1 12:32:26 2018 +1100

    ctdb-pmda: Use modified API in pcp library 4.0
    
    Support backward compatibility by checking for __pmID_int type, which
    was previously in <pcp/impl.h>.  In the new version, this type is not
    defined anymore and there is no need to include <pcp/impl.h>.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Fri Mar  2 00:38:52 CET 2018 on sn-devel-144

commit 4bb8a6222a7b24c8877aa8a799d6b10187f8259f
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Mar 2 21:55:54 2017 +1100

    ctdb-tests: Generalise SM_NOTIFY output format in statd-callout tests
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 95888c8e1a491ef58333714fe545d5651d05cc1a
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Mar 2 16:43:51 2017 +1100

    ctdb-scripts: Clean up statd-callout
    
    This means there will be 2 loops reading the data but the code flow is
    much more obvious.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 11c4bb110bad2a2ca213f1703a5a1408705ae0d8
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Mar 2 21:35:03 2017 +1100

    ctdb-tests: Exit on statd-callout sub-test failure
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 2ad1604c2baa547ad881dc75cbb47722d0af651b
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jan 4 09:53:54 2017 +1100

    ctdb-scripts: Avoid no-op "ctdb ptrans" call
    
    This causes unnecessary g_lock activity and overhead.
    
    This could be optimised in ctdb.c:control_ptrans().  However, that
    makes the code more complex.  Let's only do that if we get more
    potentially no-op uses.
    
    Note no optimisation is needed in the "notify" case because there is
    already an early exit if there are no items.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 9a12d6af0553207809ad1e882df25fbcb00c22a2
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 27 13:59:50 2018 +1100

    ctdb-tools: Reindent parts of onnode
    
    No functional changes.  Best viewed with diff/show -w to avoid
    whitespace differences.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 8f9ac941902c587b9920e1ff4be77d6d4e3bbe4b
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 28 15:11:56 2018 +1100

    ctdb-tools: Remove test hooks from onnode
    
    CTDB_NODES_SOCKETS is no longer used.  The test code uses ONNODE_SSH
    to run a fake ssh client.
    
    Leave indenting sloppy and fix it in the next commit so that this
    change is clear.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 53fea36b6e2dd8b44bbe6e011208cabfd21d1a58
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 27 12:13:37 2018 +1100

    ctdb-tests: Use fake ssh script for onnode in local daemons tests
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit d1ff94686ab7541827f9b8e0e40899d5cf5a4c83
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 27 12:12:45 2018 +1100

    ctdb-tests: Add fake ssh command for local daemons tests
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 254a18422c567a591d7e99ff6d1d0678d985c5fa
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 27 15:12:26 2018 +1100

    ctdb-tools: Revisit stray file descriptor avoidance in onnode
    
    Commit 635da189dccef6516d490c228407b9987986c578 fixed a problem where
    a stray file descriptor leaked into a subshell.
    
    Explicitly close the file descriptor at the outermost possible point
    rather than relying on fakessh() to do it.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 248c37413756c582f50b820fafb03d59fa2e0f99
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 28 15:02:03 2018 +1100

    ctdb-tools: Introduce a variable to hold the ssh command
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 9260ca217fd58903f924bba48515365f2f2228df
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 27 12:11:54 2018 +1100

    ctdb-tools: Change onnode to use ONNODE_SSH and ONNODE_SSH_OPTS
    
    Instead of more generic SSH and EXTRA_SSH_OPTS.
    
    Quietly drop reference to rsh in case it gives anyone ideas.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit ca315203beab08649993285d0bf6b7a29b542887
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 20 18:32:04 2018 +1100

    ctdb-common: Drop debugging variable CTDB_EXTERNAL_TRACE
    
    This was an attempt to debug an unexpected situation.  It never
    triggered, so delete it and all supporting code.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 86f6481e996bb65cd71f7a946aec4964c89599d5
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 13 11:55:07 2018 +1100

    ctdb-tests: Avoid creating files in /tmp.
    
    Temporary test data should all go somewhere under TEST_VAR_DIR instead
    of in the global /tmp.  The existing mktemp could be changed so the
    data goes into the test directory but mktemp is overkill in this case.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit e0e6e40d17da94d0e8688c01701d222f72343aac
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 7 13:28:59 2018 +1100

    ctdb-tests: Check for errors when adding stubs/ subdirectory to PATH
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 99350c18aadb0345051f9a21111da1cae3eabe55
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 6 16:41:36 2018 +1100

    ctdb-tests: Clean up PATH setting for stubs/ subdirectory
    
    Drop unnecessary PATH setting in rc.local. The functions file no
    longer sets PATH so setting it here is unnecessary.  Fix a comment
    referencing this PATH setting.
    
    Given EVENTSCRIPTS_PATH is no longer used, use a more obvious variable
    name and fail on missing stubs/ subdirectory.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 5537b36817925cb00ef142d5c7a17f5336133eed
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 7 13:25:58 2018 +1100

    ctdb-tests: Drop unneccessary unset of variable
    
    The comment is incorrect.  This is only set when running simple tests
    on local daemons.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit bb03532cdd5df62cd70d4e8402745f1dbfbfeaaa
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Feb 12 11:34:57 2018 +1100

    ctdb-tests: Use consistent NAT gateway nodes file
    
    Using a different file each time causes the event script to believe
    that the configuration has changed even though only the node states
    have changed.  Change this to stop the tests from doing something
    unexpected.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 1c2361a5f736bb14fa809a7071b1ebf08f560f8d
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 9 21:18:03 2018 +1100

    ctdb-tests: Fix a double-typo bug
    
    Amazingly, the code actually works!  Understanding why is homework for
    real shell experts, who are not necessarily created ==!
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit c8dfd4fe5a5ef8a368406d2afef58cbf8f162ca5
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Feb 22 18:48:23 2018 +1100

    ctdb-scripts: Add default for public addresses file where missing
    
    This makes it consistent with the rest of the script code.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 0519c513adc7c6f024c50facfb8a963fedd3e1b7
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 6 12:00:31 2018 +1100

    ctdb-scripts: Do not use ctdb_service_reconfigure() for policy routing
    
    This is an unconditional reconfiguration so skip the unnecessary
    logic.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 61a0ae91611fef66cea4009a950736d3bc522961
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 16 14:04:04 2018 +1100

    ctdb-packaging: Package event scripts via a wildcard
    
    This avoids churn as event scripts are renamed and moved about.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 1e18edc76ad53c734be1db2983e9ee7c23feebd3
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 16 14:03:07 2018 +1100

    ctdb-packaging: Make the ctdb package own more directories
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/common/common.h                           |   2 -
 ctdb/common/ctdb_util.c                        |  31 -----
 ctdb/config/ctdbd_wrapper                      |   1 -
 ctdb/config/events.d/13.per_ip_routing         |  21 ++--
 ctdb/config/functions                          |   2 +-
 ctdb/config/gcore_trace.sh                     |   3 -
 ctdb/config/statd-callout                      | 109 ++++++++--------
 ctdb/doc/onnode.1.xml                          |  22 ++--
 ctdb/packaging/RPM/ctdb.spec.in                |  24 +---
 ctdb/tests/eventscripts/11.natgw.015.sh        |   5 +-
 ctdb/tests/eventscripts/11.natgw.025.sh        |   4 +-
 ctdb/tests/eventscripts/etc-ctdb/rc.local      |   1 -
 ctdb/tests/eventscripts/scripts/local.sh       |  53 ++++----
 ctdb/tests/eventscripts/stubs/ip               |   3 +-
 ctdb/tests/eventscripts/stubs/smnotify         |  40 +++++-
 ctdb/tests/onnode/scripts/local.sh             |  12 +-
 ctdb/tests/simple/scripts/local_daemons.bash   |   3 +
 ctdb/tests/simple/scripts/ssh_local_daemons.sh |  42 +++++++
 ctdb/tools/onnode                              | 167 ++++++++++++-------------
 ctdb/utils/pmda/pmda_ctdb.c                    |  30 +++--
 ctdb/wscript                                   |   2 +-
 21 files changed, 301 insertions(+), 276 deletions(-)
 delete mode 100755 ctdb/config/gcore_trace.sh
 create mode 100755 ctdb/tests/simple/scripts/ssh_local_daemons.sh


Changeset truncated at 500 lines:

diff --git a/ctdb/common/common.h b/ctdb/common/common.h
index 1b276ca..02bb746 100644
--- a/ctdb/common/common.h
+++ b/ctdb/common/common.h
@@ -103,8 +103,6 @@ bool ctdb_set_helper(const char *type, char *helper, size_t size,
 		     const char *envvar,
 		     const char *dir, const char *file);
 
-void ctdb_external_trace(void);
-
 int ctdb_parse_address(TALLOC_CTX *mem_ctx, const char *str,
 		       ctdb_sock_addr *address);
 
diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c
index 82526b5..cbab367 100644
--- a/ctdb/common/ctdb_util.c
+++ b/ctdb/common/ctdb_util.c
@@ -136,36 +136,6 @@ bool ctdb_set_helper(const char *type, char *helper, size_t size,
 	return true;
 }
 
-/* Invoke an external program to do some sort of tracing on the CTDB
- * process.  This might block for a little while.  The external
- * program is specified by the environment variable
- * CTDB_EXTERNAL_TRACE.  This program should take one argument: the
- * pid of the process to trace.  Commonly, the program would be a
- * wrapper script around gcore.
- */
-void ctdb_external_trace(void)
-{
-	int ret;
-	static char external_trace[PATH_MAX+1] = "";
-	char * cmd;
-
-	if (!ctdb_set_helper("external trace handler",
-			     external_trace, sizeof(external_trace),
-			     "CTDB_EXTERNAL_TRACE", NULL, NULL)) {
-		return;
-	}
-
-	cmd = talloc_asprintf(NULL, "%s %lu", external_trace, (unsigned long) getpid());
-	DEBUG(DEBUG_WARNING,("begin external trace: %s\n", cmd));
-	ret = system(cmd);
-	if (ret == -1) {
-		DEBUG(DEBUG_ERR,
-		      ("external trace command \"%s\" failed\n", cmd));
-	}
-	DEBUG(DEBUG_WARNING,("end external trace: %s\n", cmd));
-	talloc_free(cmd);
-}
-
 /*
   parse a IP:port pair
 */
@@ -462,7 +432,6 @@ char *ctdb_addr_to_str(ctdb_sock_addr *addr)
 		break;
 	default:
 		DEBUG(DEBUG_ERR, (__location__ " ERROR, unknown family %u\n", addr->sa.sa_family));
-		ctdb_external_trace();
 	}
 
 	return cip;
diff --git a/ctdb/config/ctdbd_wrapper b/ctdb/config/ctdbd_wrapper
index 8eec379..a958786 100755
--- a/ctdb/config/ctdbd_wrapper
+++ b/ctdb/config/ctdbd_wrapper
@@ -148,7 +148,6 @@ build_ctdb_options ()
 export_debug_variables ()
 {
     [ -n "$CTDB_DEBUG_HUNG_SCRIPT" ] && export CTDB_DEBUG_HUNG_SCRIPT
-    [ -n "$CTDB_EXTERNAL_TRACE" ] && export CTDB_EXTERNAL_TRACE
     [ -n "$CTDB_DEBUG_LOCKS" ] && export CTDB_DEBUG_LOCKS
 }
 
diff --git a/ctdb/config/events.d/13.per_ip_routing b/ctdb/config/events.d/13.per_ip_routing
index 4fff73b..191d947 100755
--- a/ctdb/config/events.d/13.per_ip_routing
+++ b/ctdb/config/events.d/13.per_ip_routing
@@ -207,7 +207,7 @@ get_config_for_ip ()
 	    if [ "$_ip" = "$_i" ] ; then
 		printf "%s" "$_ip "; ipv4_host_addr_to_net "$_ip" "$_maskbits"
 	    fi
-	done <"${CTDB_PUBLIC_ADDRESSES:-/dev/null}"
+	done <"${CTDB_PUBLIC_ADDRESSES:-${CTDB_BASE}/public_addresses}"
     else
 	while read _i _rest ; do
 	    if [ "$_ip" = "$_i" ] ; then
@@ -354,17 +354,6 @@ remove_bogus_routes ()
 
 ######################################################################
 
-service_reconfigure ()
-{
-    add_missing_routes "force"
-    remove_bogus_routes
-
-    # flush our route cache
-    set_proc sys/net/ipv4/route/flush 1
-}
-
-######################################################################
-
 ctdb_check_args "$@"
 
 case "$1" in
@@ -435,7 +424,13 @@ ipreallocated)
 	;;
 
 reconfigure)
-	ctdb_service_reconfigure
+	echo "Reconfiguring service \"${service_name}\"..."
+
+	add_missing_routes "force"
+	remove_bogus_routes
+
+	# flush our route cache
+	set_proc sys/net/ipv4/route/flush 1
 	;;
 esac
 
diff --git a/ctdb/config/functions b/ctdb/config/functions
index 3805d48..68149c6 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -592,7 +592,7 @@ drop_all_public_ips ()
 	# shellcheck disable=SC2034
 	while read _ip _x ; do
 		drop_ip "$_ip"
-	done <"${CTDB_PUBLIC_ADDRESSES:-/dev/null}"
+	done <"${CTDB_PUBLIC_ADDRESSES:-${CTDB_BASE}/public_addresses}"
 }
 
 flush_route_cache ()
diff --git a/ctdb/config/gcore_trace.sh b/ctdb/config/gcore_trace.sh
deleted file mode 100755
index 4d3e1d1..0000000
--- a/ctdb/config/gcore_trace.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-gcore -o "/var/log/core" "$1" 2>&1 | logger -t "ctdb:gcore_trace"
diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout
index 38f847b..6c85527 100755
--- a/ctdb/config/statd-callout
+++ b/ctdb/config/statd-callout
@@ -26,9 +26,7 @@ loadconfig nfs
 [ -n "$NFS_HOSTNAME" ] || \
     die "NFS_HOSTNAME is not configured. statd-callout failed"
 
-# A handy newline
-nl="
-"
+############################################################
 
 service_state_dir=$(ctdb_setup_service_state_dir "statd-callout") || exit $?
 
@@ -37,6 +35,56 @@ cd "$service_state_dir" || \
 
 pnn=$(ctdb_get_pnn)
 
+############################################################
+
+send_notifies ()
+{
+	_smnotify="${CTDB_HELPER_BINDIR}/smnotify"
+
+	# State must monotonically increase, across the entire
+	# cluster.  Use seconds since epoch and hope the time is in
+	# sync across nodes.  Even numbers mean service is shut down,
+	# odd numbers mean service is started.
+
+	# Intentionally round to an even number
+	# shellcheck disable=SC2017
+	_state_even=$(( $(date '+%s') / 2 * 2))
+
+	_prev=""
+	while read _sip _cip ; do
+		# NOTE: Consider optimising smnotify to read all the
+		# data from stdin and then run it in the background.
+
+		# Reset stateval for each serverip
+		if [ "$_sip" != "$_prev" ] ; then
+			_stateval="$_state_even"
+		fi
+
+		# Send notifies for server shutdown
+		"$_smnotify" --client="$_cip" --ip="$_sip" \
+			     --server="$_sip" --stateval="$_stateval"
+		"$_smnotify" --client="$_cip" --ip="$_sip" \
+			     --server="$NFS_HOSTNAME" --stateval="$_stateval"
+
+		# Send notifies for server startup
+		_stateval=$((_stateval + 1))
+		"$_smnotify" --client="$_cip" --ip="$_sip" \
+			     --server="$_sip" --stateval="$_stateval"
+		"$_smnotify" --client="$_cip" --ip="$_sip" \
+			     --server="$NFS_HOSTNAME" --stateval="$_stateval"
+	done
+}
+
+delete_records ()
+{
+	while read _sip _cip ; do
+		_key="statd-state@${_sip}@${_cip}"
+		echo "\"${_key}\" \"\""
+	done | $CTDB ptrans "ctdb.tdb"
+}
+
+############################################################
+
 case "$1" in
     # Keep a single file to keep track of the last "add-client" or
     # "del-client'.  These get pushed to ctdb.tdb during "update",
@@ -91,10 +139,14 @@ case "$1" in
                 printf "/statd-state@%s@/p\n", ip }')
 	# Intentional multi-word expansion for multiple files
 	# shellcheck disable=SC2086
-        if sed -n "$sed_expr" $files | $CTDB ptrans "ctdb.tdb" ; then
-            rm $files
+	items=$(sed -n "$sed_expr" $files)
+	if [ -n "$items" ] ; then
+		if echo "$items"  | $CTDB ptrans "ctdb.tdb" ; then
+			# shellcheck disable=SC2086
+			rm $files
+		fi
 	fi
-        ;;
+	;;
 
     notify)
 	# we must restart the lockmanager (on all nodes) so that we get
@@ -113,16 +165,6 @@ case "$1" in
 	rm -f /var/lib/nfs/statd/sm/*
 	rm -f /var/lib/nfs/statd/sm.bak/*
 
-	# we must keep a monotonically increasing state variable for the entire
-	# cluster  so state always increases when ip addresses fail from one
-	# node to another
-	# We use epoch and hope the nodes are close enough in clock.
-	# Even numbers mean service is shut down, odd numbers mean
-	# service is started.
-	# Intentionally round to an even number
-	# shellcheck disable=SC2017
-	state_even=$(( $(date '+%s') / 2 * 2))
-
 	# We must also let some time pass between stopping and
 	# restarting the lock manager.  Otherwise there is a window
 	# where the lock manager will respond "strangely" immediately
@@ -175,39 +217,8 @@ case "$1" in
 	statd_state=$($CTDB catdb ctdb.tdb | sed -n "$sed_expr" | sort)
 	[ -n "$statd_state" ] || exit 0
 
-	smnotify="${CTDB_HELPER_BINDIR}/smnotify"
-	prev=""
-	echo "$statd_state" | {
-	    # This all needs to be in the same command group at the
-	    # end of the pipe so it doesn't get lost when the loop
-	    # completes.
-	    items=""
-	    while read sip cip ; do
-		# Collect item to delete from the DB
-		key="statd-state@${sip}@${cip}"
-		item="\"${key}\" \"\""
-		items="${items}${items:+${nl}}${item}"
-
-		# NOTE: Consider optimising smnotify to read all the
-		# data from stdin and then run it in the background.
-
-		# Reset stateval for each serverip
-		[ "$sip" = "$prev" ] || stateval="$state_even"
-		# Send notifies for server shutdown
-		"$smnotify" --client="$cip" --ip="$sip" \
-			    --server="$sip" --stateval="$stateval"
-		"$smnotify" --client="$cip" --ip="$sip" \
-			    --server="$NFS_HOSTNAME" --stateval="$stateval"
-		# Send notifies for server startup
-		stateval=$((stateval + 1))
-		"$smnotify" --client="$cip" --ip="$sip" \
-			    --server="$sip" --stateval="$stateval"
-		"$smnotify" --client="$cip" --ip="$sip" \
-			    --server="$NFS_HOSTNAME" --stateval="$stateval"
-	    done
-
-	    echo "$items" | $CTDB ptrans "ctdb.tdb"
-	}
+	echo "$statd_state" | send_notifies
+	echo "$statd_state" | delete_records
 
 	# Remove any stale touch files (i.e. for IPs not currently
 	# hosted on this node and created since the last "update").
diff --git a/ctdb/doc/onnode.1.xml b/ctdb/doc/onnode.1.xml
index d55f771..671bf40 100644
--- a/ctdb/doc/onnode.1.xml
+++ b/ctdb/doc/onnode.1.xml
@@ -74,8 +74,8 @@
 	    Keep standard input open, allowing data to be piped to
 	    onnode.  Normally onnode closes stdin to avoid surprises
 	    when scripting.  Note that this option is ignored when
-	    using <option>-p</option> or if <envar>SSH</envar> is set
-	    to anything other than "ssh".
+	    using <option>-p</option> or if <envar>ONNODE_SSH</envar>
+	    is set to anything other than "ssh".
 	  </para>
         </listitem>
       </varlistentry>
@@ -292,16 +292,16 @@
 	</listitem>
       </varlistentry>
 
-      <varlistentry><term><filename>/usr/local/etc/ctdb/onnode.conf</filename></term>
-        <listitem>
-          <para>
-            If this file exists it is sourced by onnode.  The main
-            purpose is to allow the administrator to set
-            <envar>SSH</envar> to something other than "ssh".  In this
-            case the -t option is ignored.  For example, the
-            administrator may choose to use use rsh instead of ssh.
+      <varlistentry>
+	<term><filename>/usr/local/etc/ctdb/onnode.conf</filename></term>
+	<listitem>
+	  <para>
+	    If this file exists it is sourced by onnode.  The main
+	    purpose is to allow the administrator to set
+	    <envar>ONNODE_SSH</envar> to something other than "ssh".
+	    In this case the -t option is ignored.
 	  </para>
-        </listitem>
+	</listitem>
       </varlistentry>
     </variablelist>
   </refsect1>
diff --git a/ctdb/packaging/RPM/ctdb.spec.in b/ctdb/packaging/RPM/ctdb.spec.in
index 41573d2..7e89634 100644
--- a/ctdb/packaging/RPM/ctdb.spec.in
+++ b/ctdb/packaging/RPM/ctdb.spec.in
@@ -157,7 +157,6 @@ rm -rf $RPM_BUILD_ROOT
 %config(noreplace) %{_sysconfdir}/ctdb/notify.sh
 %config(noreplace) %{_sysconfdir}/ctdb/debug-hung-script.sh
 %config(noreplace) %{_sysconfdir}/ctdb/ctdb-crash-cleanup.sh
-%config(noreplace) %{_sysconfdir}/ctdb/gcore_trace.sh
 %config(noreplace) %{_sysconfdir}/ctdb/debug_locks.sh
 
 %config(noreplace, missingok) %{_sysconfdir}/sysconfig/ctdb
@@ -177,26 +176,11 @@ rm -rf $RPM_BUILD_ROOT
 %doc doc/*.html
 %doc doc/examples
 %{_sysconfdir}/sudoers.d/ctdb
+%dir %{_sysconfdir}/ctdb
 %{_sysconfdir}/ctdb/functions
-%{_sysconfdir}/ctdb/events.d/00.ctdb
-%{_sysconfdir}/ctdb/events.d/01.reclock
-%{_sysconfdir}/ctdb/events.d/05.system
-%{_sysconfdir}/ctdb/events.d/06.nfs
-%{_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
-%{_sysconfdir}/ctdb/events.d/20.multipathd
-%{_sysconfdir}/ctdb/events.d/31.clamd
-%{_sysconfdir}/ctdb/events.d/40.vsftpd
-%{_sysconfdir}/ctdb/events.d/41.httpd
-%{_sysconfdir}/ctdb/events.d/49.winbind
-%{_sysconfdir}/ctdb/events.d/50.samba
-%{_sysconfdir}/ctdb/events.d/60.nfs
-%{_sysconfdir}/ctdb/events.d/70.iscsi
-%{_sysconfdir}/ctdb/events.d/91.lvs
-%{_sysconfdir}/ctdb/events.d/99.timeout
+%dir %{_sysconfdir}/ctdb/events.d
+%{_sysconfdir}/ctdb/events.d/*
+%dir %{_sysconfdir}/ctdb/nfs-checks.d
 %config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/00.portmapper.check
 %config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/10.status.check
 %config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/20.nfs.check
diff --git a/ctdb/tests/eventscripts/11.natgw.015.sh b/ctdb/tests/eventscripts/11.natgw.015.sh
index c7e0c15..691b363 100755
--- a/ctdb/tests/eventscripts/11.natgw.015.sh
+++ b/ctdb/tests/eventscripts/11.natgw.015.sh
@@ -33,7 +33,7 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
-ok "NAT gateway configuration has changed"
+ok_null
 simple_test_event "ipreallocated"
 
 ok "default via ${FAKE_CTDB_NATGW_MASTER} dev ethXXX  metric 10 "
@@ -51,7 +51,7 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
-ok "NAT gateway configuration has changed"
+ok_null
 simple_test_event "ipreallocated"
 
 ok "default via ${CTDB_NATGW_DEFAULT_GATEWAY} dev ethXXX  metric 10 "
@@ -59,4 +59,3 @@ simple_test_command ip route show
 
 ok_natgw_master_ip_addr_show
 simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
-
diff --git a/ctdb/tests/eventscripts/11.natgw.025.sh b/ctdb/tests/eventscripts/11.natgw.025.sh
index 456fc3c..60602d3 100755
--- a/ctdb/tests/eventscripts/11.natgw.025.sh
+++ b/ctdb/tests/eventscripts/11.natgw.025.sh
@@ -35,7 +35,7 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
-ok "NAT gateway configuration has changed"
+ok_null
 simple_test_event "ipreallocated"
 
 ok_natgw_slave_static_routes
@@ -53,7 +53,7 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
-ok "NAT gateway configuration has changed"
+ok_null
 simple_test_event "ipreallocated"
 
 ok_natgw_master_static_routes
diff --git a/ctdb/tests/eventscripts/etc-ctdb/rc.local b/ctdb/tests/eventscripts/etc-ctdb/rc.local
index 541474a..72a79bc 100755
--- a/ctdb/tests/eventscripts/etc-ctdb/rc.local
+++ b/ctdb/tests/eventscripts/etc-ctdb/rc.local
@@ -59,4 +59,3 @@ background_with_logging ()
 }
 
 CTDB_INIT_STYLE="${EVENTSCRIPT_TESTS_INIT_STYLE:-redhat}"
-PATH="${EVENTSCRIPTS_PATH}:$PATH"
diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh
index 83877c3..4af1522 100644
--- a/ctdb/tests/eventscripts/scripts/local.sh
+++ b/ctdb/tests/eventscripts/scripts/local.sh
@@ -1,24 +1,23 @@
 # Hey Emacs, this is a -*- shell-script -*- !!!  :-)
 
-# Augment PATH with relevant stubs/ directories.  We do this by actually
-# setting PATH, and also by setting $EVENTSCRIPTS_PATH and then
-# prepending that to $PATH in rc.local to avoid the PATH reset in
-# functions.
-
-EVENTSCRIPTS_PATH=""
-
-if [ -d "${TEST_SUBDIR}/stubs" ] ; then
-    EVENTSCRIPTS_PATH="${TEST_SUBDIR}/stubs"
-    case "$EVENTSCRIPTS_PATH" in
-	/*) : ;;
-	*) EVENTSCRIPTS_PATH="${PWD}/${EVENTSCRIPTS_PATH}" ;;
-    esac
-    export CTDB_HELPER_BINDIR="$EVENTSCRIPTS_PATH"
-fi
+#
+# Augment PATH with relevant stubs/ directories.
+#
+
+stubs_dir="${TEST_SUBDIR}/stubs"
+[ -d "${stubs_dir}" ] || die "Failed to locate stubs/ subdirectory"
 
-export EVENTSCRIPTS_PATH
+# Make the path absolute for tests that change directory
+case "$stubs_dir" in
+/*) : ;;
+*) stubs_dir="${PWD}/${stubs_dir}" ;;
+esac
+
+# Use stubs as helpers
+export CTDB_HELPER_BINDIR="$stubs_dir"
+
+PATH="${stubs_dir}:${PATH}"
 
-PATH="${EVENTSCRIPTS_PATH}:${PATH}"
 
 export CTDB="ctdb"
 
@@ -163,8 +162,8 @@ _tcp_connections ()
 
 setup_tcp_connections ()
 {
-	_t==$(mktemp --tmpdir="$EVENTSCRIPTS_TESTS_VAR_DIR")
-	export FAKE_NETSTAT_TCP_ESTABLISHED_FILE"$_t"
+	_t=$(mktemp --tmpdir="$EVENTSCRIPTS_TESTS_VAR_DIR")
+	export FAKE_NETSTAT_TCP_ESTABLISHED_FILE="$_t"
 	_tcp_connections "$@" >"$FAKE_NETSTAT_TCP_ESTABLISHED_FILE"
 }
 
@@ -693,7 +692,7 @@ check_ctdb_tdb_statd_state ()
     ctdb_catdb_format_pairs | {
 	ok
 	simple_test_command ctdb catdb ctdb.tdb
-    } || test_fail
+    } || exit $?
 }
 
 check_statd_callout_smnotify ()
@@ -707,16 +706,16 @@ check_statd_callout_smnotify ()
     while read _x _sip _x ; do


-- 
Samba Shared Repository



More information about the samba-cvs mailing list