summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-04-29 12:00:40 +0530
committerKaushal M <kaushal@redhat.com>2015-05-28 06:55:57 -0700
commitd133071e7ced1794e09ffe4ef8cb14cf5b9f7e75 (patch)
treee01063e97bba733b3a74f1e540e3fc4014903b51
parent19d7b6097393e4bf20f77e96cc4b3dd8f2561513 (diff)
glusterd/tiering: Exchange tier info during glusted handshake
Change-Id: Ibc2f8eeb32d3e5dfd6945ca8a6d5f0f80a78ebac BUG: 1211264 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/10449 Reviewed-by: Kaushal M <kaushal@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c154
1 files changed, 154 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index b19813cbefb..1c2299db016 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -2171,6 +2171,68 @@ glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo,
if (ret)
goto out;
+ /* tiering related variables */
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.cold_brick_count", prefix, count);
+ ret = dict_set_uint32 (dict, key, volinfo->tier_info.cold_brick_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.cold_type", prefix, count);
+ ret = dict_set_uint32 (dict, key, volinfo->tier_info.cold_type);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.cold_replica_count", prefix, count);
+ ret = dict_set_uint32 (dict, key,
+ volinfo->tier_info.cold_replica_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.cold_disperse_count", prefix, count);
+ ret = dict_set_uint32 (dict, key,
+ volinfo->tier_info.cold_disperse_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.cold_redundancy_count",
+ prefix, count);
+ ret = dict_set_uint32 (dict, key,
+ volinfo->tier_info.cold_redundancy_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.cold_dist_count", prefix, count);
+ ret = dict_set_uint32 (dict, key,
+ volinfo->tier_info.cold_dist_leaf_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.hot_brick_count", prefix, count);
+ ret = dict_set_uint32 (dict, key, volinfo->tier_info.hot_brick_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.hot_type", prefix, count);
+ ret = dict_set_uint32 (dict, key, volinfo->tier_info.hot_type);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.hot_replica_count", prefix, count);
+ ret = dict_set_uint32 (dict, key,
+ volinfo->tier_info.hot_replica_count);
+ if (ret)
+ goto out;
+
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s%d", prefix, count);
ret = gd_add_vol_snap_details_to_dict (dict, key, volinfo);
@@ -3169,6 +3231,98 @@ glusterd_import_volinfo (dict_t *peer_data, int count,
if (ret)
gf_log (THIS->name, GF_LOG_INFO,
"peer is possibly old version");
+
+ /* not having a 'hot_brick_count' key is not a error
+ (as peer may be of old version) */
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.hot_brick_count", prefix, count);
+ ret = dict_get_int32 (peer_data, key,
+ &new_volinfo->tier_info.hot_brick_count);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_DEBUG,
+ "peer is possibly old version");
+
+ /* not having a 'hot_type' key is not a error
+ (as peer may be of old version) */
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.hot_type", prefix, count);
+ ret = dict_get_int32 (peer_data, key,
+ &new_volinfo->tier_info.hot_type);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_DEBUG,
+ "peer is possibly old version");
+
+ /* not having a 'hot_replica_count' key is not a error
+ (as peer may be of old version) */
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.hot_replica_count", prefix, count);
+ ret = dict_get_int32 (peer_data, key,
+ &new_volinfo->tier_info.hot_replica_count);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_DEBUG,
+ "peer is possibly old version");
+
+ /* not having a 'cold_brick_count' key is not a error
+ (as peer may be of old version) */
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.cold_brick_count", prefix, count);
+ ret = dict_get_int32 (peer_data, key,
+ &new_volinfo->tier_info.cold_brick_count);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_DEBUG,
+ "peer is possibly old version");
+
+ /* not having a 'cold_type' key is not a error
+ (as peer may be of old version) */
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.cold_type", prefix, count);
+ ret = dict_get_int32 (peer_data, key,
+ &new_volinfo->tier_info.cold_type);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_DEBUG,
+ "peer is possibly old version");
+
+ /* not having a 'cold_replica_count' key is not a error
+ (as peer may be of old version) */
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.cold_replica_count", prefix, count);
+ ret = dict_get_int32 (peer_data, key,
+ &new_volinfo->tier_info.cold_replica_count);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_DEBUG,
+ "peer is possibly old version");
+
+ /* not having a 'cold_disperse_count' key is not a error
+ (as peer may be of old version) */
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.cold_disperse_count", prefix, count);
+ ret = dict_get_int32 (peer_data, key,
+ &new_volinfo->tier_info.cold_disperse_count);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_DEBUG,
+ "peer is possibly old version");
+
+ /* not having a 'cold_redundancy_count' key is not a error
+ (as peer may be of old version) */
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.cold_redundancy_count",
+ prefix, count);
+ ret = dict_get_int32 (peer_data, key,
+ &new_volinfo->tier_info.cold_redundancy_count);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_DEBUG,
+ "peer is possibly old version");
+
+ /* not having a 'cold_dist_count' key is not a error
+ (as peer may be of old version) */
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s%d.cold_dist_count", prefix, count);
+ ret = dict_get_int32 (peer_data, key,
+ &new_volinfo->tier_info.cold_dist_leaf_count);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_DEBUG,
+ "peer is possibly old version");
+
new_volinfo->subvol_count = new_volinfo->brick_count/
glusterd_get_dist_leaf_count (new_volinfo);
memset (key, 0, sizeof (key));