summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-04-12 07:17:44 +0000
committerAnand Avati <avati@gluster.com>2011-04-13 00:39:03 -0700
commitbc16a1e999648ba58f863d26281c152fb477174a (patch)
tree339e72925c06d56355b338b01f72618892a1667a /cli
parentfb3e469e29578393a0d5f964991d26b5449bffb0 (diff)
mgmt/glusterd: volume reset force implementation
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2729 (Implement force option for volume reset) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2729
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c20
-rw-r--r--cli/src/cli-cmd-volume.c2
2 files changed, 17 insertions, 5 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index c476638ba77..a0219a04ad7 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -342,6 +342,9 @@ cli_cmd_volume_reset_parse (const char **words, int wordcount, dict_t **options)
if (wordcount < 3)
goto out;
+ if (wordcount > 4)
+ goto out;
+
volname = (char *)words[2];
if (!volname) {
@@ -350,17 +353,26 @@ cli_cmd_volume_reset_parse (const char **words, int wordcount, dict_t **options)
}
ret = dict_set_str (dict, "volname", volname);
-
if (ret)
goto out;
+ if (wordcount == 4) {
+ if (strcmp ("force", (char*)words[3])) {
+ ret = -1;
+ goto out;
+ } else {
+ ret = dict_set_int32 (dict, "force", 1);
+ if (ret)
+ goto out;
+ }
+ }
+
*options = dict;
out:
- if (ret) {
- if (dict)
+ if (ret && dict) {
dict_destroy (dict);
- }
+ }
return ret;
}
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index f2e32363842..1735c387346 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -1160,7 +1160,7 @@ struct cli_cmd volume_cmds[] = {
cli_cmd_sync_volume_cbk,
"sync the volume information from a peer"},
- { "volume reset <VOLNAME> ",
+ { "volume reset <VOLNAME> [force]",
cli_cmd_volume_reset_cbk,
"reset all the reconfigured options"},