From 609a89ceace25a0a81d0a9cafde3a4d1afd1b916 Mon Sep 17 00:00:00 2001 From: Kaushik BV Date: Sun, 3 Oct 2010 02:41:29 +0000 Subject: mgmt/Glusterd: new command volume reset , volume set enhancements - Write the reconfigured options in 'info' file to make it persistant - Implementation of volume set history - Implementation of volume reset Signed-off-by: Kaushik BV Signed-off-by: Vijay Bellur BUG: 1159 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159 --- cli/src/cli-cmd-parser.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (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 875ead064..a6f9cf915 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -288,6 +288,49 @@ out: return ret; } +int32_t +cli_cmd_volume_reset_parse (const char **words, int wordcount, dict_t **options) +{ + dict_t *dict = NULL; + char *volname = NULL; + int ret = -1; + + GF_ASSERT (words); + GF_ASSERT (options); + + GF_ASSERT ((strcmp (words[0], "volume")) == 0); + GF_ASSERT ((strcmp (words[1], "reset")) == 0); + + dict = dict_new (); + + if (!dict) + goto out; + + if (wordcount < 3) + goto out; + + volname = (char *)words[2]; + + if (!volname) { + ret = -1; + goto out; + } + + ret = dict_set_str (dict, "volname", volname); + + if (ret) + goto out; + + *options = dict; + +out: + if (ret) { + if (dict) + dict_destroy (dict); + } + + return ret; +} int32_t cli_cmd_volume_set_parse (const char **words, int wordcount, dict_t **options) @@ -329,6 +372,19 @@ cli_cmd_volume_set_parse (const char **words, int wordcount, dict_t **options) key = (char *) words[i]; value = (char *) words[i+1]; + if ( key && !value ) { + if ( !strcmp (key, "history")) { + ret = dict_set_str (dict, key, "history"); + if (ret) + goto out; + ret = dict_set_int32 (dict, "count", 1); + if (ret) + goto out; + *options = dict; + goto out; + } + } + if ( !key || !value) { ret = -1; cli_out ("Usage: volume set "); -- cgit