summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
diff options
context:
space:
mode:
authorPranith K <pranithk@gluster.com>2011-03-23 21:44:13 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-25 09:24:11 -0700
commit2339b9e87e8e48df9b64ba016949a2f40b50324e (patch)
tree4c7c801a6b3ee42670558c5049e50dc2dc5a4423 /xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
parent1180b2136f6cf014a08f072f8ecc4aac2b69580f (diff)
mgmt/glusterd: Avoid printing no-error message to user when op fails
- Prints the peer hostname/uuid where the error happened in case the peer does not return an error string. Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2585 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2585
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rpc-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 43a0f22c7..056378749 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -895,6 +895,8 @@ glusterd3_1_stage_op_cbk (struct rpc_req *req, struct iovec *iov,
glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE;
glusterd_peerinfo_t *peerinfo = NULL;
dict_t *dict = NULL;
+ char err_str[2048] = {0};
+ char *peer_str = NULL;
GF_ASSERT (req);
@@ -948,8 +950,17 @@ glusterd3_1_stage_op_cbk (struct rpc_req *req, struct iovec *iov,
if (op_ret) {
event_type = GD_OP_EVENT_RCVD_RJT;
opinfo.op_ret = op_ret;
- if (strcmp ("", rsp.op_errstr))
- opinfo.op_errstr = gf_strdup(rsp.op_errstr);
+ if (strcmp ("", rsp.op_errstr)) {
+ opinfo.op_errstr = gf_strdup (rsp.op_errstr);
+ } else {
+ if (peerinfo)
+ peer_str = peerinfo->hostname;
+ else
+ peer_str = uuid_utoa (rsp.uuid);
+ snprintf (err_str, sizeof (err_str), "Operation failed "
+ "on %s", peer_str);
+ opinfo.op_errstr = gf_strdup (err_str);
+ }
if (!opinfo.op_errstr) {
gf_log ("", GF_LOG_ERROR, "memory allocation failed");
ret = -1;
@@ -1067,6 +1078,8 @@ glusterd3_1_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE;
glusterd_peerinfo_t *peerinfo = NULL;
dict_t *dict = NULL;
+ char err_str[2048] = {0};
+ char *peer_str = NULL;
GF_ASSERT (req);
@@ -1123,7 +1136,17 @@ glusterd3_1_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
if (op_ret) {
event_type = GD_OP_EVENT_RCVD_RJT;
opinfo.op_ret = op_ret;
- opinfo.op_errstr = gf_strdup(rsp.op_errstr);
+ if (strcmp ("", rsp.op_errstr)) {
+ opinfo.op_errstr = gf_strdup(rsp.op_errstr);
+ } else {
+ if (peerinfo)
+ peer_str = peerinfo->hostname;
+ else
+ peer_str = uuid_utoa (rsp.uuid);
+ snprintf (err_str, sizeof (err_str), "Operation failed "
+ "on %s", peer_str);
+ opinfo.op_errstr = gf_strdup (err_str);
+ }
if (!opinfo.op_errstr) {
gf_log ("", GF_LOG_ERROR, "memory allocation failed");
ret = -1;