summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2010-09-15 06:49:56 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-15 07:18:14 -0700
commitc109ffb893ab80dd7b9dac038f5778961859ceff (patch)
tree27bdaf888e941008abe496c4dc4721b5950d3ba4 /cli
parent89ec6582d1977c98372cb69f6471fcfde8437bb7 (diff)
cli, mgmt/glusterd: disallow probe to a cluster
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1594 (make probe oneway) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1594
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli3_1-cops.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c
index 7e0e2103177..a3c0a2518cd 100644
--- a/cli/src/cli3_1-cops.c
+++ b/cli/src/cli3_1-cops.c
@@ -90,11 +90,22 @@ gf_cli3_1_probe_cbk (struct rpc_req *req, struct iovec *iov,
break;
}
}
- if (rsp.op_ret) {
- cli_out ("Probe unsuccessfull");
- gf_log ("glusterd",GF_LOG_ERROR,"Probe failed with op_ret %d"
- " and op_errno %d", rsp.op_ret, rsp.op_errno);
- }
+
+ if (rsp.op_ret) {
+ switch (rsp.op_errno) {
+ case GF_PROBE_ANOTHER_CLUSTER:
+ cli_out ("%s is already part of "
+ "another cluster", rsp.hostname);
+ break;
+ default:
+ cli_out ("Probe returned with unknown errno %d",
+ rsp.op_errno);
+ break;
+ }
+ cli_out ("Probe unsuccessful");
+ gf_log ("glusterd",GF_LOG_ERROR,"Probe failed with op_ret %d"
+ " and op_errno %d", rsp.op_ret, rsp.op_errno);
+ }
ret = rsp.op_ret;
out:
@@ -145,6 +156,8 @@ gf_cli3_1_list_friends_cbk (struct rpc_req *req, struct iovec *iov,
char key[256] = {0,};
int32_t state = 0;
int32_t port = 0;
+ int32_t connected = 0;
+ char *connected_str = NULL;
if (-1 == req->rpc_status) {
goto out;
@@ -208,6 +221,15 @@ gf_cli3_1_list_friends_cbk (struct rpc_req *req, struct iovec *iov,
if (ret)
goto out;
+ snprintf (key, 256, "friend%d.connected", i);
+ ret = dict_get_int32 (dict, key, &connected);
+ if (ret)
+ goto out;
+ if (connected)
+ connected_str = "connected";
+ else
+ connected_str = "disconnected";
+
snprintf (key, 256, "friend%d.port", i);
ret = dict_get_int32 (dict, key, &port);
if (ret)
@@ -219,11 +241,13 @@ gf_cli3_1_list_friends_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
if (!port) {
- cli_out ("hostname:%s, uuid:%s, state:%d",
- hostname_buf, uuid_buf, state);
+ cli_out ("hostname:%s, uuid:%s, state:%d (%s)",
+ hostname_buf, uuid_buf, state,
+ connected_str);
} else {
- cli_out ("hostname:%s, port:%d, uuid:%s, state:%d",
- hostname_buf, port, uuid_buf, state);
+ cli_out ("hostname:%s, port:%d, uuid:%s, "
+ "state:%d, (%s)", hostname_buf, port,
+ uuid_buf, state, connected_str);
}
i++;
}