diff options
author | Venky Shankar <vshankar@redhat.com> | 2012-11-21 12:06:26 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-11-21 16:49:04 -0800 |
commit | 1f64e5e3dd7f871e112ad9d3e9fae3cc5e15fd88 (patch) | |
tree | d8e025a02706520ca8b424dc0d266d1a19413b3d /cli | |
parent | a64a0d89d5256386f6773709477aea87823e2e68 (diff) |
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 <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/4218
Reviewed-by: Csaba Henk <csaba@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 2e0c58402..19451e059 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -3209,18 +3209,20 @@ gf_cli_gsync_config_command (dict_t *dict) int gf_cli_gsync_out_status (dict_t *dict) { - int gsync_count = 0; - int i = 0; - int ret = 0; + int gsync_count = 0; + int i = 0; + int ret = 0; char mst[PATH_MAX] = {0, }; - char slv[PATH_MAX]= {0, }; + char slv[PATH_MAX] = {0, }; char sts[PATH_MAX] = {0, }; - char hyphens[81] = {0, }; - char *mst_val = NULL; - char *slv_val = NULL; - char *sts_val = NULL; + char nds[PATH_MAX] = {0, }; + char hyphens[100] = {0, }; + char *mst_val = NULL; + char *slv_val = NULL; + char *sts_val = NULL; + char *nds_val = NULL; - cli_out ("%-20s %-50s %-10s", "MASTER", "SLAVE", "STATUS"); + cli_out ("%-20s %-20s %-50s %-10s", "NODE", "MASTER", "SLAVE", "STATUS"); for (i=0; i<sizeof(hyphens)-1; i++) hyphens[i] = '-'; @@ -3237,10 +3239,15 @@ gf_cli_gsync_out_status (dict_t *dict) } for (i = 1; i <= gsync_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 (dict, nds, &nds_val); + if (ret) + goto out; + ret = dict_get_str (dict, mst, &mst_val); if (ret) goto out; @@ -3253,7 +3260,7 @@ gf_cli_gsync_out_status (dict_t *dict) if (ret) goto out; - cli_out ("%-20s %-50s %-10s", mst_val, + cli_out ("%-20s %-20s %-50s %-10s", nds_val, mst_val, slv_val, sts_val); } |