diff options
author | Mohit Agrawal <moagrawal@redhat.com> | 2019-07-03 15:22:38 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2019-07-04 08:25:23 +0000 |
commit | af989db23d1db00e087f2b9d3dfc43b13ef17153 (patch) | |
tree | 52a621c083eebc4e41206ea126541db9a836eb5f /xlators/mgmt/glusterd/src/glusterd-utils.c | |
parent | 7d270d05f835d41e32572501246b50181dc9be56 (diff) |
glusterd: Show the correct brick status in get-state
Problem: get-state does not show correct brick status if brick
status is not Started, it always shows started if any value
is set brickinfo->status
Solution: Check the value of brickinfo->status to show correct status
in get-state
Change-Id: I12a79619024c2cf59f338220d144f2f034059b3b
fixes: bz#1726906
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 45cdf8ab956..a4295536bf3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -13461,6 +13461,34 @@ out: return ret; } +void +glusterd_brick_get_status_str(glusterd_brickinfo_t *brickinfo, char *status_str) +{ + GF_VALIDATE_OR_GOTO(THIS->name, brickinfo, out); + GF_VALIDATE_OR_GOTO(THIS->name, status_str, out); + + switch (brickinfo->status) { + case GF_BRICK_STOPPED: + sprintf(status_str, "%s", "Stopped"); + break; + case GF_BRICK_STARTED: + sprintf(status_str, "%s", "Started"); + break; + case GF_BRICK_STARTING: + sprintf(status_str, "%s", "Starting"); + break; + case GF_BRICK_STOPPING: + sprintf(status_str, "%s", "Stopping"); + break; + default: + sprintf(status_str, "%s", "None"); + break; + } + +out: + return; +} + int glusterd_volume_get_transport_type_str(glusterd_volinfo_t *volinfo, char *transport_type_str) |