diff options
| author | Kaushik BV <kaushikbv@gluster.com> | 2010-10-03 02:41:29 +0000 | 
|---|---|---|
| committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-03 03:05:03 -0700 | 
| commit | 609a89ceace25a0a81d0a9cafde3a4d1afd1b916 (patch) | |
| tree | 0205b67be6e1e2f33e9a0c9c1ca4ea0737ebff05 /cli/src/cli-cmd-parser.c | |
| parent | 53b8c7470f9e40c60c5eebd1fbad5c6d274f7ee5 (diff) | |
mgmt/Glusterd: new command volume reset <volname>, volume set enhancementsv3.1.0qa39
- Write the reconfigured options in 'info' file to make it persistant
- Implementation of volume set  <volname> history
- Implementation of volume reset <volname>
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1159 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159
Diffstat (limited to 'cli/src/cli-cmd-parser.c')
| -rw-r--r-- | cli/src/cli-cmd-parser.c | 56 | 
1 files changed, 56 insertions, 0 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 875ead0642e..a6f9cf915a1 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 <VOLNAME> <KEY> <VALUE>");  | 
