summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-04-27 12:33:06 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-04-30 06:54:42 -0700
commit508eb854f3f94f52d4ebd050f3e45deb9cfa90c8 (patch)
tree99a615fd1af3a4ce4dc432f64eb5333422196c2b
parentcf1c53343d4b6fe834833b76c50c61fd8a312de0 (diff)
cli/tiering : Parse detach-tier command properly
gluster detach-tier help should show the usage of detach-tier command properly. Also, instead of force option, if any other was given, then the command should fail with a usage message Change-Id: Ie801529176db067c98fd1bfada056cbc647973fb BUG: 1211570 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/10303 Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
-rw-r--r--cli/src/cli-cmd-parser.c16
-rw-r--r--cli/src/cli-cmd-volume.c6
2 files changed, 17 insertions, 5 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index b30306b2584..e43a0c6e0ec 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1588,9 +1588,6 @@ cli_cmd_volume_detach_tier_parse (const char **words, int wordcount,
int32_t command = GF_OP_CMD_NONE;
int force = 0;
- if (!((wordcount == 4) || (wordcount == 5)))
- goto out;
-
dict = dict_new ();
if (!dict)
goto out;
@@ -1599,10 +1596,23 @@ cli_cmd_volume_detach_tier_parse (const char **words, int wordcount,
if (ret)
goto out;
+ if (wordcount == 3 && !strcmp ((char *)words[2], "help")) {
+ return -1;
+ }
+
+ if (!((wordcount == 4) || (wordcount == 5))) {
+ ret = -1;
+ goto out;
+ }
+
if (wordcount == 5) {
word = (char *)words[4];
if (!strcmp(word, "force"))
force = 1;
+ else {
+ ret = -1;
+ goto out;
+ }
}
word = (char *)words[3];
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index b5d5920bebc..f73cb8bc3db 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -920,9 +920,11 @@ cli_cmd_volume_detach_tier_cbk (struct cli_state *state,
goto out;
ret = cli_cmd_volume_detach_tier_parse(words, wordcount, &options);
-
- if (ret)
+ if (ret) {
+ cli_usage_out (word->pattern);
+ parse_error = 1;
goto out;
+ }
ret = dict_set_int32 (options, "force", 1);
if (ret)