From 81530d227deb52af38c7df770aef2200b9de539f Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 7 Sep 2011 20:46:20 +0530 Subject: 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 Reviewed-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-utils.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index eaae6b7fb..3aafd6e9a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1422,6 +1422,12 @@ glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo, if (ret) 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); @@ -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); -- cgit