From 9b95b1e82fa722d92ef1259495fce386833e6f15 Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Sun, 26 Feb 2017 23:00:21 +0530 Subject: glusterd: add portmap details in glusterd statedump glusterd statedump file doesn't have information on the ports and its associated brick details. This is quite problematic if any setup ends up with stale ports and the only way to find the issue out is to gdb into the process which is always not available. This patch attempts to fill in this gap. >Reviewed-on: https://review.gluster.org/16764 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: Prashanth Pai >(cherry picked from commit dbdfe6c353060b7af7b4250c8d6c30ed0c35783c) Change-Id: I26b4fe753d752366ddf865ca3eeae3b4d577d555 BUG: 1427399 Signed-off-by: Atin Mukherjee Reviewed-on: https://review.gluster.org/16779 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Prashanth Pai CentOS-regression: Gluster Build System --- xlators/mgmt/glusterd/src/glusterd-statedump.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-statedump.c b/xlators/mgmt/glusterd/src/glusterd-statedump.c index bfec854e7e7..7f806023566 100644 --- a/xlators/mgmt/glusterd/src/glusterd-statedump.c +++ b/xlators/mgmt/glusterd/src/glusterd-statedump.c @@ -187,6 +187,8 @@ glusterd_dump_priv (xlator_t *this) { glusterd_conf_t *priv = NULL; char key[GF_DUMP_MAX_BUF_LEN] = {0,}; + int port = 0; + struct pmap_registry *pmap = NULL; GF_VALIDATE_OR_GOTO ("glusterd", this, out); @@ -232,8 +234,28 @@ glusterd_dump_priv (xlator_t *this) gf_proc_dump_build_key (key, "glusterd", "scrub.online"); gf_proc_dump_write (key, "%d", priv->scrub_svc.online); + /* Dump peer details */ GLUSTERD_DUMP_PEERS (&priv->peers, uuid_list, _gf_false); + + /* Dump pmap data structure from base port to last alloc */ + pmap = priv->pmap; + for (port = pmap->base_port; port <= pmap->last_alloc; + port++) { + gf_proc_dump_build_key (key, "glusterd", "pmap_port"); + gf_proc_dump_write (key, "%d", port); + gf_proc_dump_build_key (key, "glusterd", + "pmap[%d].type", port); + gf_proc_dump_write (key, "%d", pmap->ports[port].type); + gf_proc_dump_build_key (key, "glusterd", + "pmap[%d].brickname", port); + gf_proc_dump_write (key, "%s", + pmap->ports[port].brickname); + + } + /* Dump client details */ glusterd_dump_client_details (priv); + + /* Dump mgmt_v3_lock from the dictionary if any */ glusterd_dict_mgmt_v3_lock_statedump(priv->mgmt_v3_lock); dict_dump_to_statedump (priv->opts, "options", "glusterd"); } -- cgit