From 1f64e5e3dd7f871e112ad9d3e9fae3cc5e15fd88 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Wed, 21 Nov 2012 12:06:26 +0530 Subject: gsyncd / geo-rep: include hostname in status cmd Including hostname of the node where geo-rep start was initiated from. This helps any consumers of the status command to identify and possibly issue commands on those node(s). Change-Id: I005083878a3a4794da3b7f3f7d2cc9d28f004e3f BUG: 858218 Signed-off-by: Venky Shankar Reviewed-on: http://review.gluster.org/4218 Reviewed-by: Csaba Henk Tested-by: Gluster Build System --- xlators/mgmt/glusterd/src/glusterd-utils.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index fab405c7f..8dc83d5ef 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -5799,9 +5799,11 @@ glusterd_append_status_dicts (dict_t *dst, dict_t *src) char mst[PATH_MAX] = {0,}; char slv[PATH_MAX] = {0, }; char sts[PATH_MAX] = {0, }; + char nds[PATH_MAX] = {0, }; char *mst_val = NULL; char *slv_val = NULL; char *sts_val = NULL; + char *nds_val = NULL; GF_ASSERT (dst); @@ -5820,10 +5822,15 @@ glusterd_append_status_dicts (dict_t *dst, dict_t *src) } for (i = 1; i <= src_count; i++) { + snprintf (nds, sizeof(nds), "node%d", i); snprintf (mst, sizeof(mst), "master%d", i); snprintf (slv, sizeof(slv), "slave%d", i); snprintf (sts, sizeof(sts), "status%d", i); + ret = dict_get_str (src, nds, &nds_val); + if (ret) + goto out; + ret = dict_get_str (src, mst, &mst_val); if (ret) goto out; @@ -5836,10 +5843,15 @@ glusterd_append_status_dicts (dict_t *dst, dict_t *src) if (ret) goto out; + snprintf (nds, sizeof(nds), "node%d", i+dst_count); snprintf (mst, sizeof(mst), "master%d", i+dst_count); snprintf (slv, sizeof(slv), "slave%d", i+dst_count); snprintf (sts, sizeof(sts), "status%d", i+dst_count); + ret = dict_set_dynstr (dst, nds, gf_strdup (nds_val)); + if (ret) + goto out; + ret = dict_set_dynstr (dst, mst, gf_strdup (mst_val)); if (ret) goto out; -- cgit