summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli3_1-cops.c3
-rw-r--r--rpc/xdr/src/cli1-xdr.c4
-rw-r--r--rpc/xdr/src/cli1-xdr.h1
-rw-r--r--rpc/xdr/src/cli1.x1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c12
5 files changed, 18 insertions, 3 deletions
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c
index 9e1338c..b8985f7 100644
--- a/cli/src/cli3_1-cops.c
+++ b/cli/src/cli3_1-cops.c
@@ -730,6 +730,9 @@ gf_cli3_1_stop_volume_cbk (struct rpc_req *req, struct iovec *iov,
cli_out ("Stopping volume %s has been %s", volname,
(rsp.op_ret) ? "unsuccessful": "successful");
+ if (rsp.op_ret && rsp.op_errstr)
+ cli_out ("%s", rsp.op_errstr);
+
ret = rsp.op_ret;
out:
diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c
index 807392d..48ade6a 100644
--- a/rpc/xdr/src/cli1-xdr.c
+++ b/rpc/xdr/src/cli1-xdr.c
@@ -316,7 +316,9 @@ xdr_gf1_cli_stop_vol_rsp (XDR *xdrs, gf1_cli_stop_vol_rsp *objp)
return FALSE;
if (!xdr_string (xdrs, &objp->volname, ~0))
return FALSE;
- return TRUE;
+ if (!xdr_string (xdrs, &objp->op_errstr, ~0))
+ return FALSE;
+ return TRUE;
}
bool_t
diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h
index 38f4a56..5bc3b03 100644
--- a/rpc/xdr/src/cli1-xdr.h
+++ b/rpc/xdr/src/cli1-xdr.h
@@ -194,6 +194,7 @@ struct gf1_cli_stop_vol_rsp {
int op_ret;
int op_errno;
char *volname;
+ char *op_errstr;
};
typedef struct gf1_cli_stop_vol_rsp gf1_cli_stop_vol_rsp;
diff --git a/rpc/xdr/src/cli1.x b/rpc/xdr/src/cli1.x
index bce605e..d729548 100644
--- a/rpc/xdr/src/cli1.x
+++ b/rpc/xdr/src/cli1.x
@@ -123,6 +123,7 @@ struct gf1_cli_get_vol_rsp {
int op_ret;
int op_errno;
string volname<>;
+ string op_errstr<>;
} ;
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index e57acf1..6341fd0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -559,7 +559,7 @@ out:
}
static int
-glusterd_op_stage_stop_volume (gd1_mgmt_stage_op_req *req)
+glusterd_op_stage_stop_volume (gd1_mgmt_stage_op_req *req, char **op_errstr)
{
int ret = -1;
dict_t *dict = NULL;
@@ -567,6 +567,7 @@ glusterd_op_stage_stop_volume (gd1_mgmt_stage_op_req *req)
int flags = 0;
gf_boolean_t exists = _gf_false;
glusterd_volinfo_t *volinfo = NULL;
+ char msg[2048] = {0,};
dict = dict_new ();
if (!dict)
@@ -595,8 +596,11 @@ glusterd_op_stage_stop_volume (gd1_mgmt_stage_op_req *req)
ret = glusterd_is_volume_started (volinfo);
if (ret) {
+ snprintf (msg, sizeof(msg), "Volume %s "
+ "is not in the started state", volname);
gf_log ("", GF_LOG_ERROR, "Volume %s "
"has not been started", volname);
+ *op_errstr = gf_strdup (msg);
goto out;
}
}
@@ -4408,6 +4412,10 @@ glusterd_op_send_cli_response (int32_t op, int32_t op_ret,
rsp.op_ret = op_ret;
rsp.op_errno = op_errno;
rsp.volname = "";
+ if (op_errstr)
+ rsp.op_errstr = op_errstr;
+ else
+ rsp.op_errstr = "";
cli_rsp = &rsp;
sfunc = gf_xdr_serialize_cli_stop_vol_rsp;
break;
@@ -4795,7 +4803,7 @@ glusterd_op_stage_validate (gd1_mgmt_stage_op_req *req, char **op_errstr,
break;
case GD_OP_STOP_VOLUME:
- ret = glusterd_op_stage_stop_volume (req);
+ ret = glusterd_op_stage_stop_volume (req, op_errstr);
break;
case GD_OP_DELETE_VOLUME: