From 7bcf48a73f6313a0cffbc37288041f1dc8bba71e Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Mon, 2 Apr 2012 18:32:05 +0530 Subject: cli/rebalance: Fix parse error for volume rebalance cmd gluster volume rebalance force was handled as a success. Signed-off-by: shishir gowda Change-Id: I4f73aa5935c7e62673d457b52a6dfea6c7197dcc BUG: 808991 Reviewed-on: http://review.gluster.com/3064 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- cli/src/cli-cmd-volume.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'cli') diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 6b65d5f85be..c3222547db1 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -736,7 +736,6 @@ cli_cmd_volume_defrag_cbk (struct cli_state *state, struct cli_cmd_word *word, dict_t *dict = NULL; int sent = 0; int parse_error = 0; - int index = 0; #ifdef GF_SOLARIS_HOST_OS cli_out ("Command not supported on Solaris"); goto out; @@ -757,7 +756,12 @@ cli_cmd_volume_defrag_cbk (struct cli_state *state, struct cli_cmd_word *word, } if (wordcount == 4) { - index = 3; + if (strcmp (words[3], "start") && strcmp (words[3], "stop") && + strcmp (words[3], "status")) { + cli_usage_out (word->pattern); + parse_error = 1; + goto out; + } } else { if (strcmp (words[3], "fix-layout") && strcmp (words[3], "start")) { @@ -765,16 +769,8 @@ cli_cmd_volume_defrag_cbk (struct cli_state *state, struct cli_cmd_word *word, parse_error = 1; goto out; } - index = 4; } - if (strcmp (words[index], "start") && strcmp (words[index], "stop") && - strcmp (words[index], "status") && strcmp (words[index], "force")) { - cli_usage_out (word->pattern); - parse_error = 1; - goto out; - } - ret = dict_set_str (dict, "volname", (char *)words[2]); if (ret) goto out; -- cgit