summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2017-05-03 16:42:22 +0530
committerJeff Darcy <jeff@pl.atyp.us>2017-05-04 20:49:39 +0000
commit8375b3d70d5c6268c6770b42a18b2e1bc09e411e (patch)
treeaf018b31f14cfb0453651dced2f636ae12f7af3a /xlators
parentb3229ed1071b8e45b0717abef0adf1c17c9df81c (diff)
glusterd: disallow rebalance & remove-brick on a sharded volume
Change-Id: Idfbdbc61ca18054fdbf7556f74e195a63cd8a554 BUG: 1447630 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: https://review.gluster.org/17160 Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: N Balachandran <nbalacha@redhat.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c10
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c9
2 files changed, 19 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index edbbdecf0a8..0a7e7581cd5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -2176,6 +2176,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 60d39cbd774..22c18b96033 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -695,6 +695,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)) {