ctdb-protocol: Fix marshalling for ctdb_uptime
[vlendec/samba-autobuild/.git] / ctdb / tests / scripts / integration.bash
index e3fb3d4e1c748a360a14d46e7e99a70e6400eed1..4f1227f4393f340cc84c8c56205d5b6395128e4b 100644 (file)
@@ -231,7 +231,7 @@ get_test_ip_mask_and_iface ()
 
 ctdb_get_all_pnns ()
 {
-    try_command_on_node -q all "$CTDB pnn | sed -e 's@PNN:@@'"
+    try_command_on_node -q all "$CTDB pnn"
     all_pnns="$out"
 }
 
@@ -320,7 +320,7 @@ _cluster_is_healthy ()
 
 _cluster_is_recovered ()
 {
-    node_has_status all recovered
+    node_has_status 0 recovered
 }
 
 _cluster_is_ready ()
@@ -524,31 +524,21 @@ wait_until_node_has_some_ips ()
 
 #######################################
 
-_ctdb_hack_options ()
+_service_ctdb ()
 {
-    local ctdb_options="$*"
-
-    case "$ctdb_options" in
-       *--start-as-stopped*)
-           export CTDB_START_AS_STOPPED="yes"
-    esac
-}
-
-restart_ctdb_1 ()
-{
-    _ctdb_hack_options "$@"
+    cmd="$1"
 
     if [ -e /etc/redhat-release ] ; then
-       service ctdb restart
+       service ctdb "$cmd"
     else
-       /etc/init.d/ctdb restart
+       /etc/init.d/ctdb "$cmd"
     fi
 }
 
 # Restart CTDB on all nodes.  Override for local daemons.
 _restart_ctdb_all ()
 {
-    onnode -p all $CTDB_TEST_WRAPPER restart_ctdb_1 "$@"
+    onnode -p all $CTDB_TEST_WRAPPER _service_ctdb restart
 }
 
 # Nothing needed for a cluster.  Override for local daemons.
@@ -557,10 +547,23 @@ setup_ctdb ()
     :
 }
 
-restart_ctdb ()
+start_ctdb_1 ()
 {
-    # "$@" is passed to restart_ctdb_all.
+    onnode "$1" $CTDB_TEST_WRAPPER _service_ctdb start
+}
 
+stop_ctdb_1 ()
+{
+    onnode "$1" $CTDB_TEST_WRAPPER _service_ctdb stop
+}
+
+restart_ctdb_1 ()
+{
+    onnode "$1" $CTDB_TEST_WRAPPER _service_ctdb restart
+}
+
+restart_ctdb ()
+{
     echo -n "Restarting CTDB"
     if $ctdb_test_restart_scheduled ; then
        echo -n " (scheduled)"
@@ -569,7 +572,7 @@ restart_ctdb ()
 
     local i
     for i in $(seq 1 5) ; do
-       _restart_ctdb_all "$@" || {
+       _restart_ctdb_all || {
            echo "Restart failed.  Trying again in a few seconds..."
            sleep_for 5
            continue