ctdb/tests/integration: Decentralise the daemon restart code
authorMartin Schwenke <martin@meltin.net>
Fri, 29 Nov 2013 03:07:43 +0000 (14:07 +1100)
committerMichael Adam <obnox@samba.org>
Wed, 4 Dec 2013 23:43:55 +0000 (00:43 +0100)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
ctdb/tests/scripts/integration.bash
ctdb/tests/simple/scripts/local_daemons.bash

index 4d22f4150fd1d4c2271bf9770eb76cfc8766022e..665fc7dd69477ce04ea82cf65b9573025ab4bb2e 100644 (file)
@@ -449,6 +449,12 @@ _restart_ctdb ()
     fi
 }
 
+# Restart CTDB on all nodes.  Override for local daemons.
+_restart_ctdb_all ()
+{
+    onnode -p all $CTDB_TEST_WRAPPER _restart_ctdb "$@"
+}
+
 # Nothing needed for a cluster.  Override for local daemons.
 setup_ctdb ()
 {
@@ -457,7 +463,7 @@ setup_ctdb ()
 
 restart_ctdb ()
 {
-    # "$@" is passed to ctdbd start.
+    # "$@" is passed to restart_ctdb_all.
 
     echo -n "Restarting CTDB"
     if $ctdb_test_restart_scheduled ; then
@@ -467,12 +473,7 @@ restart_ctdb ()
 
     local i
     for i in $(seq 1 5) ; do
-       if [ -n "$CTDB_NODES_SOCKETS" ] ; then
-           daemons_stop
-           daemons_start "$@"
-       else
-           onnode -p all $CTDB_TEST_WRAPPER _restart_ctdb "$@"
-       fi || {
+       _restart_ctdb_all "$@" || {
            echo "Restart failed.  Trying again in a few seconds..."
            sleep_for 5
            continue
index 6bd2138a828dfa194cc2ca7465755977cc879942..7c3407f8aa7b6fc61586dd00f6fa24eeec8edd63 100644 (file)
@@ -127,3 +127,9 @@ maybe_stop_ctdb ()
        daemons_stop
     fi
 }
+
+_restart_ctdb_all ()
+{
+    daemons_stop
+    daemons_start "$@"
+}