summaryrefslogtreecommitdiffstats
path: root/rpc/block_svc_routines.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2017-06-24 11:55:56 +0530
committerPrasanna Kumar Kalever <pkalever@redhat.com>2017-06-30 10:46:04 +0000
commit244cd8fe214c2d77761942cbf2277e4939a8272d (patch)
tree8cdcc4813cbccd83acc8efbbaf4eb9fbf0d44251 /rpc/block_svc_routines.c
parent89b6971641dba99474ecde0dac0111d7c2457e86 (diff)
Show error message when response contains failure
Change-Id: If7a232e4a1d550b3912402282c21d0d033aa00d2 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'rpc/block_svc_routines.c')
-rw-r--r--rpc/block_svc_routines.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/rpc/block_svc_routines.c b/rpc/block_svc_routines.c
index ca39702..c26b2b3 100644
--- a/rpc/block_svc_routines.c
+++ b/rpc/block_svc_routines.c
@@ -508,6 +508,9 @@ glusterBlockCreateRemote(void *data)
"host %s volume %s", strerror(errno), FAILED_REMOTE_CREATE,
cobj.block_name, args->addr, args->volume);
goto out;
+ } else if (args->reply) {
+ errMsg = args->reply;
+ args->reply = NULL;
}
if (isRetValueDependencyError(ret)) {
@@ -635,6 +638,9 @@ glusterBlockDeleteRemote(void *data)
"host %s volume %s", strerror(errno), FAILED_REMOTE_DELETE,
dobj.block_name, args->addr, args->volume);
goto out;
+ } else if (args->reply) {
+ errMsg = args->reply;
+ args->reply = NULL;
}
if (isRetValueDependencyError(ret)) {
@@ -853,6 +859,9 @@ glusterBlockModifyRemote(void *data)
"host %s volume %s", strerror(errno), FAILED_REMOTE_MODIFY,
cobj.block_name, args->addr, args->volume);
goto out;
+ } else if (args->reply) {
+ errMsg = args->reply;
+ args->reply = NULL;
}
if (isRetValueDependencyError(ret)) {
@@ -1249,8 +1258,13 @@ blockStr2arrayAddToJsonObj (json_object *json_obj, char *string, char *label,
static void
-blockFormatDependencyErrors(int errCode, char **errMsg)
+blockFormatDependencyErrors(int errCode, char **errMsg, char *reply_errMsg)
{
+ if (isRetValueDependencyError(errCode) && reply_errMsg) {
+ GB_STRDUP(*errMsg, reply_errMsg);
+ return;
+ }
+
if (errCode == ESRCH) {
GB_ASPRINTF(errMsg, "tcmu-runner is not running in few nodes");
} else if (errCode == ENODEV) {
@@ -1511,7 +1525,7 @@ block_modify_cli_1_svc(blockModifyCli *blk, struct svc_req *rqstp)
ret = 0;
out:
- blockFormatDependencyErrors(errCode, &errMsg);
+ blockFormatDependencyErrors(errCode, &errMsg, NULL);
GB_METAUNLOCK(lkfd, blk->volume, ret, errMsg);
@@ -1839,7 +1853,8 @@ block_create_cli_1_svc(blockCreateCli *blk, struct svc_req *rqstp)
}
exist:
- blockFormatDependencyErrors(errCode, &errMsg);
+ blockFormatDependencyErrors(errCode, &errMsg,
+ savereply?savereply->errMsg:NULL);
GB_METAUNLOCK(lkfd, blk->volume, errCode, errMsg);
out:
@@ -2217,7 +2232,7 @@ block_delete_cli_1_svc(blockDeleteCli *blk, struct svc_req *rqstp)
}
out:
- blockFormatDependencyErrors(errCode, &errMsg);
+ blockFormatDependencyErrors(errCode, &errMsg, NULL);
GB_METAUNLOCK(lkfd, blk->volume, errCode, errMsg);