summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c19
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.h2
3 files changed, 23 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index f178124bd..67b4ab62c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -271,7 +271,8 @@ glusterd_add_peer_detail_to_dict (glusterd_peerinfo_t *peerinfo,
goto out;
snprintf (key, 256, "friend%d.state", count);
- ret = dict_set_int32 (friends, key, (int32_t)peerinfo->state.state);
+ ret = dict_set_str (friends, key,
+ glusterd_friend_sm_state_name_get(peerinfo->state.state));
if (ret)
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index f540658c3..fbe843034 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -46,6 +46,25 @@
static struct list_head gd_friend_sm_queue;
+static char *glusterd_friend_sm_state_names[] = {
+ "Establishing Connection",
+ "Probe Sent to Peer",
+ "Probe Received from Peer",
+ "Peer in Cluster",
+ "Accepted peer request",
+ "Sent and Received peer request",
+ "Peer Rejected",
+ "Peer detach in progress",
+ "Invalid State"
+};
+
+char*
+glusterd_friend_sm_state_name_get (glusterd_friend_sm_state_t state)
+{
+ if (state < 0 || state >= GD_FRIEND_STATE_MAX)
+ return glusterd_friend_sm_state_names[GD_FRIEND_STATE_MAX];
+ return glusterd_friend_sm_state_names[state];
+}
void
glusterd_destroy_probe_ctx (glusterd_probe_ctx_t *ctx)
{
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.h b/xlators/mgmt/glusterd/src/glusterd-sm.h
index 0ad89465b..72dca811e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.h
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.h
@@ -165,4 +165,6 @@ glusterd_destroy_probe_ctx (glusterd_probe_ctx_t *ctx);
void
glusterd_destroy_friend_req_ctx (glusterd_friend_req_ctx_t *ctx);
+char*
+glusterd_friend_sm_state_name_get (glusterd_friend_sm_state_t state);
#endif