diff options
author | Avra Sengupta <asengupt@redhat.com> | 2015-05-05 18:08:25 +0530 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2015-06-09 07:18:38 -0700 |
commit | 952ea9ae43d7668cf9661eb694757e17a2a6ae9e (patch) | |
tree | fdf91e44d69642e1c374b0ef374ed3f978544e5d /xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c | |
parent | 4b32816d226b04066b36f569ea34bebfff25d16e (diff) |
glusterd/snapshot: Return correct errno in events of failure - PATCH 2
Backport of http://review.gluster.org/#/c/10588/
ENUM RETCODE ERROR
-------------------------------------------------------------
EG_INTRNL 30800 Internal Error
EG_OPNOTSUP 30801 Gluster Op Not Supported
EG_ANOTRANS 30802 Another Transaction in Progress
EG_BRCKDWN 30803 One or more brick is down
EG_NODEDWN 30804 One or more node is down
EG_HRDLMT 30805 Hard Limit is reached
EG_NOVOL 30806 Volume does not exist
EG_NOSNAP 30807 Snap does not exist
EG_RBALRUN 30808 Rebalance is running
EG_VOLRUN 30809 Volume is running
EG_VOLSTP 30810 Volume is not running
EG_VOLEXST 30811 Volume exists
EG_SNAPEXST 30812 Snapshot exists
EG_ISSNAP 30813 Volume is a snap volume
EG_GEOREPRUN 30814 Geo-Replication is running
EG_NOTTHINP 30815 Bricks are not thinly provisioned
Change-Id: I49a170cdfd77df11fe677e09f4e063d99b159275
BUG: 1226117
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
(cherry picked from commit 2df57ab7dc7b9d7deb0eebad96036149760d607b)
Reviewed-on: http://review.gluster.org/11042
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c index 9ebaf00d32f..5b7f0fa3c25 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c @@ -232,8 +232,9 @@ out: static int glusterd_mgmt_v3_pre_validate_send_resp (rpcsvc_request_t *req, - int32_t op, int32_t status, - char *op_errstr, dict_t *rsp_dict) + int32_t op, int32_t status, + char *op_errstr, dict_t *rsp_dict, + uint32_t op_errno) { gd1_mgmt_v3_pre_val_rsp rsp = {{0},}; int ret = -1; @@ -246,6 +247,7 @@ glusterd_mgmt_v3_pre_validate_send_resp (rpcsvc_request_t *req, rsp.op_ret = status; glusterd_get_uuid (&rsp.uuid); rsp.op = op; + rsp.op_errno = op_errno; if (op_errstr) rsp.op_errstr = op_errstr; else @@ -274,11 +276,12 @@ static int glusterd_handle_pre_validate_fn (rpcsvc_request_t *req) { int32_t ret = -1; - gd1_mgmt_v3_pre_val_req op_req = {{0},}; + gd1_mgmt_v3_pre_val_req op_req = {{0},}; xlator_t *this = NULL; char *op_errstr = NULL; dict_t *dict = NULL; dict_t *rsp_dict = NULL; + uint32_t op_errno = 0; this = THIS; GF_ASSERT (this); @@ -326,8 +329,7 @@ glusterd_handle_pre_validate_fn (rpcsvc_request_t *req) } ret = gd_mgmt_v3_pre_validate_fn (op_req.op, dict, &op_errstr, - rsp_dict); - + rsp_dict, &op_errno); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_PRE_VALIDATION_FAIL, @@ -336,8 +338,8 @@ glusterd_handle_pre_validate_fn (rpcsvc_request_t *req) } ret = glusterd_mgmt_v3_pre_validate_send_resp (req, op_req.op, - ret, op_errstr, - rsp_dict); + ret, op_errstr, + rsp_dict, op_errno); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_MGMTV3_OP_RESP_FAIL, @@ -497,8 +499,9 @@ out: static int glusterd_mgmt_v3_commit_send_resp (rpcsvc_request_t *req, - int32_t op, int32_t status, - char *op_errstr, dict_t *rsp_dict) + int32_t op, int32_t status, + char *op_errstr, uint32_t op_errno, + dict_t *rsp_dict) { gd1_mgmt_v3_commit_rsp rsp = {{0},}; int ret = -1; @@ -511,6 +514,7 @@ glusterd_mgmt_v3_commit_send_resp (rpcsvc_request_t *req, rsp.op_ret = status; glusterd_get_uuid (&rsp.uuid); rsp.op = op; + rsp.op_errno = op_errno; if (op_errstr) rsp.op_errstr = op_errstr; else @@ -543,6 +547,7 @@ glusterd_handle_commit_fn (rpcsvc_request_t *req) char *op_errstr = NULL; dict_t *dict = NULL; dict_t *rsp_dict = NULL; + uint32_t op_errno = 0; this = THIS; GF_ASSERT (this); @@ -589,7 +594,7 @@ glusterd_handle_commit_fn (rpcsvc_request_t *req) } ret = gd_mgmt_v3_commit_fn (op_req.op, dict, &op_errstr, - rsp_dict); + &op_errno, rsp_dict); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, @@ -599,8 +604,8 @@ glusterd_handle_commit_fn (rpcsvc_request_t *req) } ret = glusterd_mgmt_v3_commit_send_resp (req, op_req.op, - ret, op_errstr, - rsp_dict); + ret, op_errstr, + op_errno, rsp_dict); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_MGMTV3_OP_RESP_FAIL, |