summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorSamikshan Bairagya <samikshan@gmail.com>2017-04-10 18:46:42 +0530
committerAtin Mukherjee <amukherj@redhat.com>2017-04-14 21:40:48 -0400
commitc09f5a28bfd14066f9b8cfca53c7a9d999f1613e (patch)
tree1c469011acb77bb766524c8d16a718194bd6693a /xlators/mgmt
parentd7f0ead43969e755d07ae92c669d63527a58c572 (diff)
glusterd: Add brick capacity details to get-state CLI output
Change-Id: I53fe180e71d41d56b129254b93bb74014a2cdb43 BUG: 1431192 Signed-off-by: Samikshan Bairagya <samikshan@gmail.com> Reviewed-on: https://review.gluster.org/17029 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 429999ef584..2a5772b6669 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -5218,6 +5218,7 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict)
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
xlator_t *this = NULL;
+ struct statvfs brickstat = {0};
char *odir = NULL;
char *filename = NULL;
char *ofilepath = NULL;
@@ -5227,6 +5228,8 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict)
time_t now = 0;
char timestamp[16] = {0,};
uint32_t get_state_cmd = 0;
+ uint64_t memtotal = 0;
+ uint64_t memfree = 0;
char *vol_type_str = NULL;
char *hot_tier_type_str = NULL;
@@ -5446,6 +5449,22 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict)
"Hot" : "Cold");
}
+ ret = sys_statvfs (brickinfo->path, &brickstat);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_FILE_OP_FAILED,
+ "statfs error: %s ", strerror (errno));
+ goto out;
+ }
+
+ memfree = brickstat.f_bfree * brickstat.f_bsize;
+ memtotal = brickstat.f_blocks * brickstat.f_bsize;
+
+ fprintf (fp, "Volume%d.Brick%d.spacefree: %"PRIu64"Bytes\n",
+ count_bkp, count, memfree);
+ fprintf (fp, "Volume%d.Brick%d.spacetotal: %"PRIu64"Bytes\n",
+ count_bkp, count, memtotal);
+
if (get_state_cmd != GF_CLI_GET_STATE_DETAIL)
continue;