summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2011-03-18 01:37:27 +0000
committerAnand Avati <avati@gluster.com>2011-04-11 01:37:52 -0700
commit4a55375f93ef5b14b6004da49b7be343a9090692 (patch)
tree3d80674d42ab3cf9072023de9fe102359d85beaa /xlators/mgmt
parent193424e0aba3f1ddbf875aac6dc47cf029d61f05 (diff)
allow add brick to happen in a replicate setup
Currently in in pure replicate if the replica count is 4 and there are 4 bricks, then suppose 3 bricks are removed then add brick works only if 3 bricks are provided. Providing lesser bricks fails. Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 1574 ([glusterfs-3.1.0qa18]: add-brick to a replicate volume fails if a brick is removed) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1574
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index b3e929654..defa6aa1f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -1282,6 +1282,7 @@ glusterd_handle_add_brick (rpcsvc_request_t *req)
glusterd_volinfo_t tmpvolinfo = {{0},};
int lock_fail = 0;
glusterd_op_t cli_op = GD_OP_ADD_BRICK;
+ int total_bricks = 0;
this = THIS;
GF_ASSERT(this);
@@ -1363,11 +1364,13 @@ glusterd_handle_add_brick (rpcsvc_request_t *req)
if (!brick_count || !volinfo->sub_count)
goto brick_val;
+ total_bricks = volinfo->brick_count + brick_count;
/* If the brick count is less than sub_count then, allow add-brick only for
plain replicate volume since in plain stripe brick_count becoming less than
the sub_count is not allowed */
- if (volinfo->brick_count < volinfo->sub_count && (volinfo->type == GF_CLUSTER_TYPE_REPLICATE) ) {
- if ((volinfo->sub_count - volinfo->brick_count) == brick_count)
+ if (volinfo->brick_count < volinfo->sub_count &&
+ (volinfo->type == GF_CLUSTER_TYPE_REPLICATE)) {
+ if (total_bricks <= volinfo->sub_count)
goto brick_val;
}