'$2 != test_node { print $2 ; exit }' <<<"$listnodes_output")
echo "Restarting CTDB on node ${rn}"
-restart_ctdb_1 $rn
+ctdb_nodes_restart "$rn"
# In some theoretical world this is racy. In practice, the node will
# take quite a while to become healthy, so this will beat any
test_node="0"
echo "Shutting down node $test_node"
-stop_ctdb_1 "$test_node"
+ctdb_nodes_stop "$test_node"
sleep 1
wait_until_node_has_status 1 recovered
try_command_on_node -v 1 $CTDB status
echo
echo "Start node $test_node"
-start_ctdb_1 "$test_node"
+ctdb_nodes_start "$test_node"
sleep 1
wait_until_ready
echo
echo "Restarting node $test_node"
-restart_ctdb_1 "$test_node"
+ctdb_nodes_restart "$test_node"
sleep 1
wait_until_ready
printf '\nRestarting node %d with CTDB_TEST_SAMBA_VERSION=0x%08x\n' \
"$test_node" \
"$CTDB_TEST_SAMBA_VERSION"
-restart_ctdb_1 "$test_node"
+ctdb_nodes_restart "$test_node"
wait_until_ready
echo "GOOD: ctdbd restarted successfully on node ${test_node}"
printf '\nRestarting node %d with CTDB_TEST_SAMBA_VERSION=0x%08x\n' \
"$test_node" \
"$CTDB_TEST_SAMBA_VERSION"
-restart_ctdb_1 "$test_node"
+ctdb_nodes_restart "$test_node"
echo "Will use PID file ${pidfile} to check for ctdbd exit"
wait_until 30 ! test -f "$pidfile"
echo "GOOD: ctdbd exited early on node ${test_node}"
printf '\nRestarting node %d with CTDB_TEST_SAMBA_VERSION=0x%08x\n' \
"$test_node" \
"$CTDB_TEST_SAMBA_VERSION"
-start_ctdb_1 "$test_node"
+ctdb_nodes_start "$test_node"
echo "Will use PID file ${pidfile} to check for ctdbd exit"
wait_until 30 ! test -f "$pidfile"
echo "GOOD: ctdbd exited early on node ${test_node}"
unset ctdb_test_exit_hook
echo "Stopping cluster..."
- ctdb_stop_all
+ ctdb_nodes_stop
exit $status
}
{
trap "ctdb_test_exit" 0
- ctdb_stop_all >/dev/null 2>&1 || true
+ ctdb_nodes_stop >/dev/null 2>&1 || true
echo "Configuring cluster..."
setup_ctdb "$@" || exit 1
fi
}
+
+ctdb_nodes_restart ()
+{
+ ctdb_nodes_stop "$@"
+ ctdb_nodes_start "$@"
+}
+
########################################
# Sets: $out, $outfile
ctdb_init ()
{
- ctdb_stop_all >/dev/null 2>&1 || :
+ ctdb_nodes_stop >/dev/null 2>&1 || :
- ctdb_start_all || ctdb_test_error "Cluster start failed"
+ ctdb_nodes_start || ctdb_test_error "Cluster start failed"
wait_until_ready || ctdb_test_error "Cluster didn't become ready"
fi
}
-start_ctdb_1 ()
+ctdb_nodes_start ()
{
- local pnn="$1"
+ local nodespec="${1:-all}"
- $ctdb_local_daemons start "$pnn"
+ $ctdb_local_daemons start "$nodespec"
}
-ctdb_start_all ()
+ctdb_nodes_stop ()
{
- $ctdb_local_daemons start "all"
-}
-
-stop_ctdb_1 ()
-{
- local pnn="$1"
-
- $ctdb_local_daemons stop "$pnn"
-}
+ local nodespec="${1:-all}"
-ctdb_stop_all ()
-{
- $ctdb_local_daemons stop "all"
-}
-
-restart_ctdb_1 ()
-{
- stop_ctdb_1 "$1"
- start_ctdb_1 "$1"
+ $ctdb_local_daemons stop "$nodespec"
}
onnode ()
}
# Stop/start CTDB on all nodes. Override for local daemons.
-ctdb_stop_all ()
+ctdb_nodes_stop ()
{
- onnode -p all "$CTDB_TEST_WRAPPER" _service_ctdb stop
-}
-ctdb_start_all ()
-{
- onnode -p all "$CTDB_TEST_WRAPPER" _service_ctdb start
-}
+ local nodespec="${1:-all}"
-start_ctdb_1 ()
-{
- onnode "$1" "$CTDB_TEST_WRAPPER" _service_ctdb start
+ onnode -p "$nodespec" "$CTDB_TEST_WRAPPER" _service_ctdb stop
}
-
-stop_ctdb_1 ()
+ctdb_nodes_start ()
{
- onnode "$1" "$CTDB_TEST_WRAPPER" _service_ctdb stop
-}
+ local nodespec="${1:-all}"
-restart_ctdb_1 ()
-{
- onnode "$1" "$CTDB_TEST_WRAPPER" _service_ctdb restart
+ onnode -p "$nodespec" "$CTDB_TEST_WRAPPER" _service_ctdb start
}