From bc16a1e999648ba58f863d26281c152fb477174a Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 12 Apr 2011 07:17:44 +0000 Subject: mgmt/glusterd: volume reset force implementation Signed-off-by: Pranith Kumar K Signed-off-by: Anand Avati BUG: 2729 (Implement force option for volume reset) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2729 --- cli/src/cli-cmd-parser.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'cli/src/cli-cmd-parser.c') 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; } -- cgit