summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorhari gowtham <hgowtham@redhat.com>2015-12-04 18:34:36 +0530
committerDan Lambright <dlambrig@redhat.com>2015-12-16 09:28:19 -0800
commit5f6baf2cb061fd32a35bff2081b8ba966871e39d (patch)
tree3b06fcd464f4eb22b6290cbdb5ea0126a8759985 /xlators
parente35b9e272be54c3a2f9f9e7409053c6fb94707bb (diff)
tier/glusterd : making new tier detach command throw warning
back port of : http://review.gluster.org/#/c/12883/ For detach tier, the validation was done using the string "detach-tier" but the new commands used has the string "tier". Making the string use "tier" to compare, creates problem as the tier status and tier detach have the keyword "tier". So tier detach and tier status were separated. and strtok was used to prevent the condition from passing when the volume name has a substring of "tier". (only the second word from the string is got and checked if the feature is tier). Problem: new detach tier command doesnt throw warnings like "not a tier volume" or " detach tier not started" respectively instead it prints empty output. Fix: while validate the volume is checked if its a tiered volume if yes it is checked if the detach tier is started, else a warning is thrown respectively. >Change-Id: I94246d53b18ab0e9406beaf459eaddb7c5b766c2 >BUG: 1288517 >Signed-off-by: hari gowtham <hgowtham@redhat.com> >Reviewed-on: http://review.gluster.org/12883 >Tested-by: NetBSD Build System <jenkins@build.gluster.org> >Tested-by: Gluster Build System <jenkins@build.gluster.com> >Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Change-Id: I1ac3b6baaec644dbc2025085a7f17abd56ba169d BUG: 1291970 Signed-off-by: hari gowtham <hgowtham@redhat.com> Reviewed-on: http://review.gluster.org/12976 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c45
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c1
2 files changed, 26 insertions, 20 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index 1dea5470738..ea443aaa05e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -528,7 +528,8 @@ __glusterd_handle_defrag_volume (rpcsvc_request_t *req)
if ((cmd == GF_DEFRAG_CMD_STATUS) ||
(cmd == GF_DEFRAG_CMD_STATUS_TIER) ||
(cmd == GF_DEFRAG_CMD_STOP_DETACH_TIER) ||
- (cmd == GF_DEFRAG_CMD_STOP)) {
+ (cmd == GF_DEFRAG_CMD_STOP) ||
+ (cmd == GF_DEFRAG_CMD_DETACH_STATUS)) {
ret = glusterd_op_begin (req, GD_OP_DEFRAG_BRICK_VOLUME,
dict, msg, sizeof (msg));
} else
@@ -705,7 +706,7 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
case GF_DEFRAG_CMD_STATUS_TIER:
case GF_DEFRAG_CMD_STATUS:
case GF_DEFRAG_CMD_STOP:
- case GF_DEFRAG_CMD_STOP_DETACH_TIER:
+
ret = dict_get_str (dict, "cmd-str", &cmd_str);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
@@ -720,6 +721,7 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
ret = -1;
goto out;
}
+
if (strstr(cmd_str, "remove-brick") != NULL) {
if (volinfo->rebal.op != GD_OP_REMOVE_BRICK) {
snprintf (msg, sizeof(msg), "remove-brick not "
@@ -740,7 +742,7 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
goto out;
}
}
- if (strstr(cmd_str, "tier") != NULL) {
+ if (cmd == GF_DEFRAG_CMD_STATUS_TIER) {
if (volinfo->type != GF_CLUSTER_TYPE_TIER) {
snprintf (msg, sizeof(msg), "volume %s is not "
"a tier volume.", volinfo->volname);
@@ -748,21 +750,24 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
goto out;
}
}
- if (strstr(cmd_str, "detach-tier") != NULL) {
- if (volinfo->type != GF_CLUSTER_TYPE_TIER) {
- snprintf (msg, sizeof(msg), "volume %s is not "
- "a tier volume.", volinfo->volname);
- ret = -1;
- goto out;
- }
- if (volinfo->rebal.op != GD_OP_REMOVE_BRICK) {
- snprintf (msg, sizeof(msg), "Detach-tier "
- "not started");
- ret = -1;
- goto out;
- }
+
+ break;
+
+ case GF_DEFRAG_CMD_STOP_DETACH_TIER:
+ case GF_DEFRAG_CMD_DETACH_STATUS:
+ if (volinfo->type != GF_CLUSTER_TYPE_TIER) {
+ snprintf (msg, sizeof(msg), "volume %s is not "
+ "a tier volume.", volinfo->volname);
+ ret = -1;
+ goto out;
}
+ if (volinfo->rebal.op != GD_OP_REMOVE_BRICK) {
+ snprintf (msg, sizeof(msg), "Detach-tier "
+ "not started");
+ ret = -1;
+ goto out;
+ }
break;
default:
break;
@@ -929,11 +934,11 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
}
if (volinfo->type == GF_CLUSTER_TYPE_TIER &&
- cmd == GF_OP_CMD_STOP_DETACH_TIER) {
+ cmd == GF_OP_CMD_STOP_DETACH_TIER) {
glusterd_defrag_info_set (volinfo, dict,
- GF_DEFRAG_CMD_START_TIER,
- GF_DEFRAG_CMD_START,
- GD_OP_REBALANCE);
+ GF_DEFRAG_CMD_START_TIER,
+ GF_DEFRAG_CMD_START,
+ GD_OP_REBALANCE);
glusterd_restart_rebalance_for_volume (volinfo);
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index df5ac17242b..c373229788b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -10814,6 +10814,7 @@ glusterd_disallow_op_for_tier (glusterd_volinfo_t *volinfo, glusterd_op_t op,
case GF_DEFRAG_CMD_START_DETACH_TIER:
case GF_DEFRAG_CMD_STOP_DETACH_TIER:
case GF_DEFRAG_CMD_STATUS:
+ case GF_DEFRAG_CMD_DETACH_STATUS:
ret = 0;
break;
default: