summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-cmd-parser.c
diff options
context:
space:
mode:
authorKaushal M <kaushal@gluster.com>2011-09-26 10:33:56 +0530
committerVijay Bellur <vijay@gluster.com>2011-09-27 05:38:36 -0700
commit9dc9fb48f1790a76c499b105687cee82b2840865 (patch)
tree9762abee91054ec8a1314cf5cddc4dca6f635f02 /cli/src/cli-cmd-parser.c
parentea71efe027e9f741032b6bf9dd995bcaa2fa7947 (diff)
glusterd: support for resetting single option
Allows resetting of only single options using 'volume reset' command. New syntax of volume reset is: 'volume reset [option] [force]'. Giving "all" as options or not specifying an option, causes all options to be reset. Change-Id: Ib9e220f326adeb1be1a774737a0b12c910012cea BUG: 2980 Reviewed-on: http://review.gluster.com/450 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com>
Diffstat (limited to 'cli/src/cli-cmd-parser.c')
-rw-r--r--cli/src/cli-cmd-parser.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 2b3db1939..6d984680e 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -406,7 +406,7 @@ cli_cmd_volume_reset_parse (const char **words, int wordcount, dict_t **options)
if (wordcount < 3)
goto out;
- if (wordcount > 4)
+ if (wordcount > 5)
goto out;
volname = (char *)words[2];
@@ -420,8 +420,29 @@ cli_cmd_volume_reset_parse (const char **words, int wordcount, dict_t **options)
if (ret)
goto out;
- if (wordcount == 4) {
- if (strcmp ("force", (char*)words[3])) {
+ if (wordcount == 3) {
+ ret = dict_set_str (dict, "key", "all");
+ if (ret)
+ goto out;
+ }
+
+ if (wordcount >= 4) {
+ if (!strcmp ("force", (char*)words[3])) {
+ ret = dict_set_int32 (dict, "force", 1);
+ if (ret)
+ goto out;
+ ret = dict_set_str (dict, "key", "all");
+ if (ret)
+ goto out;
+ } else {
+ ret = dict_set_str (dict, "key", (char *)words[3]);
+ if (ret)
+ goto out;
+ }
+ }
+
+ if (wordcount == 5) {
+ if (strcmp ("force", (char*)words[4])) {
ret = -1;
goto out;
} else {