From c5ca4e8981bcf6a854eb3f708aa96fe6ff1f8e05 Mon Sep 17 00:00:00 2001 From: Shyamsundar Ranganathan Date: Mon, 26 Jun 2017 16:23:45 +0000 Subject: Revert "Revert "glusterd: disallow rebalance & remove-brick on a sharded volume"" This is being reverted as a new bug around rebalance has been uncovered. As a result we would like to retain the warning in the code and in the release-notes. The new bug being, https://bugzilla.redhat.com/show_bug.cgi?id=1465075 This reverts commit 9c5403587517b5922cb87bff75033839e96d56ab. Change-Id: Ifd38ae0a41539aeb67723eb3ee704c18c50571b0 BUG: 1465123 Signed-off-by: Shyam Reviewed-on: https://review.gluster.org/17631 Smoke: Gluster Build System CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee --- xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 10 ++++++++++ xlators/mgmt/glusterd/src/glusterd-rebalance.c | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 8d4ea13af95..21e3377b631 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -2180,6 +2180,16 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) case GF_OP_CMD_START: { + if (dict_get_str_boolean (volinfo->dict, "features.shard", + _gf_false)) { + ret = -1; + snprintf (msg, sizeof (msg), "remove-brick operation is" + " not allowed on a sharded volume as it may" + " lead to a data loss situation."); + errstr = gf_strdup (msg); + goto out; + } + if ((volinfo->type == GF_CLUSTER_TYPE_REPLICATE) && dict_get (dict, "replica-count")) { snprintf (msg, sizeof(msg), "Migration of data is not " diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 4c24b99d0b8..fbef1df7eaa 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -696,6 +696,15 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr) volname); goto out; } + if (dict_get_str_boolean (volinfo->dict, "features.shard", + _gf_false)) { + ret = -1; + snprintf (msg, sizeof (msg), "rebalance operation is not" + " allowed on a sharded volume as it may lead" + " to a data loss situation. Use start force " + " option to bypass this validation"); + goto out; + } case GF_DEFRAG_CMD_START_FORCE: if (is_origin_glusterd (dict)) { -- cgit