From ae8cfe5baaff5b3e4c55f49ec71811e32a885271 Mon Sep 17 00:00:00 2001 From: Tamar Shacked Date: Tue, 8 Dec 2020 12:51:35 +0200 Subject: glusterd/cli: enhance rebalance-status after replace/reset-brick (#1869) * glusterd/cli: enhance rebalance-status after replace/reset-brick Rebalance status is being reset during replace/reset-brick operations. This cause 'volume status' to shows rebalance as "not started". Fix: change rebalance-status to "reset due to (replace|reset)-brick" Change-Id: I6e3372d67355eb76c5965984a23f073289d4ff23 Signed-off-by: Tamar Shacked * glusterd/cli: enhance rebalance-status after replace/reset-brick Rebalance status is being reset during replace/reset-brick operations. This cause 'volume status' to shows rebalance as "not started". Fix: change rebalance-status to "reset due to (replace|reset)-brick" Fixes: #1717 Signed-off-by: Tamar Shacked Change-Id: I1e3e373ca3b2007b5b7005b6c757fb43801fde33 * cli: changing rebal task ID to "None" in case status is being reset Rebalance status is being reset during replace/reset-brick operations. This cause 'volume status' to shows rebalance as "not started". Fix: change rebalance-status to "reset due to (replace|reset)-brick" Fixes: #1717 Change-Id: Ia73a8bea3dcd8e51acf4faa6434c3cb0d09856d0 Signed-off-by: Tamar Shacked --- cli/src/cli-rpc-ops.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'cli/src') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 4d068dbe4c..576f2a2fb2 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -67,6 +67,8 @@ char *cli_vol_task_status_str[] = {"not started", "fix-layout stopped", "fix-layout completed", "fix-layout failed", + "reset due to replace-brick", + "reset due to reset-brick", "unknown"}; static int32_t @@ -7114,12 +7116,21 @@ cli_print_volume_status_tasks(dict_t *dict) ret = dict_get_str(dict, key, &task_id_str); if (ret) return; - cli_out("%-20s : %-20s", "ID", task_id_str); snprintf(key, sizeof(key), "task%d.status", i); ret = dict_get_int32(dict, key, &status); - if (ret) + if (ret) { + cli_out("%-20s : %-20s", "ID", task_id_str); return; + } + + if (!strcmp(op, "Rebalance") && + (status == GF_DEFRAG_STATUS_RESET_DUE_REPLACE_BRC || + status == GF_DEFRAG_STATUS_RESET_DUE_RESET_BRC)) { + task_id_str = "None"; + } + + cli_out("%-20s : %-20s", "ID", task_id_str); snprintf(task, sizeof(task), "task%d", i); -- cgit