summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2010-09-21 02:02:48 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-21 03:24:06 -0700
commit0484b5768da303998549e8153d08899e58edab68 (patch)
tree7b4e34221e9a554da5066243f4a83a7a4a811753
parentae376259304b654206c50b095dabf172fc355438 (diff)
cli, mgmt/glusterd: send errno in case of Peer reject
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1653 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1653
-rw-r--r--cli/src/cli3_1-cops.c5
-rw-r--r--rpc/rpc-lib/src/protocol-common.h3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h2
5 files changed, 14 insertions, 5 deletions
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c
index 832618c2446..53b80c55667 100644
--- a/cli/src/cli3_1-cops.c
+++ b/cli/src/cli3_1-cops.c
@@ -114,6 +114,11 @@ gf_cli3_1_probe_cbk (struct rpc_req *req, struct iovec *iov,
cli_out ("%s is already part of "
"another cluster", rsp.hostname);
break;
+ case GF_PROBE_VOLUME_CONFLICT:
+ cli_out ("Atleast one volume on %s conflicts "
+ "with existing volumes in the "
+ "cluster", rsp.hostname);
+ break;
default:
cli_out ("Probe returned with unknown errno %d",
rsp.op_errno);
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
index 632c1d42d97..b46f3b9883f 100644
--- a/rpc/rpc-lib/src/protocol-common.h
+++ b/rpc/rpc-lib/src/protocol-common.h
@@ -158,7 +158,8 @@ enum gf_probe_resp {
GF_PROBE_SUCCESS,
GF_PROBE_LOCALHOST,
GF_PROBE_FRIEND,
- GF_PROBE_ANOTHER_CLUSTER
+ GF_PROBE_ANOTHER_CLUSTER,
+ GF_PROBE_VOLUME_CONFLICT
};
enum gf_cbk_procnum {
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 112ca296bb2..bb297b0cc51 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -2869,7 +2869,7 @@ glusterd_xfer_friend_remove_resp (rpcsvc_request_t *req, char *hostname, int por
int
glusterd_xfer_friend_add_resp (rpcsvc_request_t *req, char *hostname, int port,
- int32_t op_ret)
+ int32_t op_ret, int32_t op_errno)
{
gd1_mgmt_friend_rsp rsp = {{0}, };
int32_t ret = -1;
@@ -2878,13 +2878,14 @@ glusterd_xfer_friend_add_resp (rpcsvc_request_t *req, char *hostname, int port,
GF_ASSERT (hostname);
- rsp.op_ret = op_ret;
this = THIS;
GF_ASSERT (this);
conf = this->private;
uuid_copy (rsp.uuid, conf->uuid);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = op_errno;
rsp.hostname = gf_strdup (hostname);
rsp.port = port;
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index 025fee7755a..c5e1800cd82 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -352,6 +352,7 @@ glusterd_ac_handle_friend_add_req (glusterd_friend_sm_event_t *event, void *ctx)
glusterd_friend_sm_event_type_t event_type = GD_FRIEND_EVENT_NONE;
int status = 0;
int32_t op_ret = -1;
+ int32_t op_errno = 0;
char remote_hostname[UNIX_PATH_MAX + 1] = {0,};
GF_ASSERT (ctx);
@@ -372,6 +373,7 @@ glusterd_ac_handle_friend_add_req (glusterd_friend_sm_event_t *event, void *ctx)
}
else {
event_type = GD_FRIEND_EVENT_LOCAL_RJT;
+ op_errno = GF_PROBE_VOLUME_CONFLICT;
op_ret = -1;
}
@@ -406,7 +408,7 @@ glusterd_ac_handle_friend_add_req (glusterd_friend_sm_event_t *event, void *ctx)
glusterd_friend_sm_inject_event (new_event);
ret = glusterd_xfer_friend_add_resp (ev_ctx->req, ev_ctx->hostname,
- ev_ctx->port, op_ret);
+ ev_ctx->port, op_ret, op_errno);
out:
gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 48d78bc339a..b9890760f71 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -226,7 +226,7 @@ glusterd_probe_begin (rpcsvc_request_t *req, const char *hoststr, int port);
int
glusterd_xfer_friend_add_resp (rpcsvc_request_t *req, char *hostname,
- int port, int32_t op_ret);
+ int port, int32_t op_ret, int32_t op_errno);
int
glusterd_friend_find (uuid_t uuid, char *hostname,