diff options
author | Amar Tumballi <amar@gluster.com> | 2010-07-20 02:40:58 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-07-20 20:44:18 -0700 |
commit | 3e34ad9388e3cf2493f3d75a760e6943f59dc55c (patch) | |
tree | 327f91f93799c6eba2f89abd20dfcbb57e5277f7 /cli/src/cli3_1-cops.c | |
parent | 9e3b58a2abdee5c1cf748eb463042ca9ef6aac66 (diff) |
add port as an optional argument to 'probe' command
* there will be just 'one' glusterd per machine, but in case if its
run on different port, then this option is useful to probe.
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1074 (port related issues in 'gluster probe' command)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1074
Diffstat (limited to 'cli/src/cli3_1-cops.c')
-rw-r--r-- | cli/src/cli3_1-cops.c | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c index f0d20ec6b..1f9feeac0 100644 --- a/cli/src/cli3_1-cops.c +++ b/cli/src/cli3_1-cops.c @@ -106,6 +106,7 @@ gf_cli3_1_list_friends_cbk (struct rpc_req *req, struct iovec *iov, int32_t i = 1; char key[256] = {0,}; int32_t state = 0; + int32_t port = 0; if (-1 == req->rpc_status) { goto out; @@ -167,13 +168,18 @@ gf_cli3_1_list_friends_cbk (struct rpc_req *req, struct iovec *iov, if (ret) goto out; + snprintf (key, 256, "friend%d.port", i); + ret = dict_get_int32 (dict, key, &port); + if (ret) + goto out; + snprintf (key, 256, "friend%d.state", i); ret = dict_get_int32 (dict, key, &state); if (ret) goto out; - cli_out ("hostname:%s, uuid:%s, state:%d\n", - hostname_buf, uuid_buf, state); + cli_out ("hostname:%s, port:%d, uuid:%s, state:%d\n", + hostname_buf, port, uuid_buf, state); i++; } } else { @@ -586,18 +592,28 @@ int32_t gf_cli3_1_probe (call_frame_t *frame, xlator_t *this, void *data) { - gf1_cli_probe_req req = {0,}; - int ret = 0; - char *hostname = NULL; + gf1_cli_probe_req req = {0,}; + int ret = 0; + dict_t *dict = NULL; + char *hostname = NULL; + int port = 0; if (!frame || !this || !data) { ret = -1; goto out; } - hostname = data; + dict = data; + ret = dict_get_str (dict, "hostname", &hostname); + if (ret) + goto out; + + ret = dict_get_int32 (dict, "port", &port); + if (ret) + port = CLI_GLUSTERD_PORT; req.hostname = hostname; + req.port = port; ret = cli_submit_request (&req, frame, cli_rpc_prog, GD_MGMT_CLI_PROBE, NULL, gf_xdr_from_cli_probe_req, @@ -615,18 +631,28 @@ int32_t gf_cli3_1_deprobe (call_frame_t *frame, xlator_t *this, void *data) { - gf1_cli_deprobe_req req = {0,}; - int ret = 0; - char *hostname = NULL; + gf1_cli_deprobe_req req = {0,}; + int ret = 0; + dict_t *dict = NULL; + char *hostname = NULL; + int port = 0; if (!frame || !this || !data) { ret = -1; goto out; } - hostname = data; + dict = data; + ret = dict_get_str (dict, "hostname", &hostname); + if (ret) + goto out; + + ret = dict_get_int32 (dict, "port", &port); + if (ret) + port = CLI_GLUSTERD_PORT; req.hostname = hostname; + req.port = port; ret = cli_submit_request (&req, frame, cli_rpc_prog, GD_MGMT_CLI_DEPROBE, NULL, |