summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorggarg <ggarg@redhat.com>2014-04-21 18:59:00 +0530
committerVijay Bellur <vbellur@redhat.com>2014-05-02 09:31:45 -0700
commitdd5e318e020fab5914567885c1b83815b39d46f9 (patch)
tree16e5292e52b6dce61a8da59c82d8f3f19feacaae /xlators/mgmt
parent0f56f0ce2d2e18fbb2eedf14e93b5a592f0005c3 (diff)
glusterd: Differentiate rebalance status and remove-brick status messages
previously when user triggred 'gluster volume remove-brick VOLNAME BRICK start' then command' gluster volume rebalance <volname> status' showing output even user has not triggred "rebalance start" and when user triggred 'gluster volume rebalance <volname> start' then command 'gluster volume remove-brick VOLNAME BRICK status' showing output even user has not run rebalance start and remove brick start. regression test failed in previous patch. file test/dht.rc and test/bug/bug-973073 edited to avoid regression test failure. now with this fix it will differentiate rebalance and remove-brick status messages. Signed-off-by: ggarg <ggarg@redhat.com> Change-Id: I7f92ad247863b9f5fbc0887cc2ead07754bcfb4f BUG: 1089668 Reviewed-on: http://review.gluster.org/7517 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index bdedf4c0446..4186946c183 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -512,6 +512,7 @@ int
glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
{
char *volname = NULL;
+ char *cmd_str = NULL;
int ret = 0;
int32_t cmd = 0;
char msg[2048] = {0};
@@ -582,6 +583,25 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
break;
case GF_DEFRAG_CMD_STATUS:
case GF_DEFRAG_CMD_STOP:
+ ret = dict_get_str (dict, "cmd-str", &cmd_str);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to get "
+ "command string");
+ ret = -1;
+ goto out;
+ }
+ if ((strstr(cmd_str,"rebalance") != NULL) &&
+ (volinfo->rebal.op != GD_OP_REBALANCE)){
+ snprintf (msg,sizeof(msg),"Rebalance not started.");
+ ret = -1;
+ goto out;
+ }
+ if ((strstr(cmd_str,"remove-brick")!= NULL) &&
+ (volinfo->rebal.op != GD_OP_REMOVE_BRICK)){
+ snprintf (msg,sizeof(msg),"remove-brick not started.");
+ ret = -1;
+ goto out;
+ }
break;
default:
break;