[SCM] CTDB repository - branch 2.5 updated - ctdb-2.5.1-24-geef6724

Amitay Isaacs amitay at samba.org
Thu Jan 30 21:24:51 MST 2014


The branch, 2.5 has been updated
       via  eef67244544a1396e1408938a5ebaa2d745426e6 (commit)
      from  eb514524e764834a9898fb0ca787c710fb8f9c85 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=2.5


- Log -----------------------------------------------------------------
commit eef67244544a1396e1408938a5ebaa2d745426e6
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Nov 28 16:43:55 2013 +1100

    tests/integration: Update NFS tickles test and supporting code
    
    This currently requires an eventscript to be dynamically installed.
    This eventscript is only used to help determine when a monitor event
    has occurred.  This code is horrible and fragile.
    
    A better way is to just monitor the output of "ctdb scriptstatus".
    When changes it changes then a monitor event has occurred.
    
    Also remove the old code that checks for tickle information in shared
    storage.  CTDB hasn't done things this way for a long time.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    (Imported from commit ef0e8cc1928dbd12c862a5e96710471ce3b4d023)

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

Summary of changes:
 tests/complex/31_nfs_tickle.sh |   28 +------
 tests/scripts/integration.bash |  165 ++++------------------------------------
 2 files changed, 17 insertions(+), 176 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tests/complex/31_nfs_tickle.sh b/tests/complex/31_nfs_tickle.sh
index ce4ae81..b5ed47e 100755
--- a/tests/complex/31_nfs_tickle.sh
+++ b/tests/complex/31_nfs_tickle.sh
@@ -52,11 +52,7 @@ cluster_is_healthy
 # Reset configuration
 ctdb_restart_when_done
 
-ctdb_test_exit_hook_add ctdb_test_eventscript_uninstall
-
-ctdb_test_eventscript_install
-
-# We need this for later, so we know how long to sleep.
+# We need this for later, so we know how long to run nc for.
 try_command_on_node any $CTDB getvar MonitorInterval
 monitor_interval="${out#*= }"
 #echo "Monitor interval on node $test_node is $monitor_interval seconds."
@@ -81,27 +77,7 @@ echo "Sleeping until tickles are synchronised across nodes..."
 try_command_on_node $test_node $CTDB getvar TickleUpdateInterval
 sleep_for "${out#*= }"
 
-if try_command_on_node any "test -r /etc/ctdb/events.d/61.nfstickle" ; then
-    echo "Trying to determine NFS_TICKLE_SHARED_DIRECTORY..."
-    if [ -f /etc/sysconfig/nfs ]; then
-	f="/etc/sysconfig/nfs"
-    elif [ -f /etc/default/nfs ]; then
-	f="/etc/default/nfs"
-    elif [ -f /etc/ctdb/sysconfig/nfs ]; then
-	f="/etc/ctdb/sysconfig/nfs"
-    fi
-    try_command_on_node -v any "[ -r $f ] &&  sed -n -e s@^NFS_TICKLE_SHARED_DIRECTORY=@@p $f" || true
-
-    nfs_tickle_shared_directory="${out:-/gpfs/.ctdb/nfs-tickles}"
-
-    try_command_on_node $test_node hostname
-    test_hostname=$out
-
-    try_command_on_node -v any cat "${nfs_tickle_shared_directory}/$test_hostname/$test_ip"
-else
-    echo "That's OK, we'll use \"ctdb gettickles\", which is newer..."
-    try_command_on_node -v any "ctdb -Y gettickles $test_ip $test_port"
-fi
+try_command_on_node -v any "ctdb -Y gettickles $test_ip $test_port"
 
 if [ "${out/${src_socket}/}" != "$out" ] ; then
     echo "GOOD: NFS connection tracked OK."
diff --git a/tests/scripts/integration.bash b/tests/scripts/integration.bash
index c85ba2d..b6452db 100644
--- a/tests/scripts/integration.bash
+++ b/tests/scripts/integration.bash
@@ -775,165 +775,30 @@ get_ctdbd_command_line_option ()
 
 #######################################
 
