|
|
c460ee |
From 96c4c3c47c914aced8864e7d178a4d57f7fced05 Mon Sep 17 00:00:00 2001
|
|
|
c460ee |
From: Tamar Shacked <tshacked@redhat.com>
|
|
|
c460ee |
Date: Sun, 6 Jun 2021 14:26:18 +0300
|
|
|
c460ee |
Subject: [PATCH 579/584] cli: changing rebal task ID to "None" in case status
|
|
|
c460ee |
is being reset
|
|
|
c460ee |
|
|
|
c460ee |
Rebalance status is being reset during replace/reset-brick operations.
|
|
|
c460ee |
This cause 'volume status' to shows rebalance as "not started".
|
|
|
c460ee |
|
|
|
c460ee |
Fix:
|
|
|
c460ee |
change rebalance-status to "reset due to (replace|reset)-brick"
|
|
|
c460ee |
|
|
|
c460ee |
Backport of:
|
|
|
c460ee |
> Upstream-patch-link: https://github.com/gluster/glusterfs/pull/1869
|
|
|
c460ee |
> Change-Id: Ia73a8bea3dcd8e51acf4faa6434c3cb0d09856d0
|
|
|
c460ee |
> Signed-off-by: Tamar Shacked <tshacked@redhat.com>
|
|
|
c460ee |
> Fixes: #1717
|
|
|
c460ee |
|
|
|
c460ee |
BUG: 1889966
|
|
|
c460ee |
|
|
|
c460ee |
Signed-off-by: Tamar Shacked <tshacked@redhat.com>
|
|
|
c460ee |
Change-Id: Ia73a8bea3dcd8e51acf4faa6434c3cb0d09856d0
|
|
|
c460ee |
Reviewed-on: https://code.engineering.redhat.com/gerrit/c/rhs-glusterfs/+/245402
|
|
|
c460ee |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
c460ee |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
c460ee |
---
|
|
|
c460ee |
cli/src/cli-rpc-ops.c | 15 ++++++-
|
|
|
c460ee |
rpc/xdr/src/cli1-xdr.x | 2 +
|
|
|
c460ee |
tests/bugs/glusterd/reset-rebalance-state.t | 46 ++++++++++++++++++++++
|
|
|
c460ee |
xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 4 +-
|
|
|
c460ee |
xlators/mgmt/glusterd/src/glusterd-reset-brick.c | 3 +-
|
|
|
c460ee |
5 files changed, 65 insertions(+), 5 deletions(-)
|
|
|
c460ee |
create mode 100644 tests/bugs/glusterd/reset-rebalance-state.t
|
|
|
c460ee |
|
|
|
c460ee |
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
|
|
|
c460ee |
index 51b5447..4167c68 100644
|
|
|
c460ee |
--- a/cli/src/cli-rpc-ops.c
|
|
|
c460ee |
+++ b/cli/src/cli-rpc-ops.c
|
|
|
c460ee |
@@ -72,6 +72,8 @@ char *cli_vol_task_status_str[] = {"not started",
|
|
|
c460ee |
"fix-layout stopped",
|
|
|
c460ee |
"fix-layout completed",
|
|
|
c460ee |
"fix-layout failed",
|
|
|
c460ee |
+ "reset due to replace-brick",
|
|
|
c460ee |
+ "reset due to reset-brick",
|
|
|
c460ee |
"unknown"};
|
|
|
c460ee |
|
|
|
c460ee |
int32_t
|
|
|
c460ee |
@@ -8357,12 +8359,21 @@ cli_print_volume_status_tasks(dict_t *dict)
|
|
|
c460ee |
ret = dict_get_str(dict, key, &task_id_str);
|
|
|
c460ee |
if (ret)
|
|
|
c460ee |
return;
|
|
|
c460ee |
- cli_out("%-20s : %-20s", "ID", task_id_str);
|
|
|
c460ee |
|
|
|
c460ee |
snprintf(key, sizeof(key), "task%d.status", i);
|
|
|
c460ee |
ret = dict_get_int32(dict, key, &status);
|
|
|
c460ee |
- if (ret)
|
|
|
c460ee |
+ if (ret) {
|
|
|
c460ee |
+ cli_out("%-20s : %-20s", "ID", task_id_str);
|
|
|
c460ee |
return;
|
|
|
c460ee |
+ }
|
|
|
c460ee |
+
|
|
|
c460ee |
+ if (!strcmp(op, "Rebalance") &&
|
|
|
c460ee |
+ (status == GF_DEFRAG_STATUS_RESET_DUE_REPLACE_BRC ||
|
|
|
c460ee |
+ status == GF_DEFRAG_STATUS_RESET_DUE_RESET_BRC)) {
|
|
|
c460ee |
+ task_id_str = "None";
|
|
|
c460ee |
+ }
|
|
|
c460ee |
+
|
|
|
c460ee |
+ cli_out("%-20s : %-20s", "ID", task_id_str);
|
|
|
c460ee |
|
|
|
c460ee |
snprintf(task, sizeof(task), "task%d", i);
|
|
|
c460ee |
|
|
|
c460ee |
diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x
|
|
|
c460ee |
index 777cb00..17d96f1 100644
|
|
|
c460ee |
--- a/rpc/xdr/src/cli1-xdr.x
|
|
|
c460ee |
+++ b/rpc/xdr/src/cli1-xdr.x
|
|
|
c460ee |
@@ -45,6 +45,8 @@
|
|
|
c460ee |
GF_DEFRAG_STATUS_LAYOUT_FIX_STOPPED,
|
|
|
c460ee |
GF_DEFRAG_STATUS_LAYOUT_FIX_COMPLETE,
|
|
|
c460ee |
GF_DEFRAG_STATUS_LAYOUT_FIX_FAILED,
|
|
|
c460ee |
+ GF_DEFRAG_STATUS_RESET_DUE_REPLACE_BRC,
|
|
|
c460ee |
+ GF_DEFRAG_STATUS_RESET_DUE_RESET_BRC,
|
|
|
c460ee |
GF_DEFRAG_STATUS_MAX
|
|
|
c460ee |
};
|
|
|
c460ee |
|
|
|
c460ee |
diff --git a/tests/bugs/glusterd/reset-rebalance-state.t b/tests/bugs/glusterd/reset-rebalance-state.t
|
|
|
c460ee |
new file mode 100644
|
|
|
c460ee |
index 0000000..829d2b1
|
|
|
c460ee |
--- /dev/null
|
|
|
c460ee |
+++ b/tests/bugs/glusterd/reset-rebalance-state.t
|
|
|
c460ee |
@@ -0,0 +1,46 @@
|
|
|
c460ee |
+#!/bin/bash
|
|
|
c460ee |
+
|
|
|
c460ee |
+. $(dirname $0)/../../include.rc
|
|
|
c460ee |
+. $(dirname $0)/../../cluster.rc
|
|
|
c460ee |
+. $(dirname $0)/../../volume.rc
|
|
|
c460ee |
+
|
|
|
c460ee |
+
|
|
|
c460ee |
+get_rebalance_status() {
|
|
|
c460ee |
+ $CLI volume status $V0 | egrep ^"Status " | awk '{print $3}'
|
|
|
c460ee |
+}
|
|
|
c460ee |
+
|
|
|
c460ee |
+run_rebal_check_status() {
|
|
|
c460ee |
+ TEST $CLI volume rebalance $V0 start
|
|
|
c460ee |
+ EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" rebalance_status_field $V0
|
|
|
c460ee |
+ REBAL_STATE=$(get_rebalance_status)
|
|
|
c460ee |
+ TEST [ $REBAL_STATE == "completed" ]
|
|
|
c460ee |
+}
|
|
|
c460ee |
+
|
|
|
c460ee |
+replace_brick_check_status() {
|
|
|
c460ee |
+ TEST $CLI volume replace-brick $V0 $H0:$B0/${V0}1 $H0:$B0/${V0}1_replace commit force
|
|
|
c460ee |
+ REBAL_STATE=$(get_rebalance_status)
|
|
|
c460ee |
+ TEST [ $REBAL_STATE == "reset" ]
|
|
|
c460ee |
+}
|
|
|
c460ee |
+
|
|
|
c460ee |
+reset_brick_check_status() {
|
|
|
c460ee |
+ TEST $CLI volume reset-brick $V0 $H0:$B0/${V0}2 start
|
|
|
c460ee |
+ TEST $CLI volume reset-brick $V0 $H0:$B0/${V0}2 $H0:$B0/${V0}2 commit force
|
|
|
c460ee |
+ REBAL_STATE=$(get_rebalance_status)
|
|
|
c460ee |
+ TEST [ $REBAL_STATE == "reset" ]
|
|
|
c460ee |
+}
|
|
|
c460ee |
+
|
|
|
c460ee |
+cleanup;
|
|
|
c460ee |
+
|
|
|
c460ee |
+TEST glusterd;
|
|
|
c460ee |
+TEST pidof glusterd;
|
|
|
c460ee |
+
|
|
|
c460ee |
+TEST $CLI volume info;
|
|
|
c460ee |
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{1..6} force;
|
|
|
c460ee |
+TEST $CLI volume start $V0;
|
|
|
c460ee |
+
|
|
|
c460ee |
+run_rebal_check_status;
|
|
|
c460ee |
+replace_brick_check_status;
|
|
|
c460ee |
+reset_brick_check_status;
|
|
|
c460ee |
+
|
|
|
c460ee |
+cleanup;
|
|
|
c460ee |
+
|
|
|
c460ee |
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
|
|
|
c460ee |
index 0615081..80b80e4 100644
|
|
|
c460ee |
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
|
|
|
c460ee |
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
|
|
|
c460ee |
@@ -548,8 +548,8 @@ glusterd_op_replace_brick(dict_t *dict, dict_t *rsp_dict)
|
|
|
c460ee |
(void)glusterd_svcs_manager(volinfo);
|
|
|
c460ee |
goto out;
|
|
|
c460ee |
}
|
|
|
c460ee |
-
|
|
|
c460ee |
- volinfo->rebal.defrag_status = 0;
|
|
|
c460ee |
+ if (volinfo->rebal.defrag_status != GF_DEFRAG_STATUS_NOT_STARTED)
|
|
|
c460ee |
+ volinfo->rebal.defrag_status = GF_DEFRAG_STATUS_RESET_DUE_REPLACE_BRC;
|
|
|
c460ee |
|
|
|
c460ee |
ret = glusterd_svcs_manager(volinfo);
|
|
|
c460ee |
if (ret) {
|
|
|
c460ee |
diff --git a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
|
|
|
c460ee |
index cf04ce8..19d7549 100644
|
|
|
c460ee |
--- a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
|
|
|
c460ee |
+++ b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
|
|
|
c460ee |
@@ -342,7 +342,8 @@ glusterd_op_reset_brick(dict_t *dict, dict_t *rsp_dict)
|
|
|
c460ee |
goto out;
|
|
|
c460ee |
}
|
|
|
c460ee |
|
|
|
c460ee |
- volinfo->rebal.defrag_status = 0;
|
|
|
c460ee |
+ if (volinfo->rebal.defrag_status != GF_DEFRAG_STATUS_NOT_STARTED)
|
|
|
c460ee |
+ volinfo->rebal.defrag_status = GF_DEFRAG_STATUS_RESET_DUE_RESET_BRC;
|
|
|
c460ee |
|
|
|
c460ee |
ret = glusterd_svcs_manager(volinfo);
|
|
|
c460ee |
if (ret) {
|
|
|
c460ee |
--
|
|
|
c460ee |
1.8.3.1
|
|
|
c460ee |
|