diff options
Diffstat (limited to 'cli/src')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 27 | ||||
-rw-r--r-- | cli/src/cli-cmd-volume.c | 2 |
2 files changed, 25 insertions, 4 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 2b3db193925..6d984680e35 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 { diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index a2ec5086317..00077253237 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -1579,7 +1579,7 @@ struct cli_cmd volume_cmds[] = { cli_cmd_sync_volume_cbk, "sync the volume information from a peer"}, - { "volume reset <VOLNAME> [force]", + { "volume reset <VOLNAME> [option] [force]", cli_cmd_volume_reset_cbk, "reset all the reconfigured options"}, |