-install_eventscript ()
-{
-    local script_name="$1"
-    local script_contents="$2"
-
-    if [ -z "$TEST_LOCAL_DAEMONS" ] ; then
-	# The quoting here is *very* fragile.  However, we do
-	# experience the joy of installing a short script using
-	# onnode, and without needing to know the IP addresses of the
-	# nodes.
-	onnode all "f=\"\${CTDB_BASE:-/etc/ctdb}/events.d/${script_name}\" ; echo \"Installing \$f\" ; echo '${script_contents}' > \"\$f\" ; chmod 755 \"\$f\""
-    else
-	f="${TEST_VAR_DIR}/events.d/${script_name}"
-	echo "$script_contents" >"$f"
-	chmod 755 "$f"
-    fi
-}
-
-uninstall_eventscript ()
-{
-    local script_name="$1"
-
-    if [ -z "$TEST_LOCAL_DAEMONS" ] ; then
-	onnode all "rm -vf \"\${CTDB_BASE:-/etc/ctdb}/events.d/${script_name}\""
-    else
-	rm -vf "${TEST_VAR_DIR}/events.d/${script_name}"
-    fi
-}
-
-#######################################
-
-# This section deals with the 99.ctdb_test eventscript.
-
-# Metafunctions: Handle a ctdb-test file on a node.
-# given event.
-ctdb_test_eventscript_file_create ()
-{
-    local pnn="$1"
-    local type="$2"
-
-    try_command_on_node $pnn touch "/tmp/ctdb-test-${type}.${pnn}"
-}
-
-ctdb_test_eventscript_file_remove ()
-{
-    local pnn="$1"
-    local type="$2"
-
-    try_command_on_node $pnn rm -f "/tmp/ctdb-test-${type}.${pnn}"
-}
-
-ctdb_test_eventscript_file_exists ()
+wait_for_monitor_event ()
 {
     local pnn="$1"
-    local type="$2"
-
-    try_command_on_node $pnn test -f "/tmp/ctdb-test-${type}.${pnn}" >/dev/null 2>&1
-}
-
-
-# Handle a flag file on a node that is removed by 99.ctdb_test on the
-# given event.
-ctdb_test_eventscript_flag ()
-{
-    local cmd="$1"
-    local pnn="$2"
-    local event="$3"
-
-    ctdb_test_eventscript_file_${cmd} "$pnn" "flag-${event}"
-}
+    local timeout=120
 
+    echo "Waiting for a monitor event on node ${pnn}..."
 
-# Handle a trigger that causes 99.ctdb_test to fail it's monitor
-# event.
-ctdb_test_eventscript_unhealthy_trigger ()
-{
-    local cmd="$1"
-    local pnn="$2"
-
-    ctdb_test_eventscript_file_${cmd} "$pnn" "unhealthy-trigger"
-}
-
-# Handle the file that 99.ctdb_test created to show that it has marked
-# a node unhealthy because it detected the above trigger.
-ctdb_test_eventscript_unhealthy_detected ()
-{
-    local cmd="$1"
-    local pnn="$2"
-
-    ctdb_test_eventscript_file_${cmd} "$pnn" "unhealthy-detected"
-}
-
-# Handle a trigger that causes 99.ctdb_test to timeout it's monitor
-# event.  This should cause the node to be banned.
-ctdb_test_eventscript_timeout_trigger ()
-{
-    local cmd="$1"
-    local pnn="$2"
-    local event="$3"
-
-    ctdb_test_eventscript_file_${cmd} "$pnn" "${event}-timeout"
-}
-
-# Note that the eventscript can't use the above functions!
-ctdb_test_eventscript_install ()
-{
-
-    local script='#!/bin/sh
-out=$(ctdb pnn)
-pnn="${out#PNN:}"
-
-rm -vf "/tmp/ctdb-test-flag-${1}.${pnn}"
-
-trigger="/tmp/ctdb-test-unhealthy-trigger.${pnn}"
-detected="/tmp/ctdb-test-unhealthy-detected.${pnn}"
-timeout_trigger="/tmp/ctdb-test-${1}-timeout.${pnn}"
-case "$1" in
-    monitor)
-        if [ -e "$trigger" ] ; then
-            echo "${0}: Unhealthy because \"$trigger\" detected"
-            touch "$detected"
-            exit 1
-        elif [ -e "$detected" -a ! -e "$trigger" ] ; then
-            echo "${0}: Healthy again, \"$trigger\" no longer detected"
-            rm "$detected"
-        fi
-
-	;;
-    *)
-        if [ -e "$timeout_trigger" ] ; then
-            echo "${0}: Sleeping for a long time because \"$timeout_trigger\" detected"
-            sleep 9999
-        fi
-	;;
-	*)
-
-esac
-
-exit 0
-'
-    install_eventscript "99.ctdb_test" "$script"
-}
+    try_command_on_node "$pnn" $CTDB scriptstatus || {
+	echo "Unable to get scriptstatus from node $pnn"
+	return 1
+    }
 
-ctdb_test_eventscript_uninstall ()
-{
-    uninstall_eventscript "99.ctdb_test"
+    local ctdb_scriptstatus_original="$out"
+    wait_until 120 _ctdb_scriptstatus_changed
 }
 
-# Note that this only works if you know all other monitor events will
-# succeed.  You also need to install the eventscript before using it.
-wait_for_monitor_event ()
+_ctdb_scriptstatus_changed ()
 {
-    local pnn="$1"
-
-    echo "Waiting for a monitor event on node ${pnn}..."
-    ctdb_test_eventscript_flag create $pnn "monitor"
-
-    wait_until 120 ! ctdb_test_eventscript_flag exists $pnn "monitor"
+    try_command_on_node "$pnn" $CTDB scriptstatus || {
+	echo "Unable to get scriptstatus from node $pnn"
+	return 1
+    }
 
+    [ "$out" != "$ctdb_scriptstatus_original" ]
 }
 
 #######################################


-- 
CTDB repository


More information about the samba-cvs mailing list