diff options
author | Mohammed Rafi KC <rkavunga@redhat.com> | 2015-04-27 12:33:06 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-05-09 10:13:03 -0700 |
commit | 63e472fe49a4d13335c59bd6258010f594c7146a (patch) | |
tree | 2c90fad1e1faca261e98a7d4616e7f866ead73eb /cli/src/cli-cmd-parser.c | |
parent | 99b778cbe179104af602b6eedebd31695bec16ae (diff) |
cli/tiering : Parse detach-tier command properly
Back port of http://review.gluster.org/10303
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>
Change-Id: I51ef7c3450c219b2b24724592270461570436010
BUG: 1220050
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Reviewed-on: http://review.gluster.org/10709
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'cli/src/cli-cmd-parser.c')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index e5fb4089dab..310c5f06033 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -1657,9 +1657,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; @@ -1668,10 +1665,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]; |