summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-handler.c
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-04-22 20:07:11 +0530
committerVijay Bellur <vbellur@redhat.com>2015-05-09 21:50:45 -0700
commitf19c019cef4abfdb065d72c088fabf7d3d7805ff (patch)
treeb395553db6efa6e57c5d311433a459a12e0c4353 /xlators/mgmt/glusterd/src/glusterd-handler.c
parent3958136d603b1dc11986b50723ab79457da45fee (diff)
cli/tiering: volume info should display details about tier
Back port of http://review.gluster.org/#/c/10339/ >> gluster volume info patchy Volume Name: patchy Type: Tier Volume ID: 8bf1a1ca-6417-484f-821f-18973a7502a8 Status: Created Number of Bricks: 8 Transport-type: tcp Hot Tier : Hot Tier Type : Replicate Number of Bricks: 1 x 2 = 2 Brick1: hostname:/home/brick30 Brick2: hostname:/home/brick31 Cold Bricks: Cold Tier Type : Disperse Number of Bricks: 1 x (4 + 2) = 6 Brick3: hostname:/home/brick20 Brick4: hostname:/home/brick21 Brick5: hostname:/home/brick23 Brick6: hostname:/home/brick24 Brick7: hostname:/home/brick25 Brick8: hostname:/home/brick26 Change-Id: I7b9025af81263ebecd641b4b6897b20db8b67195 BUG: 1219842 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/10676 Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index a6cf1319784..83fa799c2a5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -311,6 +311,79 @@ _build_option_key (dict_t *d, char *k, data_t *v, void *tmp)
}
int
+glusterd_add_tier_volume_detail_to_dict (glusterd_volinfo_t *volinfo,
+ dict_t *dict, int count)
+{
+ int ret = -1;
+ char key[256] = {0,};
+
+ GF_ASSERT (volinfo);
+ GF_ASSERT (dict);
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, 256, "volume%d.cold_type", count);
+ ret = dict_set_int32 (dict, key, volinfo->tier_info.cold_type);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, 256, "volume%d.cold_brick_count", count);
+ ret = dict_set_int32 (dict, key, volinfo->tier_info.cold_brick_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, 256, "volume%d.cold_dist_count", count);
+ ret = dict_set_int32 (dict, key,
+ volinfo->tier_info.cold_dist_leaf_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, 256, "volume%d.cold_replica_count", count);
+ ret = dict_set_int32 (dict, key,
+ volinfo->tier_info.cold_replica_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, 256, "volume%d.cold_disperse_count", count);
+ ret = dict_set_int32 (dict, key,
+ volinfo->tier_info.cold_disperse_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, 256, "volume%d.cold_redundancy_count", count);
+ ret = dict_set_int32 (dict, key,
+ volinfo->tier_info.cold_redundancy_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, 256, "volume%d.hot_type", count);
+ ret = dict_set_int32 (dict, key, volinfo->tier_info.hot_type);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, 256, "volume%d.hot_brick_count", count);
+ ret = dict_set_int32 (dict, key, volinfo->tier_info.hot_brick_count);
+ if (ret)
+ goto out;
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, 256, "volume%d.hot_replica_count", count);
+ ret = dict_set_int32 (dict, key, volinfo->tier_info.hot_replica_count);
+ if (ret)
+ goto out;
+
+out:
+ return ret;
+
+}
+
+int
glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo,
dict_t *volumes, int count)
{
@@ -360,6 +433,13 @@ glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo,
if (ret)
goto out;
+ if (volinfo->type == GF_CLUSTER_TYPE_TIER) {
+ ret = glusterd_add_tier_volume_detail_to_dict (volinfo,
+ volumes, count);
+ if (ret)
+ goto out;
+ }
+
snprintf (key, 256, "volume%d.dist_count", count);
ret = dict_set_int32 (volumes, key, volinfo->dist_leaf_count);
if (ret)