diff options
-rw-r--r-- | cli/src/cli-rpc-ops.c | 64 | ||||
-rw-r--r-- | rpc/xdr/src/cli1-xdr.c | 2 | ||||
-rw-r--r-- | rpc/xdr/src/cli1-xdr.h | 1 | ||||
-rw-r--r-- | rpc/xdr/src/cli1-xdr.x | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 6 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-sm.c | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.h | 3 |
8 files changed, 48 insertions, 32 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 48c1b9718..e54d4d219 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -224,35 +224,43 @@ gf_cli3_1_deprobe_cbk (struct rpc_req *req, struct iovec *iov, gf_log ("cli", GF_LOG_INFO, "Received resp to deprobe"); if (rsp.op_ret) { - switch (rsp.op_errno) { - case GF_DEPROBE_LOCALHOST: - snprintf (msg, sizeof (msg), - "%s is localhost", rsp.hostname); - break; - case GF_DEPROBE_NOT_FRIEND: - snprintf (msg, sizeof (msg), - "%s is not part of cluster", - rsp.hostname); - break; - case GF_DEPROBE_BRICK_EXIST: - snprintf (msg, sizeof (msg), - "Brick(s) with the peer %s exist in " - "cluster", rsp.hostname); - break; - case GF_DEPROBE_FRIEND_DOWN: - snprintf (msg, sizeof (msg), - "One of the peers is probably down." - " Check with 'peer status'."); - break; - default: - snprintf (msg, sizeof (msg), - "Detach unsuccessful\nDetach returned" - " with unknown errno %d", - rsp.op_errno); - break; + if (strlen (rsp.op_errstr) > 0) { + snprintf (msg, sizeof (msg), "%s", rsp.op_errstr); + gf_log ("cli", GF_LOG_ERROR, "%s", rsp.op_errstr); + } else { + switch (rsp.op_errno) { + case GF_DEPROBE_LOCALHOST: + snprintf (msg, sizeof (msg), + "%s is localhost", + rsp.hostname); + break; + case GF_DEPROBE_NOT_FRIEND: + snprintf (msg, sizeof (msg), + "%s is not part of cluster", + rsp.hostname); + break; + case GF_DEPROBE_BRICK_EXIST: + snprintf (msg, sizeof (msg), + "Brick(s) with the peer %s " + "exist in cluster", + rsp.hostname); + break; + case GF_DEPROBE_FRIEND_DOWN: + snprintf (msg, sizeof (msg), + "One of the peers is probably" + " down. Check with 'peer " + "status'."); + break; + default: + snprintf (msg, sizeof (msg), + "Detach unsuccessful\nDetach" + " returned with unknown " + "errno %d", rsp.op_errno); + break; + } + gf_log ("cli", GF_LOG_ERROR,"Detach failed with op_ret " + "%d and op_errno %d", rsp.op_ret, rsp.op_errno); } - gf_log ("glusterd",GF_LOG_ERROR,"Detach failed with op_ret %d" - " and op_errno %d", rsp.op_ret, rsp.op_errno); } else { snprintf (msg, sizeof (msg), "Detach successful"); } diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c index 607c36b3e..53e180765 100644 --- a/rpc/xdr/src/cli1-xdr.c +++ b/rpc/xdr/src/cli1-xdr.c @@ -317,6 +317,8 @@ xdr_gf1_cli_deprobe_rsp (XDR *xdrs, gf1_cli_deprobe_rsp *objp) return FALSE; if (!xdr_string (xdrs, &objp->hostname, ~0)) return FALSE; + if (!xdr_string (xdrs, &objp->op_errstr, ~0)) + return FALSE; return TRUE; } diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h index 48aa863cb..b30fd740a 100644 --- a/rpc/xdr/src/cli1-xdr.h +++ b/rpc/xdr/src/cli1-xdr.h @@ -215,6 +215,7 @@ struct gf1_cli_deprobe_rsp { int op_ret; int op_errno; char *hostname; + char *op_errstr; }; typedef struct gf1_cli_deprobe_rsp gf1_cli_deprobe_rsp; diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x index 750b491e5..cb22080cc 100644 --- a/rpc/xdr/src/cli1-xdr.x +++ b/rpc/xdr/src/cli1-xdr.x @@ -148,6 +148,7 @@ enum gf_cli_status_type { int op_ret; int op_errno; string hostname<>; + string op_errstr<>; } ; struct gf1_cli_peer_list_req { diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 095016153..cc8e2d0ee 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -783,7 +783,7 @@ glusterd_handle_cli_deprobe (rpcsvc_request_t *req) cli_req.port, (ret) ? "FAILED" : "SUCCESS"); out: if (ret) { - ret = glusterd_xfer_cli_deprobe_resp (req, ret, op_errno, + ret = glusterd_xfer_cli_deprobe_resp (req, ret, op_errno, NULL, cli_req.hostname); } @@ -2398,7 +2398,8 @@ glusterd_xfer_cli_probe_resp (rpcsvc_request_t *req, int32_t op_ret, int glusterd_xfer_cli_deprobe_resp (rpcsvc_request_t *req, int32_t op_ret, - int32_t op_errno, char *hostname) + int32_t op_errno, char *op_errstr, + char *hostname) { gf1_cli_deprobe_rsp rsp = {0, }; int32_t ret = -1; @@ -2407,6 +2408,7 @@ glusterd_xfer_cli_deprobe_resp (rpcsvc_request_t *req, int32_t op_ret, rsp.op_ret = op_ret; rsp.op_errno = op_errno; + rsp.op_errstr = op_errstr ? op_errstr : ""; rsp.hostname = hostname; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c index 757789298..2f9b99b97 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c @@ -465,7 +465,7 @@ inject: respond: - ret = glusterd_xfer_cli_deprobe_resp (ctx->req, op_ret, op_errno, + ret = glusterd_xfer_cli_deprobe_resp (ctx->req, op_ret, op_errno, NULL, ctx->hostname); if (!ret && move_sm_now) { glusterd_friend_sm (); diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c index 72af8c05b..dec1bd2d2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-sm.c @@ -415,6 +415,7 @@ glusterd_ac_send_friend_remove_req (glusterd_friend_sm_event_t *event, if (ctx) ret = glusterd_xfer_cli_deprobe_resp (ctx->req, ret, 0, + NULL, ctx->hostname); glusterd_friend_sm (); glusterd_op_sm (); diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index ac9b5d03d..11259a498 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -532,7 +532,8 @@ glusterd_handle_fsm_log (rpcsvc_request_t *req); int glusterd_xfer_cli_deprobe_resp (rpcsvc_request_t *req, int32_t op_ret, - int32_t op_errno, char *hostname); + int32_t op_errno, char *op_errstr, + char *hostname); int glusterd_fetchspec_notify (xlator_t *this); |