diff options
author | shishir gowda <shishirng@gluster.com> | 2010-09-13 07:54:50 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-13 06:58:20 -0700 |
commit | 39e268ee69618488616df1c253b851c07442c863 (patch) | |
tree | f8e73e18c6416478ac7b0fd32751c7999e1a9ed9 /xlators/mgmt/glusterd/src | |
parent | a13bc5aab51ae0e03721c48c8eb98b08c6137872 (diff) |
Volume create propogate error msg to cli if invalid export
Signed-off-by: shishir gowda <shishirng@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1180 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1180
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index c84d8680061..8eb15cfd225 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -345,7 +345,7 @@ out: } static int -glusterd_op_stage_create_volume (gd1_mgmt_stage_op_req *req) +glusterd_op_stage_create_volume (gd1_mgmt_stage_op_req *req, char **op_errstr) { int ret = 0; dict_t *dict = NULL; @@ -362,6 +362,7 @@ glusterd_op_stage_create_volume (gd1_mgmt_stage_op_req *req) char cmd_str[1024]; xlator_t *this = NULL; glusterd_conf_t *priv = NULL; + char msg[2048] = {0,}; GF_ASSERT (req); @@ -439,9 +440,11 @@ glusterd_op_stage_create_volume (gd1_mgmt_stage_op_req *req) if (!uuid_compare (brick_info->uuid, priv->uuid)) { ret = stat (cmd_str, &st_buf); if (ret == -1) { - gf_log ("glusterd", GF_LOG_ERROR, "Volname %s, brick" + snprintf (msg, 2048,"Volname %s, brick" ":%s path %s not present", volname, brick, brick_info->path); + gf_log ("glusterd",GF_LOG_ERROR, "%s", msg); + *op_errstr = gf_strdup (msg); goto out; } brick_list = tmpptr; @@ -999,7 +1002,7 @@ out: } static int -glusterd_op_create_volume (gd1_mgmt_stage_op_req *req) +glusterd_op_create_volume (gd1_mgmt_stage_op_req *req, char **op_errstr) { int ret = 0; dict_t *dict = NULL; @@ -3073,7 +3076,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 = ""; - rsp.op_errstr = ""; + if (op_errstr) + rsp.op_errstr = op_errstr; + else + rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_create_vol_rsp; break; @@ -3386,7 +3392,7 @@ glusterd_op_stage_validate (gd1_mgmt_stage_op_req *req, char **op_errstr) switch (req->op) { case GD_OP_CREATE_VOLUME: - ret = glusterd_op_stage_create_volume (req); + ret = glusterd_op_stage_create_volume (req, op_errstr); break; case GD_OP_START_VOLUME: @@ -3441,7 +3447,7 @@ glusterd_op_commit_perform (gd1_mgmt_stage_op_req *req, char **op_errstr) switch (req->op) { case GD_OP_CREATE_VOLUME: - ret = glusterd_op_create_volume (req); + ret = glusterd_op_create_volume (req, op_errstr); break; case GD_OP_START_VOLUME: |