summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2013-09-16 17:02:29 +0530
committerKrutika Dhananjay <kdhananj@redhat.com>2013-09-16 17:16:48 +0530
commitc107ab3ef74a521bb467bf2be13f5fefcac56b6f (patch)
treee6971692e0bcd697da4d26eff4da7b58b3e13249
parent872788c8a4d86db26d9097d21dc9384472fcfc3a (diff)
Revert "glusterd: Relax op-version check in quota command"
This reverts commit 34ffc3b71ad96b9be6fa34cad44f92eceb56f5e7. Reverting this patch because quota command in glusterd only reads (but NOT modify) the op-version and therefore can never bump up the op-version of the cluster. As of today, that kind of intelligence rests only with 'volume set' operation. Hence 'volume set' interface is going to be used in the post upgrade script to explicitly trigger an increment in the cluster's op-version. Change-Id: Id38bbc044429ebb1349772f37b637925032618bc Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quota.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
index aeaa51d9..c2d37b03 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
@@ -102,6 +102,16 @@ __glusterd_handle_quota (rpcsvc_request_t *req)
goto out;
}
+ if ((conf->op_version == GD_OP_VERSION_MIN) &&
+ (type > GF_QUOTA_OPTION_TYPE_VERSION)) {
+ snprintf (msg, sizeof (msg), "Cannot execute command. The "
+ "cluster is operating at version %d. Quota command %s "
+ "is unavailable in this version", conf->op_version,
+ gd_quota_op_list[type]);
+ ret = -1;
+ goto out;
+ }
+
ret = glusterd_op_begin_synctask (req, GD_OP_QUOTA, dict);
out:
@@ -1096,6 +1106,17 @@ glusterd_op_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = dict_get_int32 (dict, "type", &type);
+ if ((priv->op_version == GD_OP_VERSION_MIN) &&
+ (type > GF_QUOTA_OPTION_TYPE_VERSION)) {
+ gf_asprintf (op_errstr, "Volume quota failed. The cluster is "
+ "operating at version %d. Quota command"
+ " %s is unavailable in this version.",
+ priv->op_version,
+ gd_quota_op_list[type]);
+ ret = -1;
+ goto out;
+ }
+
switch (type) {
case GF_QUOTA_OPTION_TYPE_ENABLE:
ret = glusterd_quota_enable (volinfo, op_errstr,
@@ -1352,7 +1373,7 @@ glusterd_op_stage_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
goto out;
}
- if (glusterd_is_volume_started (volinfo) == 0) {
+ if (!glusterd_is_volume_started (volinfo)) {
*op_errstr = gf_strdup ("Volume is stopped, start volume "
"before executing quota command.");
ret = -1;
@@ -1366,10 +1387,22 @@ glusterd_op_stage_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
goto out;
}
- ret = glusterd_check_if_quota_trans_enabled (volinfo);
- if ((ret == -1) && (type != GF_QUOTA_OPTION_TYPE_ENABLE)) {
+ if ((!glusterd_is_volume_quota_enabled (volinfo)) &&
+ (type != GF_QUOTA_OPTION_TYPE_ENABLE)) {
*op_errstr = gf_strdup ("Quota is disabled, please enable "
"quota");
+ ret = -1;
+ goto out;
+ }
+
+ if ((priv->op_version == GD_OP_VERSION_MIN) &&
+ (type > GF_QUOTA_OPTION_TYPE_VERSION)) {
+ gf_asprintf (op_errstr, "Volume quota failed. The cluster is "
+ "operating at version %d. Quota command"
+ " %s is unavailable in this version.",
+ priv->op_version,
+ gd_quota_op_list[type]);
+ ret = -1;
goto out;
}