|
|
233933 |
From 4fc0a77db5b9760fa5c00d3803c6d11a28a00b74 Mon Sep 17 00:00:00 2001
|
|
|
233933 |
From: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
233933 |
Date: Wed, 3 Jul 2019 15:22:38 +0530
|
|
|
233933 |
Subject: [PATCH 229/255] glusterd: Show the correct brick status in get-state
|
|
|
233933 |
|
|
|
233933 |
Problem: get-state does not show correct brick status if brick
|
|
|
233933 |
status is not Started, it always shows started if any value
|
|
|
233933 |
is set brickinfo->status
|
|
|
233933 |
|
|
|
233933 |
Solution: Check the value of brickinfo->status to show correct status
|
|
|
233933 |
in get-state
|
|
|
233933 |
|
|
|
233933 |
> Change-Id: I12a79619024c2cf59f338220d144f2f034059b3b
|
|
|
233933 |
> fixes: bz#1726906
|
|
|
233933 |
> (Cherry pick from commit af989db23d1db00e087f2b9d3dfc43b13ef17153)
|
|
|
233933 |
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/22983/)
|
|
|
233933 |
|
|
|
233933 |
BUG: 1726991
|
|
|
233933 |
Change-Id: I12a79619024c2cf59f338220d144f2f034059b3b
|
|
|
233933 |
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
233933 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/175355
|
|
|
233933 |
Tested-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
233933 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
233933 |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
233933 |
---
|
|
|
233933 |
xlators/mgmt/glusterd/src/glusterd-handler.c | 7 +++++--
|
|
|
233933 |
xlators/mgmt/glusterd/src/glusterd-utils.c | 28 ++++++++++++++++++++++++++++
|
|
|
233933 |
xlators/mgmt/glusterd/src/glusterd-utils.h | 4 ++++
|
|
|
233933 |
3 files changed, 37 insertions(+), 2 deletions(-)
|
|
|
233933 |
|
|
|
233933 |
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
233933 |
index cc1f1df..94e1be5 100644
|
|
|
233933 |
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
233933 |
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
233933 |
@@ -5589,7 +5589,9 @@ glusterd_get_state(rpcsvc_request_t *req, dict_t *dict)
|
|
|
233933 |
char vol_status_str[STATUS_STRLEN] = {
|
|
|
233933 |
0,
|
|
|
233933 |
};
|
|
|
233933 |
-
|
|
|
233933 |
+ char brick_status_str[STATUS_STRLEN] = {
|
|
|
233933 |
+ 0,
|
|
|
233933 |
+ };
|
|
|
233933 |
this = THIS;
|
|
|
233933 |
GF_VALIDATE_OR_GOTO(THIS->name, this, out);
|
|
|
233933 |
|
|
|
233933 |
@@ -5852,8 +5854,9 @@ glusterd_get_state(rpcsvc_request_t *req, dict_t *dict)
|
|
|
233933 |
brickinfo->rdma_port);
|
|
|
233933 |
fprintf(fp, "Volume%d.Brick%d.port_registered: %d\n", count_bkp,
|
|
|
233933 |
count, brickinfo->port_registered);
|
|
|
233933 |
+ glusterd_brick_get_status_str(brickinfo, brick_status_str);
|
|
|
233933 |
fprintf(fp, "Volume%d.Brick%d.status: %s\n", count_bkp, count,
|
|
|
233933 |
- brickinfo->status ? "Started" : "Stopped");
|
|
|
233933 |
+ brick_status_str);
|
|
|
233933 |
|
|
|
233933 |
/*FIXME: This is a hacky way of figuring out whether a
|
|
|
233933 |
* brick belongs to the hot or cold tier */
|
|
|
233933 |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
233933 |
index 2eb5116..3bdfd49 100644
|
|
|
233933 |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
233933 |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
233933 |
@@ -13898,6 +13898,34 @@ out:
|
|
|
233933 |
return ret;
|
|
|
233933 |
}
|
|
|
233933 |
|
|
|
233933 |
+void
|
|
|
233933 |
+glusterd_brick_get_status_str(glusterd_brickinfo_t *brickinfo, char *status_str)
|
|
|
233933 |
+{
|
|
|
233933 |
+ GF_VALIDATE_OR_GOTO(THIS->name, brickinfo, out);
|
|
|
233933 |
+ GF_VALIDATE_OR_GOTO(THIS->name, status_str, out);
|
|
|
233933 |
+
|
|
|
233933 |
+ switch (brickinfo->status) {
|
|
|
233933 |
+ case GF_BRICK_STOPPED:
|
|
|
233933 |
+ sprintf(status_str, "%s", "Stopped");
|
|
|
233933 |
+ break;
|
|
|
233933 |
+ case GF_BRICK_STARTED:
|
|
|
233933 |
+ sprintf(status_str, "%s", "Started");
|
|
|
233933 |
+ break;
|
|
|
233933 |
+ case GF_BRICK_STARTING:
|
|
|
233933 |
+ sprintf(status_str, "%s", "Starting");
|
|
|
233933 |
+ break;
|
|
|
233933 |
+ case GF_BRICK_STOPPING:
|
|
|
233933 |
+ sprintf(status_str, "%s", "Stopping");
|
|
|
233933 |
+ break;
|
|
|
233933 |
+ default:
|
|
|
233933 |
+ sprintf(status_str, "%s", "None");
|
|
|
233933 |
+ break;
|
|
|
233933 |
+ }
|
|
|
233933 |
+
|
|
|
233933 |
+out:
|
|
|
233933 |
+ return;
|
|
|
233933 |
+}
|
|
|
233933 |
+
|
|
|
233933 |
int
|
|
|
233933 |
glusterd_volume_get_transport_type_str(glusterd_volinfo_t *volinfo,
|
|
|
233933 |
char *transport_type_str)
|
|
|
233933 |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
|
|
|
233933 |
index 6ad8062..5c6a453 100644
|
|
|
233933 |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
|
|
|
233933 |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
|
|
|
233933 |
@@ -781,6 +781,10 @@ glusterd_volume_get_type_str(glusterd_volinfo_t *volinfo, char **vol_type_str);
|
|
|
233933 |
int
|
|
|
233933 |
glusterd_volume_get_status_str(glusterd_volinfo_t *volinfo, char *status_str);
|
|
|
233933 |
|
|
|
233933 |
+void
|
|
|
233933 |
+glusterd_brick_get_status_str(glusterd_brickinfo_t *brickinfo,
|
|
|
233933 |
+ char *status_str);
|
|
|
233933 |
+
|
|
|
233933 |
int
|
|
|
233933 |
glusterd_volume_get_transport_type_str(glusterd_volinfo_t *volinfo,
|
|
|
233933 |
char *transport_type_str);
|
|
|
233933 |
--
|
|
|
233933 |
1.8.3.1
|
|
|
233933 |
|