From 3958136d603b1dc11986b50723ab79457da45fee Mon Sep 17 00:00:00 2001 From: Mohammed Rafi KC Date: Wed, 22 Apr 2015 11:17:08 +0530 Subject: cli/tiering: display hot tier, and cold tier separately back port of http://review.gluster.org/#/c/10328 cli commands display the brick information without a way to distinguish hot tier, and cold tier. This patch will change all the cli related output, without changing the corresponding xml output. This patch will change following things >> gluster volume info Volume Name: patchy Type: Tier Volume ID: 7745d367-811a-4fe9-a500-d04e7afa94bf Status: Created Number of Bricks: 3 x 2 = 6 Transport-type: tcp Hot Bricks: Brick1: hostname:/home/brick21 Brick2: hostname:/home/brick20 Cold Bricks: Brick3: hostname:/home/brick19 Brick4: hostname:/home/brick16 Brick5: hostname:/home/brick17 Brick6: hostname:/home/brick18 >>gluster volume status Status of volume: patchy Gluster process TCP Port RDMA Port Online Pid ------------------------------------------------------------------------------ Hot Bricks: Brick hostname:/home/brick21 49152 0 Y 4690 Brick hostname:/home/brick20 49153 0 Y 4707 Cold Bricks: Brick hostname:/home/brick19 49154 0 Y 4724 Brick hostname:/home/brick16 49155 0 Y 4741 Brick hostname:/home/brick17 49156 0 Y 4758 Brick hostname:/home/brick18 49157 0 Y 4775 NFS Server on localhost 2049 0 Y 4793 Task Status of Volume patchy ------------------------------------------------------------------------------ There are no active volume tasks >>gluster volume status pathy detail Status of volume: patchy Hot Bricks: ------------------------------------------------------------------------------ Brick : Brick hostname:/home/brick21 TCP Port : 49162 RDMA Port : 0 Online : Y Pid : 22677 File System : ext4 Device : /dev/mapper/luks-cd077c56-42ba-44b1-8195-f214b9bc990c Mount Options : rw,seclabel,relatime,data=ordered Inode Size : 256 Disk Space Free : 127.3GB Total Disk Space : 165.4GB Inode Count : 11026432 Free Inodes : 10998043 ------------------------------------------------------------------------------ Brick : Brick hostname:/home/brick20 TCP Port : 49161 RDMA Port : 0 Online : Y Pid : 22660 File System : ext4 Device : /dev/mapper/luks-cd077c56-42ba-44b1-8195-f214b9bc990c Mount Options : rw,seclabel,relatime,data=ordered Inode Size : 256 Disk Space Free : 127.3GB Total Disk Space : 165.4GB Inode Count : 11026432 Free Inodes : 10998043 Cold Bricks: ------------------------------------------------------------------------------ Brick : Brick hostname:/home/brick19 TCP Port : 49157 RDMA Port : 0 Online : Y Pid : 22501 File System : ext4 Device : /dev/mapper/luks-cd077c56-42ba-44b1-8195-f214b9bc990c Mount Options : rw,seclabel,relatime,data=ordered Inode Size : 256 Disk Space Free : 127.3GB Total Disk Space : 165.4GB Inode Count : 11026432 Free Inodes : 10998043 ------------------------------------------------------------------------------ Brick : Brick hostname:/home/brick16 TCP Port : 49158 RDMA Port : 0 Online : Y Pid : 22518 File System : ext4 Device : /dev/mapper/luks-cd077c56-42ba-44b1-8195-f214b9bc990c Mount Options : rw,seclabel,relatime,data=ordered Inode Size : 256 Disk Space Free : 127.3GB Total Disk Space : 165.4GB Inode Count : 11026432 Free Inodes : 10998043 ------------------------------------------------------------------------------ Brick : Brick hostname:/home/brick17 TCP Port : 49159 RDMA Port : 0 Online : Y Pid : 22535 File System : ext4 Device : /dev/mapper/luks-cd077c56-42ba-44b1-8195-f214b9bc990c Mount Options : rw,seclabel,relatime,data=ordered Inode Size : 256 Disk Space Free : 127.3GB Total Disk Space : 165.4GB Inode Count : 11026432 Free Inodes : 10998043 ------------------------------------------------------------------------------ Brick : Brick hostname:/home/brick18 TCP Port : 49160 RDMA Port : 0 Online : Y Pid : 22552 File System : ext4 Device : /dev/mapper/luks-cd077c56-42ba-44b1-8195-f214b9bc990c Mount Options : rw,seclabel,relatime,data=ordered Inode Size : 256 Disk Space Free : 127.3GB Total Disk Space : 165.4GB Inode Count : 11026432 Free Inodes : 10998043 Change-Id: I7d584eb8782129c12876cce2ba8ffba6c0a620bd BUG: 1219842 Signed-off-by: Mohammed Rafi KC Reviewed-on: http://review.gluster.org/10675 Reviewed-by: Dan Lambright Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- xlators/mgmt/glusterd/src/glusterd-handler.c | 5 +++++ xlators/mgmt/glusterd/src/glusterd-op-sm.c | 11 ++++++++++ xlators/mgmt/glusterd/src/glusterd-utils.c | 31 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index fcdfa608607..a6cf1319784 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -355,6 +355,11 @@ glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo, if (ret) goto out; + snprintf (key, 256, "volume%d.hot_brick_count", count); + ret = dict_set_int32 (volumes, key, volinfo->tier_info.hot_brick_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) diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index fbd74585229..858f0771ca6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -2673,6 +2673,7 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr, int node_count = 0; int brick_index = -1; int other_count = 0; + int hot_brick_count = -1; int other_index = 0; uint32_t cmd = 0; char *volname = NULL; @@ -2904,6 +2905,16 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr, } } + if (volinfo->type == GF_CLUSTER_TYPE_TIER) + hot_brick_count = volinfo->tier_info.hot_brick_count; + ret = dict_set_int32 (rsp_dict, "hot_brick_count", hot_brick_count); + if (ret) + goto out; + + ret = dict_set_int32 (rsp_dict, "type", volinfo->type); + if (ret) + goto out; + ret = dict_set_int32 (rsp_dict, "brick-index-max", brick_index); if (ret) { gf_log (this->name, GF_LOG_ERROR, diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index a22bc3ba7df..f38c16fa9a6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -7389,6 +7389,8 @@ glusterd_volume_status_copy_to_op_ctx_dict (dict_t *aggr, dict_t *rsp_dict) int32_t node_count = 0; int32_t other_count = 0; int32_t brick_index_max = -1; + int32_t hot_brick_count = -1; + int32_t type = -1; int32_t rsp_node_count = 0; int32_t rsp_other_count = 0; int vol_count = -1; @@ -7485,6 +7487,35 @@ glusterd_volume_status_copy_to_op_ctx_dict (dict_t *aggr, dict_t *rsp_dict) goto out; } + ret = dict_get_int32 (rsp_dict, "hot_brick_count", &hot_brick_count); + if (ret) { + gf_log (THIS->name, GF_LOG_ERROR, + "Failed to get hot brick count from rsp_dict"); + goto out; + } + + ret = dict_set_int32 (ctx_dict, "hot_brick_count", + node_count + rsp_node_count); + if (ret) { + gf_log (THIS->name, GF_LOG_ERROR, + "Failed to update hot_brick_count"); + goto out; + } + + ret = dict_get_int32 (rsp_dict, "type", &type); + if (ret) { + gf_log (THIS->name, GF_LOG_ERROR, + "Failed to get type from rsp_dict"); + goto out; + } + + ret = dict_set_int32 (ctx_dict, "type", type); + if (ret) { + gf_log (THIS->name, GF_LOG_ERROR, + "Failed to update type"); + goto out; + } + aggregate_tasks: /* Tasks are only present for a normal status command for a volume or * for an explicit tasks status command for a volume -- cgit