From: Martin Schwenke Date: Wed, 18 Mar 2020 23:46:25 +0000 (+1100) Subject: ctdb-tools: Print "UNKNOWN" when leader PNN is unknown X-Git-Tag: tdb-1.4.6~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec90f36cc6185fc6ed13164fb13ec3630aff68ad;p=thirdparty%2Fsamba.git ctdb-tools: Print "UNKNOWN" when leader PNN is unknown Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 8370e11f8e6..5f0c32b317d 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -213,6 +213,16 @@ failed: return NULL; } +static void print_pnn(uint32_t pnn) +{ + if (pnn == CTDB_UNKNOWN_PNN) { + printf("UNKNOWN\n"); + return; + } + + printf("%u\n", pnn); +} + static bool verify_pnn(struct ctdb_context *ctdb, int pnn) { struct ctdb_node_map *nodemap; @@ -862,7 +872,8 @@ static void print_status(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, printf("Recovery mode:%s (%d)\n", recmode == CTDB_RECOVERY_NORMAL ? "NORMAL" : "RECOVERY", recmode); - printf("Recovery master:%d\n", recmaster); + printf("Recovery master:"); + print_pnn(recmaster); } static int control_status(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, @@ -4536,7 +4547,8 @@ static int control_recmaster(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, return ret; } - printf("%u\n", recmaster); + print_pnn(recmaster); + return 0; }