diff options
author | shishir gowda <shishirng@gluster.com> | 2012-05-18 08:14:07 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-05-18 19:28:20 -0700 |
commit | fb5e9b848c2dd358dc23fe56e0e95d3bfd3b9f72 (patch) | |
tree | 2e97b894278a956071139db8c3511b51a3eceda1 /glusterfsd/src | |
parent | 3a4641ceb6f66d30b9f9618a613f6e01c97ca72a (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.
Change-Id: I519720dbdde4c8d46381144403751bf7ed6d3a51
BUG: 822086
Signed-off-by: shishir gowda <shishirng@gluster.com>
Reviewed-on: http://review.gluster.com/3359
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kp@gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'glusterfsd/src')
-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) |