summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2010-09-08 08:53:21 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-08 11:24:46 -0700
commit43d36d456314f6d4e67c3d8f06cceb585f467915 (patch)
tree35c7b5093dcc47eb2e6048ebf24bb05f6ebdabee /xlators/mgmt/glusterd/src/glusterd-volgen.c
parent5ed8eba1b15b538ca2c74d8130fb3f0a394921ec (diff)
allow brick to be added in a plain replicate volume if a brick is removed
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1574 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1574
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index d368e5c98..ce6547e6e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1477,16 +1477,34 @@ generate_client_volfile (glusterd_volinfo_t *volinfo, char *filename)
num_bricks++;
if (GF_CLUSTER_TYPE_REPLICATE == volinfo->type) {
- gf_log ("", GF_LOG_DEBUG,
- "Volfile is distributed-replicated");
- replicate_count = volinfo->sub_count;
- dist_count = num_bricks / replicate_count;
+ if (volinfo->brick_count <= volinfo->sub_count) {
+ gf_log ("", GF_LOG_DEBUG,
+ "Volfile is plain replicated");
+ replicate_count = volinfo->sub_count;
+ dist_count = num_bricks / replicate_count;
+ if (!dist_count) {
+ replicate_count = num_bricks;
+ dist_count = num_bricks / replicate_count;
+ }
+ } else {
+ gf_log ("", GF_LOG_DEBUG,
+ "Volfile is distributed-replicated");
+ replicate_count = volinfo->sub_count;
+ dist_count = num_bricks / replicate_count;
+ }
} else if (GF_CLUSTER_TYPE_STRIPE == volinfo->type) {
- gf_log ("", GF_LOG_DEBUG,
- "Volfile is distributed-striped");
- stripe_count = volinfo->sub_count;
- dist_count = num_bricks / stripe_count;
+ if (volinfo->brick_count == volinfo->sub_count) {
+ gf_log ("", GF_LOG_DEBUG,
+ "Volfile is plain striped");
+ stripe_count = volinfo->sub_count;
+ dist_count = num_bricks / stripe_count;
+ } else {
+ gf_log ("", GF_LOG_DEBUG,
+ "Volfile is distributed-striped");
+ stripe_count = volinfo->sub_count;
+ dist_count = num_bricks / stripe_count;
+ }
} else {
gf_log ("", GF_LOG_DEBUG,
"Volfile is plain distributed");