summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-09-07 20:46:20 +0530
committerAnand Avati <avati@gluster.com>2011-09-07 10:51:29 -0700
commit81530d227deb52af38c7df770aef2200b9de539f (patch)
tree6dd3b309a8acc8078db96a45377aa3b8b008f066 /xlators/mgmt/glusterd/src/glusterd-utils.c
parent34be428d5640a0ad4c47a05ee3e716189b4a54ed (diff)
glusterd: send the 'stripe-count' value to peer during handshake
without which, if a peer is added after volume of type 'stripe-replica' is created, it won't be reflected in the newly added peer. Change-Id: I77ee6aa3f33994bd4c6dbfefd853cc7e7491c1db BUG: 3523 Reviewed-on: http://review.gluster.com/369 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index eaae6b7fb1c..3aafd6e9ab7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1423,6 +1423,12 @@ glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo,
goto out;
memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "volume%d.stripe_count", count);
+ ret = dict_set_int32 (dict, key, volinfo->stripe_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "volume%d.ckusm", count);
ret = dict_set_int64 (dict, key, volinfo->cksum);
if (ret)
@@ -1894,6 +1900,17 @@ glusterd_import_volinfo (dict_t *vols, int count,
goto out;
}
+ /* not having a 'stripe_count' key is not a error
+ (as peer may be of old version) */
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "volume%d.stripe_count", count);
+ ret = dict_get_int32 (vols, key, &new_volinfo->stripe_count);
+ if (!ret) {
+ if (new_volinfo->stripe_count)
+ new_volinfo->replica_count = (new_volinfo->sub_count /
+ new_volinfo->stripe_count);
+ }
+
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "volume%d.ckusm", count);
ret = dict_get_uint32 (vols, key, &new_volinfo->cksum);