|
|
3604df |
From 840441debbacf9c6a35397219f6409c99675a40a Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: N Balachandran <nbalacha@redhat.com>
|
|
|
3604df |
Date: Thu, 17 Nov 2016 20:33:17 +0530
|
|
|
3604df |
Subject: [PATCH 172/206] cli/rebalance: remove brick status is incorrect
|
|
|
3604df |
|
|
|
3604df |
If a remove brick operation is preceded by a fix-layout,
|
|
|
3604df |
running remove-brick status on a node which does not
|
|
|
3604df |
contain any of the bricks that were removed displays
|
|
|
3604df |
fix-layout status.
|
|
|
3604df |
|
|
|
3604df |
The defrag_cmd variable was not updated in glusterd
|
|
|
3604df |
for the nodes not hosting removed bricks causing the
|
|
|
3604df |
status parsing to go wrong. This is now updated.
|
|
|
3604df |
Also made minor modifications to the spacing in
|
|
|
3604df |
the fix-layout status output.
|
|
|
3604df |
|
|
|
3604df |
Upstream patches:
|
|
|
3604df |
master : http://review.gluster.org/15749
|
|
|
3604df |
|
|
|
3604df |
Change-Id: Ia4a7928644f85a646587061b0e9635a084c4ea83
|
|
|
3604df |
BUG: 1386127
|
|
|
3604df |
Signed-off-by: N Balachandran <nbalacha@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/90472
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
Tested-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
cli/src/cli-rpc-ops.c | 21 ++++++++++---
|
|
|
3604df |
tests/bugs/distribute/bug-1389697.t | 42 ++++++++++++++++++++++++++
|
|
|
3604df |
xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 3 ++
|
|
|
3604df |
3 files changed, 61 insertions(+), 5 deletions(-)
|
|
|
3604df |
create mode 100644 tests/bugs/distribute/bug-1389697.t
|
|
|
3604df |
|
|
|
3604df |
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
|
|
|
3604df |
index 58884a2..bbb5894 100644
|
|
|
3604df |
--- a/cli/src/cli-rpc-ops.c
|
|
|
3604df |
+++ b/cli/src/cli-rpc-ops.c
|
|
|
3604df |
@@ -1610,6 +1610,7 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type,
|
|
|
3604df |
int min = 0;
|
|
|
3604df |
int sec = 0;
|
|
|
3604df |
gf_boolean_t down = _gf_false;
|
|
|
3604df |
+ gf_boolean_t fix_layout = _gf_false;
|
|
|
3604df |
|
|
|
3604df |
ret = dict_get_int32 (dict, "count", &count);
|
|
|
3604df |
if (ret) {
|
|
|
3604df |
@@ -1627,10 +1628,20 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type,
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
- if (status_rcd >= GF_DEFRAG_STATUS_LAYOUT_FIX_STARTED) {
|
|
|
3604df |
- cli_out ("%10s %40s %18s", "Node", "status",
|
|
|
3604df |
+ /* Fix layout will be sent to all nodes for the volume
|
|
|
3604df |
+ so every status should be of type
|
|
|
3604df |
+ GF_DEFRAG_STATUS_LAYOUT_FIX*
|
|
|
3604df |
+ */
|
|
|
3604df |
+
|
|
|
3604df |
+ if ((task_type == GF_TASK_TYPE_REBALANCE)
|
|
|
3604df |
+ && (status_rcd >= GF_DEFRAG_STATUS_LAYOUT_FIX_STARTED)) {
|
|
|
3604df |
+ fix_layout = _gf_true;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+ if (fix_layout) {
|
|
|
3604df |
+ cli_out ("%20s %40s %18s", "Node", "status",
|
|
|
3604df |
"run time in h:m:s");
|
|
|
3604df |
- cli_out ("%10s %40s %18s", "---------", "-----------",
|
|
|
3604df |
+ cli_out ("%20s %40s %18s", "---------", "-----------",
|
|
|
3604df |
"------------");
|
|
|
3604df |
} else {
|
|
|
3604df |
cli_out ("%40s %16s %13s %13s %13s %13s %20s %18s",
|
|
|
3604df |
@@ -1739,8 +1750,8 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type,
|
|
|
3604df |
min = ((int) elapsed % 3600) / 60;
|
|
|
3604df |
sec = ((int) elapsed % 3600) % 60;
|
|
|
3604df |
|
|
|
3604df |
- if (status_rcd >= GF_DEFRAG_STATUS_LAYOUT_FIX_STARTED) {
|
|
|
3604df |
- cli_out ("%10s %40s %8d:%d:%d", node_name, status_str,
|
|
|
3604df |
+ if (fix_layout) {
|
|
|
3604df |
+ cli_out ("%20s %40s %8d:%d:%d", node_name, status_str,
|
|
|
3604df |
hrs, min, sec);
|
|
|
3604df |
} else {
|
|
|
3604df |
if (size_str) {
|
|
|
3604df |
diff --git a/tests/bugs/distribute/bug-1389697.t b/tests/bugs/distribute/bug-1389697.t
|
|
|
3604df |
new file mode 100644
|
|
|
3604df |
index 0000000..0d428b8
|
|
|
3604df |
--- /dev/null
|
|
|
3604df |
+++ b/tests/bugs/distribute/bug-1389697.t
|
|
|
3604df |
@@ -0,0 +1,42 @@
|
|
|
3604df |
+#!/bin/bash
|
|
|
3604df |
+
|
|
|
3604df |
+. $(dirname $0)/../../include.rc
|
|
|
3604df |
+. $(dirname $0)/../../cluster.rc
|
|
|
3604df |
+
|
|
|
3604df |
+
|
|
|
3604df |
+cleanup
|
|
|
3604df |
+
|
|
|
3604df |
+TEST launch_cluster 2;
|
|
|
3604df |
+TEST $CLI_1 peer probe $H2;
|
|
|
3604df |
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count
|
|
|
3604df |
+
|
|
|
3604df |
+TEST $CLI_1 volume create $V0 $H1:$B1/b1 $H1:$B1/b2 $H2:$B2/b3
|
|
|
3604df |
+TEST $CLI_1 volume start $V0
|
|
|
3604df |
+
|
|
|
3604df |
+#Start a fix-layout
|
|
|
3604df |
+TEST $CLI_1 volume rebalance $V0 fix-layout start
|
|
|
3604df |
+
|
|
|
3604df |
+#volume rebalance status should work
|
|
|
3604df |
+TEST $CLI_1 volume rebalance $V0 status
|
|
|
3604df |
+$CLI_1 volume rebalance $V0 status
|
|
|
3604df |
+
|
|
|
3604df |
+val=$($CLI_1 volume rebalance $V0 status |grep "fix-layout" 2>&1)
|
|
|
3604df |
+val=$?
|
|
|
3604df |
+TEST [ $val -eq 0 ];
|
|
|
3604df |
+
|
|
|
3604df |
+#Start a remove brick for the brick on H2
|
|
|
3604df |
+TEST $CLI_1 volume remove-brick $V0 $H2:$B2/b3 start
|
|
|
3604df |
+TEST $CLI_1 volume remove-brick $V0 $H2:$B2/b3 status
|
|
|
3604df |
+
|
|
|
3604df |
+#Check remove brick status from H1
|
|
|
3604df |
+$CLI_1 volume remove-brick $V0 $H2:$B2/b3 status |grep "fix-layout" 2>&1
|
|
|
3604df |
+val=$?
|
|
|
3604df |
+TEST [ $val -eq 1 ];
|
|
|
3604df |
+
|
|
|
3604df |
+$CLI_1 volume remove-brick $V0 $H2:$B2/b3 status
|
|
|
3604df |
+$CLI_2 volume remove-brick $V0 $H2:$B2/b3 status
|
|
|
3604df |
+
|
|
|
3604df |
+
|
|
|
3604df |
+TEST $CLI_1 volume remove-brick $V0 $H2:$B2/b3 stop
|
|
|
3604df |
+
|
|
|
3604df |
+cleanup
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
|
|
|
3604df |
index 92e6386..971dac8 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
|
|
|
3604df |
@@ -2646,7 +2646,10 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
|
|
|
3604df |
/* Reset defrag status to 'NOT STARTED' whenever a
|
|
|
3604df |
* remove-brick/rebalance command is issued to remove
|
|
|
3604df |
* stale information from previous run.
|
|
|
3604df |
+ * Update defrag_cmd as well or it will only be done
|
|
|
3604df |
+ * for nodes on which the brick to be removed exists.
|
|
|
3604df |
*/
|
|
|
3604df |
+ volinfo->rebal.defrag_cmd = cmd;
|
|
|
3604df |
volinfo->rebal.defrag_status = GF_DEFRAG_STATUS_NOT_STARTED;
|
|
|
3604df |
ret = dict_get_str (dict, GF_REMOVE_BRICK_TID_KEY, &task_id_str);
|
|
|
3604df |
if (ret) {
|
|
|
3604df |
--
|
|
|
3604df |
2.9.3
|
|
|
3604df |
|