|
|
12a457 |
From e443f864cdaa49a3c0444167fda2a0ea92c929db Mon Sep 17 00:00:00 2001
|
|
|
12a457 |
From: hari <hgowtham@redhat.com>
|
|
|
12a457 |
Date: Thu, 28 Apr 2016 19:36:25 +0530
|
|
|
12a457 |
Subject: [PATCH 131/139] Tier/glusterd: Resetting the tier status value to not started
|
|
|
12a457 |
|
|
|
12a457 |
back-port of : http://review.gluster.org/#/c/14106/
|
|
|
12a457 |
|
|
|
12a457 |
Problem: during a volume restart or tier start force, the
|
|
|
12a457 |
value of tier status is set as started irrespective of the result.
|
|
|
12a457 |
|
|
|
12a457 |
Fix: The appropriate value of status is set during the restart of
|
|
|
12a457 |
rebalance function.
|
|
|
12a457 |
|
|
|
12a457 |
>Change-Id: I6164f0add48542a57dee059e80fa0f9bb036dbef
|
|
|
12a457 |
>BUG: 1315666
|
|
|
12a457 |
>Signed-off-by: hari <hgowtham@redhat.com>
|
|
|
12a457 |
|
|
|
12a457 |
>Change-Id: Ie4345bd7ce1d458574e36b70fe8994b3d758396a
|
|
|
12a457 |
>BUG: 1316808
|
|
|
12a457 |
>Signed-off-by: hari <hgowtham@redhat.com>
|
|
|
12a457 |
>Reviewed-on: http://review.gluster.org/14229
|
|
|
12a457 |
>Smoke: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>Tested-by: hari gowtham <hari.gowtham005@gmail.com>
|
|
|
12a457 |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
12a457 |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
12a457 |
|
|
|
12a457 |
Change-Id: I26363875b512fe7641cf63d849a61739bc35ee68
|
|
|
12a457 |
BUG: 1283957
|
|
|
12a457 |
Signed-off-by: hari <hgowtham@redhat.com>
|
|
|
12a457 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/73782
|
|
|
12a457 |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
12a457 |
Tested-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
12a457 |
---
|
|
|
12a457 |
tests/basic/tier/tierd_check.t | 76 +++++++++++++++++++++-------
|
|
|
12a457 |
xlators/mgmt/glusterd/src/glusterd-utils.c | 13 +++--
|
|
|
12a457 |
2 files changed, 67 insertions(+), 22 deletions(-)
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/tests/basic/tier/tierd_check.t b/tests/basic/tier/tierd_check.t
|
|
|
12a457 |
index 9ef12d5..25f8257 100644
|
|
|
12a457 |
--- a/tests/basic/tier/tierd_check.t
|
|
|
12a457 |
+++ b/tests/basic/tier/tierd_check.t
|
|
|
12a457 |
@@ -3,20 +3,24 @@
|
|
|
12a457 |
. $(dirname $0)/../../include.rc
|
|
|
12a457 |
. $(dirname $0)/../../volume.rc
|
|
|
12a457 |
. $(dirname $0)/../../tier.rc
|
|
|
12a457 |
+. $(dirname $0)/../../cluster.rc
|
|
|
12a457 |
|
|
|
12a457 |
|
|
|
12a457 |
# Creates a tiered volume with pure distribute hot and cold tiers
|
|
|
12a457 |
# Both hot and cold tiers will have an equal number of bricks.
|
|
|
12a457 |
|
|
|
12a457 |
+function check_peers {
|
|
|
12a457 |
+ $CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l
|
|
|
12a457 |
+}
|
|
|
12a457 |
+
|
|
|
12a457 |
function create_dist_tier_vol () {
|
|
|
12a457 |
- mkdir $B0/cold
|
|
|
12a457 |
- mkdir $B0/hot
|
|
|
12a457 |
- TEST $CLI volume create $V0 $H0:$B0/cold/${V0}{1..3}
|
|
|
12a457 |
- TEST $CLI volume set $V0 performance.quick-read off
|
|
|
12a457 |
- TEST $CLI volume set $V0 performance.io-cache off
|
|
|
12a457 |
- TEST $CLI volume start $V0
|
|
|
12a457 |
- TEST $CLI volume attach-tier $V0 $H0:$B0/hot/${V0}{1..2}
|
|
|
12a457 |
- TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
12a457 |
+ TEST $CLI_1 volume create $V0 $H1:$B1/${V0} $H2:$B2/${V0}
|
|
|
12a457 |
+ TEST $CLI_1 volume start $V0
|
|
|
12a457 |
+ TEST $CLI_1 volume attach-tier $V0 $H1:$B1/${V0}_h1 $H2:$B2/${V0}_h2
|
|
|
12a457 |
+}
|
|
|
12a457 |
+
|
|
|
12a457 |
+function tier_status () {
|
|
|
12a457 |
+ $CLI_1 volume tier $V0 status | grep progress | wc -l
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
function tier_deamon_kill () {
|
|
|
12a457 |
@@ -26,37 +30,73 @@ echo "$?"
|
|
|
12a457 |
|
|
|
12a457 |
cleanup;
|
|
|
12a457 |
|
|
|
12a457 |
-#Basic checks
|
|
|
12a457 |
-TEST glusterd
|
|
|
12a457 |
-TEST pidof glusterd
|
|
|
12a457 |
-TEST $CLI volume status
|
|
|
12a457 |
+#setup cluster and test volume
|
|
|
12a457 |
+TEST launch_cluster 3; # start 3-node virtual cluster
|
|
|
12a457 |
+TEST $CLI_1 peer probe $H2; # peer probe server 2 from server 1 cli
|
|
|
12a457 |
+TEST $CLI_1 peer probe $H3; # peer probe server 3 from server 1 cli
|
|
|
12a457 |
|
|
|
12a457 |
+EXPECT_WITHIN $PROBE_TIMEOUT 2 check_peers;
|
|
|
12a457 |
|
|
|
12a457 |
#Create and start a tiered volume
|
|
|
12a457 |
create_dist_tier_vol
|
|
|
12a457 |
|
|
|
12a457 |
EXPECT_WITHIN $PROCESS_UP_TIMEOUT 0 tier_daemon_check
|
|
|
12a457 |
|
|
|
12a457 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" tier_status
|
|
|
12a457 |
+
|
|
|
12a457 |
EXPECT_WITHIN $PROCESS_UP_TIMEOUT 0 tier_deamon_kill
|
|
|
12a457 |
|
|
|
12a457 |
-TEST $CLI volume tier $V0 start
|
|
|
12a457 |
+TEST $CLI_1 volume tier $V0 start
|
|
|
12a457 |
|
|
|
12a457 |
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" tier_daemon_check
|
|
|
12a457 |
|
|
|
12a457 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" tier_status
|
|
|
12a457 |
+
|
|
|
12a457 |
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" tier_deamon_kill
|
|
|
12a457 |
|
|
|
12a457 |
-TEST $CLI volume tier $V0 start force
|
|
|
12a457 |
+TEST $CLI_3 volume tier $V0 start force
|
|
|
12a457 |
|
|
|
12a457 |
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" tier_daemon_check
|
|
|
12a457 |
|
|
|
12a457 |
-TEST $CLI volume tier $V0 start force
|
|
|
12a457 |
+#The pattern progress should occur twice only.
|
|
|
12a457 |
+#it shouldn't come up on the third node without tierd even
|
|
|
12a457 |
+#after the tier start force is issued on the node without
|
|
|
12a457 |
+#tierd
|
|
|
12a457 |
+
|
|
|
12a457 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" tier_status
|
|
|
12a457 |
+
|
|
|
12a457 |
+#kill the node on which tier is not supposed to run
|
|
|
12a457 |
+TEST kill_node 3
|
|
|
12a457 |
+
|
|
|
12a457 |
+#bring the node back, it should not have tierd running on it
|
|
|
12a457 |
+TEST $glusterd_3;
|
|
|
12a457 |
+
|
|
|
12a457 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" tier_status
|
|
|
12a457 |
+
|
|
|
12a457 |
+#after volume restart, check for tierd
|
|
|
12a457 |
+
|
|
|
12a457 |
+TEST $CLI_3 volume stop $V0
|
|
|
12a457 |
+
|
|
|
12a457 |
+TEST $CLI_3 volume start $V0
|
|
|
12a457 |
+
|
|
|
12a457 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" tier_status
|
|
|
12a457 |
+
|
|
|
12a457 |
+#check for detach start and stop
|
|
|
12a457 |
+
|
|
|
12a457 |
+TEST $CLI_3 volume tier $V0 detach start
|
|
|
12a457 |
+
|
|
|
12a457 |
+TEST $CLI_3 volume tier $V0 detach stop
|
|
|
12a457 |
+
|
|
|
12a457 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" tier_status
|
|
|
12a457 |
+
|
|
|
12a457 |
+TEST $CLI_1 volume tier $V0 start force
|
|
|
12a457 |
|
|
|
12a457 |
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" tier_daemon_check
|
|
|
12a457 |
|
|
|
12a457 |
-# To test fordetach start fail while the brick is down
|
|
|
12a457 |
+# To test for detach start fail while the brick is down
|
|
|
12a457 |
|
|
|
12a457 |
-TEST pkill -f "$B0/hot/$V0"
|
|
|
12a457 |
+TEST pkill -f "$B1/$V0"
|
|
|
12a457 |
|
|
|
12a457 |
-TEST ! $CLI volume tier $V0 detach start
|
|
|
12a457 |
+TEST ! $CLI_1 volume tier $V0 detach start
|
|
|
12a457 |
|
|
|
12a457 |
cleanup
|
|
|
12a457 |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
12a457 |
index 70c45ba..3b4669c 100644
|
|
|
12a457 |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
12a457 |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
12a457 |
@@ -7227,6 +7227,8 @@ glusterd_volume_defrag_restart (glusterd_volinfo_t *volinfo, char *op_errstr,
|
|
|
12a457 |
case GF_DEFRAG_STATUS_NOT_STARTED:
|
|
|
12a457 |
ret = glusterd_handle_defrag_start (volinfo, op_errstr, len,
|
|
|
12a457 |
cmd, cbk, volinfo->rebal.op);
|
|
|
12a457 |
+ if (ret)
|
|
|
12a457 |
+ volinfo->rebal.defrag_status = GF_DEFRAG_STATUS_FAILED;
|
|
|
12a457 |
break;
|
|
|
12a457 |
default:
|
|
|
12a457 |
gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
12a457 |
@@ -7238,6 +7240,7 @@ glusterd_volume_defrag_restart (glusterd_volinfo_t *volinfo, char *op_errstr,
|
|
|
12a457 |
}
|
|
|
12a457 |
out:
|
|
|
12a457 |
return ret;
|
|
|
12a457 |
+
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
void
|
|
|
12a457 |
@@ -7299,9 +7302,6 @@ glusterd_restart_rebalance_for_volume (glusterd_volinfo_t *volinfo)
|
|
|
12a457 |
int ret = -1;
|
|
|
12a457 |
char op_errstr[PATH_MAX];
|
|
|
12a457 |
|
|
|
12a457 |
- if (!volinfo->rebal.defrag_cmd)
|
|
|
12a457 |
- return -1;
|
|
|
12a457 |
-
|
|
|
12a457 |
if (!gd_should_i_start_rebalance (volinfo)) {
|
|
|
12a457 |
|
|
|
12a457 |
/* Store the rebalance-id and rebalance command even if
|
|
|
12a457 |
@@ -7312,11 +7312,17 @@ glusterd_restart_rebalance_for_volume (glusterd_volinfo_t *volinfo)
|
|
|
12a457 |
* Storing this is needed for having 'volume status'
|
|
|
12a457 |
* work correctly.
|
|
|
12a457 |
*/
|
|
|
12a457 |
+ volinfo->rebal.defrag_status = GF_DEFRAG_STATUS_NOT_STARTED;
|
|
|
12a457 |
if (volinfo->type == GF_CLUSTER_TYPE_TIER)
|
|
|
12a457 |
glusterd_store_perform_node_state_store (volinfo);
|
|
|
12a457 |
|
|
|
12a457 |
return 0;
|
|
|
12a457 |
}
|
|
|
12a457 |
+ if (!volinfo->rebal.defrag_cmd) {
|
|
|
12a457 |
+ volinfo->rebal.defrag_status = GF_DEFRAG_STATUS_FAILED;
|
|
|
12a457 |
+ return -1;
|
|
|
12a457 |
+ }
|
|
|
12a457 |
+
|
|
|
12a457 |
ret = glusterd_volume_defrag_restart (volinfo, op_errstr, PATH_MAX,
|
|
|
12a457 |
volinfo->rebal.defrag_cmd,
|
|
|
12a457 |
volinfo->rebal.op == GD_OP_REMOVE_BRICK ?
|
|
|
12a457 |
@@ -7331,7 +7337,6 @@ glusterd_restart_rebalance_for_volume (glusterd_volinfo_t *volinfo)
|
|
|
12a457 |
volinfo->decommission_in_progress = 1;
|
|
|
12a457 |
}
|
|
|
12a457 |
}
|
|
|
12a457 |
-
|
|
|
12a457 |
return ret;
|
|
|
12a457 |
}
|
|
|
12a457 |
int
|
|
|
12a457 |
--
|
|
|
12a457 |
1.7.1
|
|
|
12a457 |
|