summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
diff options
context:
space:
mode:
authorDan Lambright <dlambrig@redhat.com>2015-05-04 12:38:26 -0400
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-05-05 08:37:21 -0700
commit3bbca6b368782b99b80558841894942f802a44a2 (patch)
treefdd7d833f0539c9206fa59a94725a93336a7c443 /xlators/mgmt/glusterd/src/glusterd-brick-ops.c
parent377505a101eede8943f5a345e11a6901c4f8f420 (diff)
glusterd/tiering: disable tiering if cluster runs older gluster versions
Do not allow attach or detach tier to work if any of the nodes is running gluster code < 3.7. Change-Id: Id9af8f4057f6fad9cb703ec7645bc01eccb11fc1 BUG: 1218287 Signed-off-by: Dan Lambright <dlambrig@redhat.com> Reviewed-on: http://review.gluster.org/10531 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 4a39c6462fa..5326e25a787 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -27,6 +27,34 @@
/* misc */
+gf_boolean_t
+glusterd_is_tiering_supported (char *op_errstr)
+{
+ xlator_t *this = NULL;
+ glusterd_conf_t *conf = NULL;
+ gf_boolean_t supported = _gf_false;
+
+ this = THIS;
+ GF_VALIDATE_OR_GOTO ("glusterd", this, out);
+
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO (this->name, conf, out);
+
+ if (conf->op_version < GD_OP_VERSION_3_7_0)
+ goto out;
+
+ supported = _gf_true;
+
+out:
+ if (!supported && op_errstr != NULL && conf)
+ sprintf (op_errstr, "Tier operation failed. The cluster is "
+ "operating at version %d. Tiering"
+ " is unavailable in this version.",
+ conf->op_version);
+
+ return supported;
+}
+
/* In this function, we decide, based on the 'count' of the brick,
where to add it in the current volume. 'count' tells us already
how many of the given bricks are added. other argument are self-
@@ -466,6 +494,13 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
goto out;
}
+ if (glusterd_is_tiering_supported(err_str) == _gf_false) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Tiering not supported at this version");
+ ret = -1;
+ goto out;
+ }
+
ret = dict_get_int32 (dict, "type", &type);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
@@ -732,7 +767,6 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
goto out;
}
-
gf_log (this->name, GF_LOG_INFO, "Received rem brick req");
if (cli_req.dict.dict_len) {
@@ -776,6 +810,14 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
goto out;
}
+ if ((volinfo->type == GF_CLUSTER_TYPE_TIER) &&
+ (glusterd_is_tiering_supported(err_str) == _gf_false)) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Tiering not supported at this version");
+ ret = -1;
+ goto out;
+ }
+
ret = dict_get_int32 (dict, "replica-count", &replica_count);
if (!ret) {
gf_log (this->name, GF_LOG_INFO,