summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2013-07-19 14:23:32 +0000
committerAnand Avati <avati@redhat.com>2013-08-21 10:45:59 -0700
commit51c6fa7a354826744de98a1c5c747955ae65850c (patch)
tree3232be0125e46d19eaf1ed78c0f7a3715900895c /xlators/mgmt
parentcc8b149f34b3dc76a4ec094b822816852f6cfd5f (diff)
glusterd: add check in remove-brick start variant
The 'start' variant of the remove-brick command only applies at the dht level wherein we can remove all the bricks of a sub-volume (and remove multiple such sub-volumes) but not select bricks of it. This patch disallows removing individual replica bricks of multiple sub-volumes (i.e. reducing the replcia count of the volume) using remove-brick 'start'. The preferred method for such an operation is to use commit force. This patch also reverts the check to prevent removal of bricks from a replicate volume (commit 0d415f7) BUG: 961669 Change-Id: I447ad27f73a0963b5e09fb317bf7267a7a5a6147 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/5566 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index efb0941ec..7c8e55bef 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -744,17 +744,6 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
goto out;
}
- /*Do not allow remove-brick if the volume is a replicate volume*/
- if ((volinfo->type == GF_CLUSTER_TYPE_REPLICATE) &&
- (volinfo->brick_count == volinfo->replica_count)) {
- snprintf (err_str, sizeof(err_str),
- "Removing brick from a replicate volume "
- "is not allowed");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
- ret = -1;
- goto out;
- }
-
if (!replica_count &&
(volinfo->type == GF_CLUSTER_TYPE_STRIPE_REPLICATE) &&
(volinfo->brick_count == volinfo->dist_leaf_count)) {
@@ -1371,6 +1360,7 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
glusterd_volinfo_t *volinfo = NULL;
char *errstr = NULL;
int32_t brick_count = 0;
+ int32_t replica_cnt = 0;
char msg[2048] = {0,};
int32_t flag = 0;
gf1_op_commands cmd = GF_OP_CMD_NONE;
@@ -1426,6 +1416,16 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
case GF_OP_CMD_START:
{
+ if ((volinfo->type == GF_CLUSTER_TYPE_REPLICATE) &&
+ !dict_get_int32 (dict, "replica-count", &replica_cnt)) {
+ snprintf (msg, sizeof(msg), "Rebalancing not needed "
+ "when reducing replica count. Try without "
+ "the 'start' option");
+ errstr = gf_strdup (msg);
+ gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ goto out;
+ }
+
if (GLUSTERD_STATUS_STARTED != volinfo->status) {
snprintf (msg, sizeof (msg), "Volume %s needs to be "
"started before remove-brick (you can use "