diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 16 | ||||
-rw-r--r-- | cli/src/cli-cmd-volume.c | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 300091d978b..c476638ba77 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -373,6 +373,7 @@ cli_cmd_quota_parse (const char **words, int wordcount, dict_t **options) int ret = -1; int i = 0; char key[20] = {0, }; + uint64_t value = 0; gf_quota_type type = GF_QUOTA_OPTION_TYPE_NONE; GF_ASSERT (words); @@ -418,17 +419,16 @@ cli_cmd_quota_parse (const char **words, int wordcount, dict_t **options) } ret = dict_set_str (dict, "volname", volname); - if (ret) goto out; - if ((strcasecmp (words[3], "enable")) == 0) { + if ((strcasecmp (words[3], "enable")) == 0 && wordcount == 4) { type = GF_QUOTA_OPTION_TYPE_ENABLE; goto set_type; } - if (strcasecmp (words[3], "disable") == 0) { + if (strcasecmp (words[3], "disable") == 0 && wordcount == 4) { type = GF_QUOTA_OPTION_TYPE_DISABLE; goto set_type; } @@ -447,17 +447,21 @@ cli_cmd_quota_parse (const char **words, int wordcount, dict_t **options) return -2; } ret = dict_set_str (dict, "path", (char *) words[4]); - if (ret) goto out; if (!words[5]) { - gf_log ("cli", GF_LOG_ERROR, "Please enter the limit value " - "to be set"); + cli_out ("Please enter the limit value to be set"); return -2; } + ret = gf_string2bytesize (words[5], &value); + if (ret != 0) { + cli_out ("Please enter a correct value"); + return -1; + } + ret = dict_set_str (dict, "limit", (char *) words[5]); if (ret) goto out; diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index f008384ae64..3f639300f2c 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -1171,7 +1171,7 @@ struct cli_cmd volume_cmds[] = { cli_cmd_volume_profile_cbk, "volume profile operations"}, - { "volume quota <VOLNAME> <enable|disable|limit-usage|list|remove> [args] [path]", + { "volume quota <VOLNAME> <enable|disable|limit-usage|list|remove> [path] [value]", cli_cmd_quota_cbk, "quota translator specific operations"}, |