|
|
12a457 |
From cede1e73a39d97eb2a5062be83b0422bb9399f49 Mon Sep 17 00:00:00 2001
|
|
|
12a457 |
From: hari <hgowtham@redhat.com>
|
|
|
12a457 |
Date: Wed, 6 Apr 2016 16:16:47 +0530
|
|
|
12a457 |
Subject: [PATCH 103/104] Tier: tier command fails message when any node is down
|
|
|
12a457 |
|
|
|
12a457 |
back-port of : http://review.gluster.org/#/c/13918/
|
|
|
12a457 |
|
|
|
12a457 |
PROBLEM: the dict doesn't get set on the node if its down.
|
|
|
12a457 |
so while printing the output on cli we get a ENOENT
|
|
|
12a457 |
which ends in a tier command failed.
|
|
|
12a457 |
|
|
|
12a457 |
FIX: this patch skips the node that wasn't available
|
|
|
12a457 |
and carrys on with the next node for both tier status
|
|
|
12a457 |
and tier detach status.
|
|
|
12a457 |
|
|
|
12a457 |
>Change-Id: I718a034b18b109748ec67f3ace56540c50650d23
|
|
|
12a457 |
>BUG: 1324439
|
|
|
12a457 |
>Signed-off-by: hari <hgowtham@redhat.com>
|
|
|
12a457 |
>Reviewed-on: http://review.gluster.org/13918
|
|
|
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: Kaushal M <kaushal@redhat.com>
|
|
|
12a457 |
|
|
|
12a457 |
>Change-Id: Ia23df47596adb24816de4a2a1c8db875f145838e
|
|
|
12a457 |
>BUG: 1328410
|
|
|
12a457 |
>Signed-off-by: hari <hgowtham@redhat.com>
|
|
|
12a457 |
>Reviewed-on: http://review.gluster.org/14030
|
|
|
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: Dan Lambright <dlambrig@redhat.com>
|
|
|
12a457 |
|
|
|
12a457 |
Change-Id: I33868a7cb5a4fcd4f60dcb4db33723226d723d9b
|
|
|
12a457 |
BUG: 1322695
|
|
|
12a457 |
Signed-off-by: hari <hgowtham@redhat.com>
|
|
|
12a457 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/73022
|
|
|
12a457 |
Reviewed-by: Joseph Fernandes <josferna@redhat.com>
|
|
|
12a457 |
Tested-by: Joseph Fernandes <josferna@redhat.com>
|
|
|
12a457 |
---
|
|
|
12a457 |
cli/src/cli-rpc-ops.c | 23 +++++++++++--
|
|
|
12a457 |
tests/basic/tier/new-tier-cmds.t | 64 ++++++++++++++++++++++++++------------
|
|
|
12a457 |
2 files changed, 63 insertions(+), 24 deletions(-)
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
|
|
|
12a457 |
index 9b2699a..6574b08 100644
|
|
|
12a457 |
--- a/cli/src/cli-rpc-ops.c
|
|
|
12a457 |
+++ b/cli/src/cli-rpc-ops.c
|
|
|
12a457 |
@@ -1557,10 +1557,18 @@ gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type)
|
|
|
12a457 |
snprintf (key, 256, "status-%d", i);
|
|
|
12a457 |
|
|
|
12a457 |
ret = dict_get_int32 (dict, key, (int32_t *)&status_rcd);
|
|
|
12a457 |
- if (ret) {
|
|
|
12a457 |
+ if (ret == -ENOENT) {
|
|
|
12a457 |
gf_log ("cli", GF_LOG_TRACE, "count %d %d", count, i);
|
|
|
12a457 |
gf_log ("cli", GF_LOG_TRACE, "failed to get status");
|
|
|
12a457 |
- goto out;
|
|
|
12a457 |
+ gf_log ("cli", GF_LOG_ERROR, "node down and has failed"
|
|
|
12a457 |
+ " to set dict");
|
|
|
12a457 |
+ continue;
|
|
|
12a457 |
+ /* skip this node if value not available*/
|
|
|
12a457 |
+ } else if (ret) {
|
|
|
12a457 |
+ gf_log ("cli", GF_LOG_TRACE, "count %d %d", count, i);
|
|
|
12a457 |
+ gf_log ("cli", GF_LOG_TRACE, "failed to get status");
|
|
|
12a457 |
+ continue;
|
|
|
12a457 |
+ /* skip this node if value not available*/
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
if (GF_DEFRAG_STATUS_NOT_STARTED == status_rcd)
|
|
|
12a457 |
@@ -1682,10 +1690,17 @@ gf_cli_print_tier_status (dict_t *dict, enum gf_task_types task_type)
|
|
|
12a457 |
snprintf (key, 256, "status-%d", i);
|
|
|
12a457 |
|
|
|
12a457 |
ret = dict_get_int32 (dict, key, (int32_t *)&status_rcd);
|
|
|
12a457 |
- if (ret) {
|
|
|
12a457 |
+ if (ret == -ENOENT) {
|
|
|
12a457 |
gf_log ("cli", GF_LOG_TRACE, "count: %d, %d,"
|
|
|
12a457 |
"failed to get status", count, i);
|
|
|
12a457 |
- goto out;
|
|
|
12a457 |
+ gf_log ("cli", GF_LOG_ERROR, "node down and has failed"
|
|
|
12a457 |
+ " to set dict");
|
|
|
12a457 |
+ continue;
|
|
|
12a457 |
+ /*skipping this node as value unavailable*/
|
|
|
12a457 |
+ } else if (ret) {
|
|
|
12a457 |
+ gf_log ("cli", GF_LOG_TRACE, "count: %d, %d,"
|
|
|
12a457 |
+ "failed to get status", count, i);
|
|
|
12a457 |
+ continue;
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
if (GF_DEFRAG_STATUS_NOT_STARTED == status_rcd)
|
|
|
12a457 |
diff --git a/tests/basic/tier/new-tier-cmds.t b/tests/basic/tier/new-tier-cmds.t
|
|
|
12a457 |
index c38ecf9..ce8dbae 100644
|
|
|
12a457 |
--- a/tests/basic/tier/new-tier-cmds.t
|
|
|
12a457 |
+++ b/tests/basic/tier/new-tier-cmds.t
|
|
|
12a457 |
@@ -3,33 +3,42 @@
|
|
|
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 disperse 6 disperse-data 4 $H0:$B0/cold/${V0}{1..12}
|
|
|
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 replica 2 $H0:$B0/hot/${V0}{0..5}
|
|
|
12a457 |
- TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
12a457 |
+ TEST $CLI_1 volume create $V0 $H1:$B1/${V0} $H2:$B2/${V0} $H3:$B3/${V0}
|
|
|
12a457 |
+ TEST $CLI_1 volume start $V0
|
|
|
12a457 |
+ TEST $CLI_1 volume attach-tier $V0 $H1:$B1/${V0}_h1 $H2:$B2/${V0}_h2 $H3:$B3/${V0}_h3
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
function tier_detach_commit () {
|
|
|
12a457 |
- $CLI volume tier $V0 detach commit | grep "success" | wc -l
|
|
|
12a457 |
+ $CLI_1 volume tier $V0 detach commit | grep "success" | wc -l
|
|
|
12a457 |
+}
|
|
|
12a457 |
+
|
|
|
12a457 |
+function tier_detach_status_node_down () {
|
|
|
12a457 |
+ $CLI_1 volume tier $V0 detach status | wc -l
|
|
|
12a457 |
+}
|
|
|
12a457 |
+
|
|
|
12a457 |
+function tier_status_node_down () {
|
|
|
12a457 |
+ $CLI_1 volume tier $V0 status | wc -l
|
|
|
12a457 |
}
|
|
|
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 |
@@ -37,21 +46,36 @@ create_dist_tier_vol
|
|
|
12a457 |
#Issue detach tier on the tiered volume
|
|
|
12a457 |
#Will throw error saying detach tier not started
|
|
|
12a457 |
|
|
|
12a457 |
-EXPECT "Tier command failed" $CLI volume tier $V0 detach status
|
|
|
12a457 |
+EXPECT "Tier command failed" $CLI_1 volume tier $V0 detach status
|
|
|
12a457 |
|
|
|
12a457 |
#after starting detach tier the detach tier status should display the status
|
|
|
12a457 |
|
|
|
12a457 |
-TEST $CLI volume tier $V0 detach start
|
|
|
12a457 |
+TEST $CLI_1 volume tier $V0 detach start
|
|
|
12a457 |
+
|
|
|
12a457 |
+TEST $CLI_1 volume tier $V0 detach status
|
|
|
12a457 |
+
|
|
|
12a457 |
+#kill a node
|
|
|
12a457 |
+TEST kill_node 2
|
|
|
12a457 |
+
|
|
|
12a457 |
+#check if we have the rest of the node available printed in the output of detach status
|
|
|
12a457 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" tier_detach_status_node_down
|
|
|
12a457 |
+
|
|
|
12a457 |
+#check if we have the rest of the node available printed in the output of tier status
|
|
|
12a457 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "5" tier_status_node_down
|
|
|
12a457 |
+
|
|
|
12a457 |
+TEST $glusterd_2;
|
|
|
12a457 |
+
|
|
|
12a457 |
+EXPECT_WITHIN $PROBE_TIMEOUT 2 check_peers;
|
|
|
12a457 |
|
|
|
12a457 |
-TEST $CLI volume tier $V0 detach status
|
|
|
12a457 |
+TEST $CLI_1 volume tier $V0 detach status
|
|
|
12a457 |
|
|
|
12a457 |
-TEST $CLI volume tier $V0 detach stop
|
|
|
12a457 |
+TEST $CLI_1 volume tier $V0 detach stop
|
|
|
12a457 |
|
|
|
12a457 |
#If detach tier is stopped the detach tier command will fail
|
|
|
12a457 |
|
|
|
12a457 |
-EXPECT "Tier command failed" $CLI volume tier $V0 detach status
|
|
|
12a457 |
+EXPECT "Tier command failed" $CLI_1 volume tier $V0 detach status
|
|
|
12a457 |
|
|
|
12a457 |
-TEST $CLI volume tier $V0 detach start
|
|
|
12a457 |
+TEST $CLI_1 volume tier $V0 detach start
|
|
|
12a457 |
|
|
|
12a457 |
#wait for the detach to complete
|
|
|
12a457 |
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" tier_detach_commit
|
|
|
12a457 |
@@ -59,7 +83,7 @@ EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" tier_detach_commit
|
|
|
12a457 |
#If detach tier is committed then the detach status should fail throwing an error
|
|
|
12a457 |
#saying its not a tiered volume
|
|
|
12a457 |
|
|
|
12a457 |
-EXPECT "Tier command failed" $CLI volume tier $V0 detach status
|
|
|
12a457 |
+EXPECT "Tier command failed" $CLI_1 volume tier $V0 detach status
|
|
|
12a457 |
|
|
|
12a457 |
cleanup;
|
|
|
12a457 |
|
|
|
12a457 |
--
|
|
|
12a457 |
1.7.1
|
|
|
12a457 |
|