From 393bc549d92f79f3cff161846bcb22b03b2f6f98 Mon Sep 17 00:00:00 2001 From: Dan Lambright Date: Thu, 7 May 2015 14:28:37 -0400 Subject: glusterd/tiering: disable tiering if cluster runs older gluster versions This is a backport of fix 10531 to Gluster 3.7. Do not allow attach or detach tier to work if any of the nodes is running gluster code < 3.7. > http://review.gluster.org/#/c/10531/ > Change-Id: Id9af8f4057f6fad9cb703ec7645bc01eccb11fc1 > BUG: 1218287 > Signed-off-by: Dan Lambright > Reviewed-on: http://review.gluster.org/10531 > Tested-by: Gluster Build System > Reviewed-by: Atin Mukherjee > Signed-off-by: Dan Lambright Change-Id: Id9af8f4057f6fad9cb703ec7645bc01eccb11fc1 BUG: 1219600 Signed-off-by: Dan Lambright Reviewed-on: http://review.gluster.org/10651 Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 44 +++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 3699518207b..c2f06ef1cbe 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, -- cgit