summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorAnuradha <atalur@redhat.com>2013-10-30 11:57:38 +0530
committerVijay Bellur <vbellur@redhat.com>2013-12-11 03:46:26 -0800
commit4bbbda2017be3cfae57c122d70d11c9470364f63 (patch)
tree7e86a9801568bd970c3af69caba2b7a7ad5790e7 /cli
parent11b4f3aedfacf2cb29c409765936940271329e73 (diff)
cli : enabling/disabling quota using volume set cmd deprecated
Using the command 'gluster volume set <volname> quota {on|off}' doesn't really enable/disable quota. So, a message to the user is provided. Message asks the user to use 'gluster volume quota <volname> {enable|disable}' instead. Change-Id: Ic4e12d5f8298ca9233639b4f6f8601ed6937fecb BUG: 1024626 Signed-off-by: Anuradha <atalur@redhat.com> Reviewed-on: http://review.gluster.org/6192 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index de980b27988..8a37d8e785f 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -38,6 +38,13 @@ str_getunamb (const char *tok, char **opwords)
return (char *)cli_getunamb (tok, (void **)opwords, id_sel);
}
+static inline gf_boolean_t
+cli_is_quota_cmd (char *key)
+{
+ return ((strcmp (key, "quota") == 0) ||
+ (strcmp (key, "features.quota") == 0));
+}
+
int32_t
cli_cmd_bricks_parse (const char **words, int wordcount, int brick_index,
char **bricks, int *brick_count)
@@ -858,6 +865,11 @@ cli_cmd_volume_set_parse (const char **words, int wordcount, dict_t **options,
char *value = NULL;
int i = 0;
char str[50] = {0,};
+ char *true_keys[] = {"on", "enable", "yes",
+ "true", "1", NULL};
+ char *false_keys[] = {"off", "disable", "no",
+ "false", "0", NULL};
+ char *w1 = NULL, *w2 = NULL;
GF_ASSERT (words);
GF_ASSERT (options);
@@ -910,6 +922,25 @@ cli_cmd_volume_set_parse (const char **words, int wordcount, dict_t **options,
if (ret == 0)
*options = dict;
goto out;
+ } else if (wordcount == 5 && cli_is_quota_cmd ((char *)words[3])) {
+ value = (char *)words[4];
+ w1 = str_getunamb (value, true_keys);
+ w2 = str_getunamb (value, false_keys);
+ if (w1 != NULL) {
+ gf_asprintf (op_errstr,"'gluster volume set <VOLNAME> "
+ "%s %s' is deprecated. Use 'gluster "
+ "volume quota <VOLNAME> enable' instead.",
+ (char *)words[3], w1);
+ ret = -1;
+ goto out;
+ } else if (w2 != NULL) {
+ gf_asprintf (op_errstr,"'gluster volume set <VOLNAME> "
+ "%s %s' is deprecated. Use 'gluster "
+ "volume quota <VOLNAME> disable' instead.",
+ (char *)words[3], w2);
+ ret = -1;
+ goto out;
+ }
}
for (i = 3; i < wordcount; i+=2) {