From ec90f36cc6185fc6ed13164fb13ec3630aff68ad Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Thu, 19 Mar 2020 10:46:25 +1100 Subject: [PATCH] ctdb-tools: Print "UNKNOWN" when leader PNN is unknown Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/tools/ctdb.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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; } -- 2.34.1