From: Martin Schwenke Date: Tue, 5 Apr 2016 02:04:36 +0000 (+1000) Subject: ctdb-tools: Simplify "ctdb getreclock" output X-Git-Tag: talloc-2.1.7~111 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c14e0ff8e4fdfaf18e0a906329e4e886bc200ab1;p=thirdparty%2Fsamba.git ctdb-tools: Simplify "ctdb getreclock" output If the reclock is set then print it, otherwise print nothing. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml index 12ead006486..cbdc5c7847f 100644 --- a/ctdb/doc/ctdb.1.xml +++ b/ctdb/doc/ctdb.1.xml @@ -955,14 +955,14 @@ DB Statistics: locking.tdb getreclock - Show the name of the recovery lock file, if any. + Show details of the recovery lock, if any. Example output: - Reclock file:/clusterfs/.ctdb/recovery.lock + /clusterfs/.ctdb/recovery.lock diff --git a/ctdb/tests/simple/35_set_reclock.sh b/ctdb/tests/simple/35_set_reclock.sh index 07e31855e34..7a515ee38b3 100755 --- a/ctdb/tests/simple/35_set_reclock.sh +++ b/ctdb/tests/simple/35_set_reclock.sh @@ -60,8 +60,8 @@ fi echo echo "Check that recovery lock is actually enabled..." -t=$(echo "$out" | sed -e 's@^Reclock file:@@' | sort -u) -if [ "$t" != "No reclock file used." ] ; then +orig_reclock=$(echo "$out" | sort -u) +if [ "$orig_reclock" != "" ] ; then echo "OK: Recovery lock is set" else echo "OOPS: Recovery lock is unset. Skipping remainder of test" @@ -69,8 +69,7 @@ else fi echo -orig_reclock=$(sed -n -e '1s@^Reclock file:@@p' <<<"$out") -echo "Remember original recovery lock file: \"${orig_reclock}\"" +echo "Original recovery lock file: \"${orig_reclock}\"" echo echo "Unset and test the recovery lock on all nodes..." @@ -78,7 +77,7 @@ try_command_on_node -pq all $CTDB setreclock wait_until_recovered try_command_on_node -v -q all $CTDB getreclock t=$(sort -u <<<"$out") -if [ "$t" = "No reclock file used." ] ; then +if [ "$t" = "" ] ; then echo "GOOD: Recovery lock unset on all nodes" else echo "BAD: Recovery lock not unset on all nodes" @@ -95,7 +94,7 @@ echo "Set alternative recovery lock (${alt}) and test on all nodes..." try_command_on_node -pq all $CTDB setreclock "$alt" wait_until_recovered try_command_on_node -v -q all $CTDB getreclock -t=$(echo "$out" | sed -e 's@^Reclock file:@@' | sort -u) +t=$(echo "$out" | sort -u) if [ "$t" = "$alt" ] ; then echo "GOOD: Recovery lock set on all nodes" else @@ -113,7 +112,7 @@ try_command_on_node -pq all $CTDB setreclock "$orig_reclock" wait_until_recovered try_command_on_node -v all rm -vf "$alt" try_command_on_node -v -q all $CTDB getreclock -t=$(echo "$out" | sed -e 's@^Reclock file:@@' | sort -u) +t=$(echo "$out" | sort -u) if [ "$t" = "$orig_reclock" ] ; then echo "GOOD: Recovery lock restored on all nodes" else diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 8d1feec9f06..58c8339a13a 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -4224,16 +4224,8 @@ static int control_getreclock(struct ctdb_context *ctdb, int argc, const char ** DEBUG(DEBUG_ERR, ("Unable to get reclock file from node %u\n", options.pnn)); return ret; } else { - if (options.machinereadable){ - if (reclock != NULL) { - printm("%s", reclock); - } - } else { - if (reclock == NULL) { - printf("No reclock file used.\n"); - } else { - printf("Reclock file:%s\n", reclock); - } + if (reclock != NULL) { + printf("%s\n", reclock); } } return 0;