diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2012-12-06 13:08:11 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-01-04 07:26:25 -0800 |
commit | 129728f257bead0ce0c28b98d3989fabaebe21cd (patch) | |
tree | 24e2afea6031f7686af7c82508e8da3e15c502a9 /xlators/mgmt/glusterd/src/glusterd-volume-ops.c | |
parent | 90ee11d0c5b3b4d57382fdff4500b1da4bdea9a0 (diff) |
glusterd: log enhancements for volume start
* changed some of the log messages to give as much information as
available in case of failure
* added logs to identify on which machine lock/stage/commit failed
* added macros to represent error strings to maintain uniformity
among error messages for a given kind of error
* moved error logs wherever possible, from caller to callee to avoid
code duplication
Change-Id: I0e98d5d3ba086c99240f2fbd642451f175f51942
BUG: 812356
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/4353
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 6c87e97b8cb..c70556a5895 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -239,9 +239,10 @@ glusterd_handle_cli_start_volume (rpcsvc_request_t *req) ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); if (ret < 0) { - //failed to decode msg; + snprintf (errstr, sizeof (errstr), "Failed to decode message " + "received from cli"); req->rpc_err = GARBAGE_ARGS; - snprintf (errstr, sizeof (errstr), "Received garbage args"); + gf_log (this->name, sizeof (errstr), "%s", errstr); goto out; } @@ -269,7 +270,7 @@ glusterd_handle_cli_start_volume (rpcsvc_request_t *req) goto out; } - gf_log (this->name, GF_LOG_INFO, "Received start vol req" + gf_log (this->name, GF_LOG_DEBUG, "Received start vol req" " for volume %s", volname); ret = glusterd_op_begin_synctask (req, GD_OP_START_VOLUME, dict); @@ -861,14 +862,12 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr) glusterd_brickinfo_t *brickinfo = NULL; char msg[2048]; glusterd_conf_t *priv = NULL; + xlator_t *this = NULL; - priv = THIS->private; - if (!priv) { - gf_log ("glusterd", GF_LOG_ERROR, - "priv is NULL"); - ret = -1; - goto out; - } + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); ret = glusterd_op_start_volume_args_get (dict, &volname, &flags); if (ret) @@ -877,18 +876,19 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr) exists = glusterd_check_volume_exists (volname); if (!exists) { - snprintf (msg, sizeof (msg), "Volume %s does not exist", volname); - gf_log ("", GF_LOG_ERROR, "%s", - msg); + snprintf (msg, sizeof (msg), FMTSTR_CHECK_VOL_EXISTS, volname); + gf_log (this->name, GF_LOG_ERROR, "%s", msg); *op_errstr = gf_strdup (msg); ret = -1; - } else { - ret = 0; + goto out; } ret = glusterd_volinfo_find (volname, &volinfo); - if (ret) + if (ret) { + gf_log (this->name, GF_LOG_ERROR, FMTSTR_CHECK_VOL_EXISTS, + volname); goto out; + } ret = glusterd_validate_volume_id (dict, volinfo); if (ret) @@ -897,8 +897,7 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr) list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { ret = glusterd_resolve_brick (brickinfo); if (ret) { - gf_log ("", GF_LOG_ERROR, - "Unable to resolve brick %s:%s", + gf_log (this->name, GF_LOG_ERROR, FMTSTR_RESOLVE_BRICK, brickinfo->hostname, brickinfo->path); goto out; } @@ -907,7 +906,7 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr) if (glusterd_is_volume_started (volinfo)) { snprintf (msg, sizeof (msg), "Volume %s already" " started", volname); - gf_log ("glusterd", GF_LOG_ERROR, "%s", msg); + gf_log (this->name, GF_LOG_ERROR, "%s", msg); *op_errstr = gf_strdup (msg); ret = -1; goto out; @@ -917,7 +916,7 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr) ret = 0; out: - gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); return ret; } @@ -1618,15 +1617,22 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr) int flags = 0; glusterd_volinfo_t *volinfo = NULL; glusterd_brickinfo_t *brickinfo = NULL; + xlator_t *this = NULL; + + this = THIS; + GF_ASSERT (this); ret = glusterd_op_start_volume_args_get (dict, &volname, &flags); if (ret) goto out; ret = glusterd_volinfo_find (volname, &volinfo); - - if (ret) + if (ret) { + gf_log (this->name, GF_LOG_ERROR, FMTSTR_CHECK_VOL_EXISTS, + volname); goto out; + } + list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { ret = glusterd_brick_start (volinfo, brickinfo, _gf_true); if (ret) @@ -1642,7 +1648,7 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr) ret = glusterd_nodesvcs_handle_graph_change (volinfo); out: - gf_log ("", GF_LOG_DEBUG, "returning %d ", ret); + gf_log (this->name, GF_LOG_DEBUG, "returning %d ", ret); return ret; } |