diff options
author | shishir gowda <shishirng@gluster.com> | 2012-05-22 11:39:47 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-05-23 02:02:10 -0700 |
commit | cd246b4ce4f5968f80de245adebbf634e3fdf37e (patch) | |
tree | 91b2f26289a2d6d00421c24f50516cf88c52d3e7 | |
parent | f5e63d3ebb02898212b11a9a6599f3483a76568d (diff) |
glusterfs/rebalance: Register cbk for glusterfs_rebalance_event_notify
In case of n/w failures, cbk needs to be passed to
mgmt_submit_request
BUG: 822086
Change-Id: Ie443902b94a09e11a2696b89de44a11fb477ca3e
Signed-off-by: shishir gowda <shishirng@gluster.com>
Reviewed-on: http://review.gluster.com/3403
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index 751e5495f45..d8582aa7013 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -1684,6 +1684,47 @@ out: return ret; } + +int32_t +glusterfs_rebalance_event_notify_cbk (struct rpc_req *req, struct iovec *iov, + int count, void *myframe) +{ + gf_event_notify_rsp rsp = {0,}; + call_frame_t *frame = NULL; + glusterfs_ctx_t *ctx = NULL; + int ret = 0; + + frame = myframe; + ctx = frame->this->ctx; + + if (-1 == req->rpc_status) { + gf_log (frame->this->name, GF_LOG_ERROR, + "failed to get the rsp from server"); + ret = -1; + goto out; + } + + ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_event_notify_rsp); + if (ret < 0) { + gf_log (frame->this->name, GF_LOG_ERROR, "XDR decoding error"); + ret = -1; + goto out; + } + + if (-1 == rsp.op_ret) { + gf_log (frame->this->name, GF_LOG_ERROR, + "Recieved error (%s) from server", + strerror (rsp.op_errno)); + ret = -1; + goto out; + } +out: + if (rsp.dict.dict_val) + free (rsp.dict.dict_val); //malloced by xdr + return ret; + +} + int32_t glusterfs_rebalance_event_notify (dict_t *dict) { @@ -1710,7 +1751,8 @@ glusterfs_rebalance_event_notify (dict_t *dict) } ret = mgmt_submit_request (&req, frame, ctx, &clnt_handshake_prog, - GF_HNDSK_EVENT_NOTIFY, NULL, + GF_HNDSK_EVENT_NOTIFY, + glusterfs_rebalance_event_notify_cbk, (xdrproc_t)xdr_gf_event_notify_req); if (req.dict.dict_val) |