summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd-parser.c54
-rw-r--r--cli/src/cli-cmd-volume.c23
-rw-r--r--cli/src/cli.h3
3 files changed, 75 insertions, 5 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 5437b38d3a6..99ef7014d2d 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -926,6 +926,60 @@ out:
}
int32_t
+cli_cmd_inode_quota_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);
+
+ dict = dict_new ();
+ if (!dict) {
+ gf_log ("cli", GF_LOG_ERROR, "dict_new failed");
+ goto out;
+ }
+
+ if (wordcount != 4)
+ goto out;
+
+ volname = (char *)words[2];
+ if (!volname) {
+ ret = -1;
+ goto out;
+ }
+
+ /* Validate the volume name here itself */
+ if (cli_validate_volname (volname) < 0)
+ goto out;
+
+ ret = dict_set_str (dict, "volname", volname);
+ if (ret < 0)
+ goto out;
+
+ if (strcmp (words[3], "enable") != 0) {
+ cli_out ("Invalid quota option : %s", words[3]);
+ ret = -1;
+ goto out;
+ }
+
+ ret = dict_set_int32 (dict, "type",
+ GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS);
+ if (ret < 0)
+ goto out;
+
+ *options = dict;
+out:
+ if (ret < 0) {
+ if (dict)
+ dict_destroy (dict);
+ }
+
+ return ret;
+}
+
+int32_t
cli_cmd_quota_parse (const char **words, int wordcount, dict_t **options)
{
dict_t *dict = NULL;
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 9340067e256..0dfb647b92c 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -1515,11 +1515,20 @@ cli_cmd_quota_cbk (struct cli_state *state, struct cli_cmd_word *word,
"configuration. Do you want to continue?";
//parse **words into options dictionary
- ret = cli_cmd_quota_parse (words, wordcount, &options);
- if (ret < 0) {
- cli_usage_out (word->pattern);
- parse_err = 1;
- goto out;
+ if (strcmp (words[1], "inode-quota") == 0) {
+ ret = cli_cmd_inode_quota_parse (words, wordcount, &options);
+ if (ret < 0) {
+ cli_usage_out (word->pattern);
+ parse_err = 1;
+ goto out;
+ }
+ } else {
+ ret = cli_cmd_quota_parse (words, wordcount, &options);
+ if (ret < 0) {
+ cli_usage_out (word->pattern);
+ parse_err = 1;
+ goto out;
+ }
}
ret = dict_get_int32 (options, "type", &type);
@@ -2649,6 +2658,10 @@ struct cli_cmd volume_cmds[] = {
cli_cmd_quota_cbk,
"quota translator specific operations"},
+ { "volume inode-quota <VOLNAME> enable",
+ cli_cmd_quota_cbk,
+ "quota translator specific operations"},
+
{ "volume top <VOLNAME> {open|read|write|opendir|readdir|clear} [nfs|brick <brick>] [list-cnt <value>] |\n"
"volume top <VOLNAME> {read-perf|write-perf} [bs <size> count <count>] [brick <brick>] [list-cnt <value>]",
cli_cmd_volume_top_cbk,
diff --git a/cli/src/cli.h b/cli/src/cli.h
index 243935230d1..27558a7830c 100644
--- a/cli/src/cli.h
+++ b/cli/src/cli.h
@@ -242,6 +242,9 @@ int32_t
cli_cmd_quota_parse (const char **words, int wordcount, dict_t **opt);
int32_t
+cli_cmd_inode_quota_parse (const char **words, int wordcount, dict_t **opt);
+
+int32_t
cli_cmd_bitrot_parse (const char **words, int wordcount, dict_t **opt);
int32_t