diff options
author | Nandaja Varma <nandaja.varma@gmail.com> | 2015-03-17 13:16:06 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2015-06-20 21:27:06 -0700 |
commit | 38d602e820b99b0c9e2efe788df7450e4d863196 (patch) | |
tree | 81d2d62adaae3e55662fe11c9772b9944f54a7aa /xlators | |
parent | 16115c232e48f080624b68eb94f813fb3c226e58 (diff) |
ops/glusterd: Porting messages to new logging framework
cherry-picked from commit 70bb8bf65b4cefb503fa94452c200b0b71a06535
>Change-Id: Iafeb07aabc1781d98f51c6c2627bf3bbdf493153
>BUG: 1194640
>Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com>
>Reviewed-on: http://review.gluster.org/9905
>Tested-by: Gluster Build System <jenkins@build.gluster.com>
>Tested-by: NetBSD Build System <jenkins@build.gluster.org>
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Change-Id: Iafeb07aabc1781d98f51c6c2627bf3bbdf493153
BUG: 1217722
Signed-off-by: Nandaja Varma <nvarma@redhat.com>
Reviewed-on: http://review.gluster.org/11230
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 349 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-log-ops.c | 42 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 257 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 419 |
4 files changed, 702 insertions, 365 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 3a9d3188278..0b3c24cd7c4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -22,6 +22,7 @@ #include "glusterd-utils.h" #include "glusterd-volgen.h" #include "glusterd-svc-helper.h" +#include "glusterd-messages.h" #include "run.h" #include <sys/signal.h> @@ -106,7 +107,7 @@ insert_brick: i++; if (i < idx) continue; - gf_log (THIS->name, GF_LOG_DEBUG, "brick:%s index=%d, count=%d", + gf_msg_debug (THIS->name, 0, "brick:%s index=%d, count=%d", brick->path, idx, count); cds_list_add (&brickinfo->brick_list, &brick->brick_list); @@ -139,7 +140,8 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count, "bricks (%d) supplied for stripe count (%d).", (total_bricks - volinfo->brick_count), stripe_count); - gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, + GD_MSG_INVALID_ENTRY, "%s", err_str); goto out; } break; @@ -160,7 +162,8 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count, (total_bricks - volinfo->brick_count), stripe_count, (volinfo->replica_count * stripe_count)); - gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, + GD_MSG_INVALID_ENTRY, "%s", err_str); goto out; } break; @@ -171,7 +174,8 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count, "Incorrect stripe count (%d) supplied. " "Volume already has stripe count (%d)", stripe_count, volinfo->stripe_count); - gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, + GD_MSG_INVALID_ENTRY, "%s", err_str); goto out; } if (stripe_count == volinfo->stripe_count) { @@ -203,7 +207,8 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count, snprintf (err_str, err_len, "Volume %s cannot be converted " "from dispersed to striped-" "dispersed", volinfo->volname); - gf_log(THIS->name, GF_LOG_ERROR, "%s", err_str); + gf_msg(THIS->name, GF_LOG_ERROR, EPERM, + GD_MSG_OP_NOT_PERMITTED, "%s", err_str); goto out; } @@ -235,7 +240,8 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count, "bricks (%d) supplied for replica count (%d).", (total_bricks - volinfo->brick_count), replica_count); - gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, + GD_MSG_INVALID_ENTRY, "%s", err_str); goto out; } break; @@ -243,7 +249,8 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count, if (!(total_bricks % (volinfo->dist_leaf_count * replica_count))) { /* Change the volume type */ *type = GF_CLUSTER_TYPE_STRIPE_REPLICATE; - gf_log (THIS->name, GF_LOG_INFO, + gf_msg (THIS->name, GF_LOG_INFO, 0, + GD_MSG_VOL_TYPE_CHANGING_INFO, "Changing the type of volume %s from " "'stripe' to 'replicate-stripe'", volinfo->volname); @@ -257,7 +264,8 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count, (total_bricks - volinfo->brick_count), replica_count, (volinfo->dist_leaf_count * replica_count)); - gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, + GD_MSG_INVALID_ENTRY, "%s", err_str); goto out; } break; @@ -268,7 +276,8 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count, "Incorrect replica count (%d) supplied. " "Volume already has (%d)", replica_count, volinfo->replica_count); - gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, + GD_MSG_INVALID_ENTRY, "%s", err_str); goto out; } if (replica_count == volinfo->replica_count) { @@ -299,7 +308,8 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count, snprintf (err_str, err_len, "Volume %s cannot be converted " "from dispersed to replicated-" "dispersed", volinfo->volname); - gf_log(THIS->name, GF_LOG_ERROR, "%s", err_str); + gf_msg(THIS->name, GF_LOG_ERROR, EPERM, + GD_MSG_OP_NOT_PERMITTED, "%s", err_str); goto out; } out: @@ -326,7 +336,8 @@ gd_rmbr_validate_replica_count (glusterd_volinfo_t *volinfo, snprintf (err_str, err_len, "replica count (%d) option given for non replicate " "volume %s", replica_count, volinfo->volname); - gf_log (THIS->name, GF_LOG_WARNING, "%s", err_str); + gf_msg (THIS->name, GF_LOG_WARNING, 0, + GD_MSG_VOL_NOT_REPLICA, "%s", err_str); goto out; case GF_CLUSTER_TYPE_REPLICATE: @@ -338,7 +349,8 @@ gd_rmbr_validate_replica_count (glusterd_volinfo_t *volinfo, "than volume %s's replica count (%d)", replica_count, volinfo->volname, volinfo->replica_count); - gf_log (THIS->name, GF_LOG_WARNING, "%s", err_str); + gf_msg (THIS->name, GF_LOG_WARNING, EINVAL, + GD_MSG_INVALID_ENTRY, "%s", err_str); goto out; } if (replica_count == volinfo->replica_count) { @@ -352,7 +364,8 @@ gd_rmbr_validate_replica_count (glusterd_volinfo_t *volinfo, "(or %dxN)", brick_count, volinfo->dist_leaf_count, volinfo->dist_leaf_count); - gf_log (THIS->name, GF_LOG_WARNING, "%s", + gf_msg (THIS->name, GF_LOG_WARNING, EINVAL, + GD_MSG_INVALID_ENTRY, "%s", err_str); goto out; } @@ -423,7 +436,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (err_str, sizeof (err_str), "Unable to decode " @@ -437,7 +451,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get volume " "name"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } @@ -445,7 +460,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req) ret = -1; snprintf (err_str, sizeof (err_str), "Volume %s does not exist", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + GD_MSG_VOL_NOT_FOUND, "%s", err_str); goto out; } @@ -453,24 +469,28 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get volume " "brick count"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } ret = dict_get_int32 (dict, "replica-count", &replica_count); if (!ret) { - gf_log (this->name, GF_LOG_INFO, "replica-count is %d", + gf_msg (this->name, GF_LOG_INFO, errno, + GD_MSG_DICT_GET_FAILED, "replica-count is %d", replica_count); } ret = dict_get_int32 (dict, "stripe-count", &stripe_count); if (!ret) { - gf_log (this->name, GF_LOG_INFO, "stripe-count is %d", + gf_msg (this->name, GF_LOG_INFO, errno, + GD_MSG_DICT_GET_FAILED, "stripe-count is %d", stripe_count); } if (!dict_get (dict, "force")) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get flag"); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Failed to get flag"); goto out; } @@ -478,7 +498,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get volinfo " "for volume name %s", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLINFO_GET_FAIL, "%s", err_str); goto out; } @@ -531,7 +552,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req) snprintf (err_str, sizeof (err_str), "Incorrect number " "of bricks supplied %d with count %d", brick_count, volinfo->dist_leaf_count); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + GD_MSG_VOL_NOT_REPLICA, "%s", err_str); ret = -1; goto out; } @@ -547,7 +569,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req) err_str, sizeof (err_str)); if (ret == -1) { - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_COUNT_VALIDATE_FAILED, "%s", err_str); goto out; } @@ -557,7 +580,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req) ret = dict_set_int32 (dict, "stripe-count", stripe_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "failed to set the stripe-count in dict"); goto out; } @@ -569,7 +593,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req) &type, err_str, sizeof (err_str)); if (ret == -1) { - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_COUNT_VALIDATE_FAILED, "%s", err_str); goto out; } @@ -579,7 +604,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req) ret = dict_set_int32 (dict, "replica-count", replica_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "failed to set the replica-count in dict"); goto out; } @@ -589,14 +615,16 @@ brick_val: if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get volume " "bricks"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } if (type != volinfo->type) { ret = dict_set_int32 (dict, "type", type); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "failed to set the new type in dict"); goto out; } @@ -655,7 +683,7 @@ subvol_matcher_update (int *subvols, glusterd_volinfo_t *volinfo, pos++; continue; } - gf_log (THIS->name, GF_LOG_DEBUG, LOGSTR_FOUND_BRICK, + gf_msg_debug (THIS->name, 0, LOGSTR_FOUND_BRICK, brickinfo->hostname, brickinfo->path, volinfo->volname); sub_volume = (pos / volinfo->dist_leaf_count); @@ -786,7 +814,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (err_str, sizeof (err_str), "Unable to decode " @@ -799,7 +828,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get volume " "name"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } @@ -807,7 +837,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get brick " "count"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } @@ -815,7 +846,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str),"Volume %s does not exist", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + GD_MSG_VOL_NOT_FOUND, "%s", err_str); goto out; } @@ -845,7 +877,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) ret = dict_get_int32 (dict, "replica-count", &replica_count); if (!ret) { - gf_log (this->name, GF_LOG_INFO, + gf_msg (this->name, GF_LOG_INFO, errno, + GD_MSG_DICT_GET_FAILED, "request to change replica-count to %d", replica_count); ret = gd_rmbr_validate_replica_count (volinfo, replica_count, count, err_str, @@ -862,7 +895,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) ret = dict_set_int32 (dict, "replica-count", replica_count); if (ret) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, errno, + GD_MSG_DICT_SET_FAILED, "failed to set the replica_count " "in dict"); goto out; @@ -888,7 +922,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) (volinfo->brick_count == volinfo->stripe_count)) { snprintf (err_str, sizeof (err_str), "Removing brick from a stripe volume is not allowed"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, EPERM, + GD_MSG_OP_NOT_PERMITTED, "%s", err_str); ret = -1; goto out; } @@ -900,7 +935,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) "Removing bricks from stripe-replicate" " configuration is not allowed without reducing " "replica or stripe count explicitly."); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, EPERM, + GD_MSG_OP_NOT_PERMITTED_AC_REQD, "%s", err_str); ret = -1; goto out; } @@ -912,7 +948,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) "Removing bricks from replicate configuration " "is not allowed without reducing replica count " "explicitly."); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, EPERM, + GD_MSG_OP_NOT_PERMITTED_AC_REQD, "%s", err_str); ret = -1; goto out; } @@ -926,7 +963,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) snprintf (err_str, sizeof (err_str), "Remove brick " "incorrect brick count of %d for %s %d", count, vol_type, volinfo->dist_leaf_count); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + GD_MSG_INVALID_ENTRY, "%s", err_str); ret = -1; goto out; } @@ -958,10 +996,11 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get %s", key); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } - gf_log (this->name, GF_LOG_DEBUG, "Remove brick count %d brick:" + gf_msg_debug (this->name, 0, "Remove brick count %d brick:" " %s", i, brick); ret = glusterd_volume_brickinfo_get_by_brick(brick, volinfo, @@ -970,7 +1009,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Incorrect brick " "%s for volume %s", brick, volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + GD_MSG_BRICK_NOT_FOUND, "%s", err_str); goto out; } strcat(brick_list, brick); @@ -1004,7 +1044,8 @@ out: if (err_str[0] == '\0') snprintf (err_str, sizeof (err_str), "Operation failed"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_GLUSTERD_OP_FAILED, "%s", err_str); rsp.op_errstr = err_str; cli_rsp = &rsp; glusterd_to_cli (req, cli_rsp, NULL, 0, NULL, @@ -1055,7 +1096,8 @@ _glusterd_restart_gsync_session (dict_t *this, char *key, slave++; slave_buf = gf_strdup (slave); if (!slave_buf) { - gf_log ("", GF_LOG_ERROR, + gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM, + GD_MSG_NO_MEMORY, "Failed to gf_strdup"); ret = -1; goto out; @@ -1066,7 +1108,8 @@ _glusterd_restart_gsync_session (dict_t *this, char *key, ret = dict_set_dynstr (param->rsp_dict, "slave", slave_buf); if (ret) { - gf_log ("", GF_LOG_ERROR, + gf_msg ("glusterd", GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Unable to store slave"); if (slave_buf) GF_FREE(slave_buf); @@ -1079,9 +1122,12 @@ _glusterd_restart_gsync_session (dict_t *this, char *key, &conf_path, errmsg); if (ret) { if (*errmsg) - gf_log ("", GF_LOG_ERROR, "%s", *errmsg); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_SLAVE_CONFPATH_DETAILS_FETCH_FAIL, + "%s", *errmsg); else - gf_log ("", GF_LOG_ERROR, + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_SLAVE_CONFPATH_DETAILS_FETCH_FAIL, "Unable to fetch slave or confpath details."); goto out; } @@ -1092,11 +1138,12 @@ _glusterd_restart_gsync_session (dict_t *this, char *key, slave, conf_path, &is_running); if (ret) { - gf_log ("", GF_LOG_ERROR, "gsync running validation failed."); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_GSYNC_VALIDATION_FAIL, "gsync running validation failed."); goto out; } if (_gf_false == is_running) { - gf_log ("", GF_LOG_DEBUG, "gsync session for %s and %s is" + gf_msg_debug ("glusterd", 0, "gsync session for %s and %s is" " not running on this node. Hence not restarting.", param->volinfo->volname, slave); ret = 0; @@ -1105,7 +1152,7 @@ _glusterd_restart_gsync_session (dict_t *this, char *key, ret = glusterd_get_local_brickpaths (param->volinfo, &path_list); if (!path_list) { - gf_log ("", GF_LOG_DEBUG, "This node not being part of" + gf_msg_debug ("glusterd", 0, "This node not being part of" " volume should not be running gsyncd. Hence" " no gsyncd process to restart."); ret = 0; @@ -1116,11 +1163,12 @@ _glusterd_restart_gsync_session (dict_t *this, char *key, param->rsp_dict, path_list, conf_path, 0); if (ret) - gf_log ("", GF_LOG_ERROR, + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_GSYNC_RESTART_FAIL, "Unable to restart gsync session."); out: - gf_log ("", GF_LOG_DEBUG, "Returning %d.", ret); + gf_msg_debug ("glusterd", 0, "Returning %d.", ret); return ret; } @@ -1169,16 +1217,19 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count, if (dict) { ret = dict_get_int32 (dict, "stripe-count", &stripe_count); if (!ret) - gf_log (THIS->name, GF_LOG_INFO, + gf_msg (THIS->name, GF_LOG_INFO, errno, + GD_MSG_DICT_GET_FAILED, "stripe-count is set %d", stripe_count); ret = dict_get_int32 (dict, "replica-count", &replica_count); if (!ret) - gf_log (THIS->name, GF_LOG_INFO, + gf_msg (THIS->name, GF_LOG_INFO, errno, + GD_MSG_DICT_GET_FAILED, "replica-count is set %d", replica_count); ret = dict_get_int32 (dict, "type", &type); if (!ret) - gf_log (THIS->name, GF_LOG_INFO, + gf_msg (THIS->name, GF_LOG_INFO, errno, + GD_MSG_DICT_GET_FAILED, "type is set %d, need to change it", type); } @@ -1202,8 +1253,9 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count, snprintf (key, sizeof(key), "brick%d.mount_dir", i); ret = dict_get_str (dict, key, &brick_mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, - "%s not present", key); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, + "%s not present", key); goto out; } strncpy (brickinfo->mount_dir, brick_mount_dir, @@ -1278,7 +1330,8 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count, if (brickinfo->vg[0]) { ret = glusterd_is_valid_vg (brickinfo, 0, msg); if (ret) { - gf_log (THIS->name, GF_LOG_CRITICAL, "%s", msg); + gf_msg (THIS->name, GF_LOG_CRITICAL, 0, + GD_MSG_INVALID_VG, "%s", msg); goto out; } /* if anyone of the brick does not have thin support, @@ -1291,7 +1344,8 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count, if (gf_uuid_is_null (brickinfo->uuid)) { ret = glusterd_resolve_brick (brickinfo); if (ret) { - gf_log ("", GF_LOG_ERROR, FMTSTR_RESOLVE_BRICK, + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_RESOLVE_BRICK_FAIL, FMTSTR_RESOLVE_BRICK, brickinfo->hostname, brickinfo->path); goto out; } @@ -1309,7 +1363,7 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count, if ((!gf_uuid_compare (brickinfo->uuid, MY_UUID)) && !restart_needed) { restart_needed = 1; - gf_log ("", GF_LOG_DEBUG, + gf_msg_debug ("glusterd", 0, "Restart gsyncd session, if it's already " "running."); } @@ -1328,7 +1382,7 @@ out: GF_FREE (free_ptr1); GF_FREE (free_ptr2); - gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug ("glusterd", 0, "Returning %d", ret); return ret; } @@ -1368,7 +1422,8 @@ glusterd_op_perform_remove_brick (glusterd_volinfo_t *volinfo, char *brick, ret = glusterd_brick_stop (volinfo, brickinfo, _gf_true); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Unable to stop " + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_BRICK_STOP_FAIL, "Unable to stop " "glusterfs, ret: %d", ret); } goto out; @@ -1377,7 +1432,7 @@ glusterd_op_perform_remove_brick (glusterd_volinfo_t *volinfo, char *brick, brickinfo->decommissioned = 1; ret = 0; out: - gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug ("glusterd", 0, "Returning %d", ret); return ret; } @@ -1413,7 +1468,7 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = dict_get_int32 (dict, "replica-count", &replica_count); if (ret) { - gf_log (THIS->name, GF_LOG_DEBUG, + gf_msg_debug (THIS->name, 0, "Unable to get replica count"); } @@ -1421,21 +1476,24 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = op_version_check (this, GD_OP_VER_PERSISTENT_AFR_XATTRS, msg, sizeof(msg)); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_OP_VERSION_MISMATCH, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } } ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, + gf_msg (THIS->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "Unable to find volume: %s", volname); goto out; } @@ -1447,20 +1505,23 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict) if (glusterd_is_defrag_on(volinfo)) { snprintf (msg, sizeof(msg), "Volume name %s rebalance is in " "progress. Please retry after completion", volname); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_OIP_RETRY_LATER, "%s", msg); *op_errstr = gf_strdup (msg); ret = -1; goto out; } ret = dict_get_int32 (dict, "count", &count); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get count"); + gf_msg ("glusterd", GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get count"); goto out; } ret = dict_get_str (dict, "bricks", &bricks); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Unable to get bricks"); + gf_msg (THIS->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get bricks"); goto out; } @@ -1481,7 +1542,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict) !glusterd_is_valid_volfpath (volname, brick)) { snprintf (msg, sizeof (msg), "brick path %s is " "too long", brick); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_BRKPATH_TOO_LONG, "%s", msg); *op_errstr = gf_strdup (msg); ret = -1; @@ -1491,7 +1553,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = glusterd_brickinfo_new_from_brick (brick, &brickinfo); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_BRICK_NOT_FOUND, "Add-brick: Unable" " to get brickinfo"); goto out; @@ -1511,7 +1574,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict) if (brickinfo->vg[0]) { ret = glusterd_is_valid_vg (brickinfo, 1, msg); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "%s", + gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, + GD_MSG_INVALID_VG, "%s", msg); *op_errstr = gf_strdup (msg); goto out; @@ -1533,7 +1597,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict) (brickinfo->path, brickinfo->hostname, brickinfo->mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BRICK_MOUNTDIR_GET_FAIL, "Failed to get brick mount_dir"); goto out; } @@ -1543,7 +1608,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = dict_set_dynstr_with_alloc (rsp_dict, key, brickinfo->mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Failed to set %s", key); goto out; } @@ -1562,7 +1628,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = dict_set_int32 (rsp_dict, "brick_count", local_brick_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Failed to set local_brick_count"); goto out; } @@ -1574,7 +1641,7 @@ out: GF_FREE (str_ret); GF_FREE (all_bricks); - gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (THIS->name, 0, "Returning %d", ret); return ret; } @@ -1604,21 +1671,24 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) ret = op_version_check (this, GD_OP_VER_PERSISTENT_AFR_XATTRS, msg, sizeof(msg)); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_OP_VERSION_MISMATCH, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Unable to get volume name"); goto out; } ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Volume %s does not exist", volname); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "Volume %s does not exist", volname); goto out; } @@ -1628,7 +1698,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "command", &flag); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get brick command"); goto out; } @@ -1636,7 +1707,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "count", &brick_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get brick count"); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get brick count"); goto out; } @@ -1675,7 +1747,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) "needed when reducing replica count. Use the" " 'force' option"); errstr = gf_strdup (msg); - gf_log (this->name, GF_LOG_ERROR, "%s", errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_USE_THE_FORCE, "%s", errstr); goto out; } @@ -1685,7 +1758,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) "'force' or 'commit' to override this " "behavior)", volinfo->volname); errstr = gf_strdup (msg); - gf_log (this->name, GF_LOG_ERROR, "%s", errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_STARTED, "%s", errstr); goto out; } if (!gd_is_remove_brick_committed (volinfo)) { @@ -1694,7 +1768,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) " or stop it before starting a new task.", volinfo->volname); errstr = gf_strdup (msg); - gf_log (this->name, GF_LOG_ERROR, "Earlier remove-brick" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_OLD_REMOVE_BRICK_EXISTS, "Earlier remove-brick" " task exists for volume %s.", volinfo->volname); goto out; @@ -1702,7 +1777,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) if (glusterd_is_defrag_on(volinfo)) { errstr = gf_strdup("Rebalance is in progress. Please " "retry after completion"); - gf_log (this->name, GF_LOG_ERROR, "%s", errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_OIP_RETRY_LATER, "%s", errstr); goto out; } @@ -1729,7 +1805,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) ret = glusterd_generate_and_set_task_id (dict, GF_REMOVE_BRICK_TID_KEY); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_TASKID_GEN_FAIL, "Failed to generate task-id"); goto out; } @@ -1737,7 +1814,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, GF_REMOVE_BRICK_TID_KEY, &task_id_str); if (ret) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, errno, + GD_MSG_DICT_GET_FAILED, "Missing remove-brick-id"); ret = 0; } @@ -1823,7 +1901,7 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) ret = 0; out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); if (ret && errstr) { if (op_errstr) *op_errstr = errstr; @@ -1966,27 +2044,31 @@ glusterd_op_add_brick (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get volume name"); + gf_msg ("glusterd", GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to allocate memory"); + gf_msg ("glusterd", GF_LOG_ERROR, EINVAL, + GD_MSG_VOL_NOT_FOUND, "Unable to allocate memory"); goto out; } ret = dict_get_int32 (dict, "count", &count); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get count"); + gf_msg ("glusterd", GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get count"); goto out; } ret = dict_get_str (dict, "bricks", &bricks); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get bricks"); + gf_msg ("glusterd", GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get bricks"); goto out; } @@ -1997,7 +2079,8 @@ glusterd_op_add_brick (dict_t *dict, char **op_errstr) ret = glusterd_op_perform_add_bricks (volinfo, count, bricks, dict); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to add bricks"); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_BRICK_ADD_FAIL, "Unable to add bricks"); goto out; } @@ -2053,19 +2136,22 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BRICK_ADD_FAIL, "Unable to get volume name"); goto out; } ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to allocate memory"); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + GD_MSG_VOL_NOT_FOUND, "Unable to allocate memory"); goto out; } ret = dict_get_int32 (dict, "command", &flag); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get command"); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get command"); goto out; } cmd = flag; @@ -2084,7 +2170,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) (volinfo->rebal.rebalance_id, dict, GF_REMOVE_BRICK_TID_KEY); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_REMOVE_BRICK_ID_SET_FAIL, "Failed to set remove-brick-id"); goto out; } @@ -2121,7 +2208,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) } ret = glusterd_create_volfiles_and_notify_services (volinfo); if (ret) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_VOLFILE_CREATE_FAIL, "failed to create volfiles"); goto out; } @@ -2129,7 +2217,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT); if (ret) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_VOLINFO_SET_FAIL, "failed to store volinfo"); goto out; } @@ -2147,7 +2236,7 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) volinfo->rebal.defrag_status = GF_DEFRAG_STATUS_NOT_STARTED; ret = dict_get_str (dict, GF_REMOVE_BRICK_TID_KEY, &task_id_str); if (ret) { - gf_log (this->name, GF_LOG_DEBUG, + gf_msg_debug (this->name, errno, "Missing remove-brick-id"); ret = 0; } else { @@ -2190,7 +2279,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "count", &count); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get count"); + gf_msg ("glusterd", GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get count"); goto out; } @@ -2206,7 +2296,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) } ret = dict_set_int32 (bricks_dict, "count", count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Failed to save remove-brick count"); goto out; } @@ -2219,7 +2310,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) snprintf (key, 256, "brick%d", i); ret = dict_get_str (dict, key, &brick); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get %s", + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get %s", key); goto out; } @@ -2228,13 +2320,15 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) brick_tmpstr = gf_strdup (brick); if (!brick_tmpstr) { ret = -1; - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, ENOMEM, + GD_MSG_NO_MEMORY, "Failed to duplicate brick name"); goto out; } ret = dict_set_dynstr (bricks_dict, key, brick_tmpstr); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Failed to add brick to dict"); goto out; } @@ -2252,7 +2346,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "replica-count", &replica_count); if (!ret) { - gf_log (this->name, GF_LOG_INFO, + gf_msg (this->name, GF_LOG_INFO, errno, + GD_MSG_DICT_GET_FAILED, "changing replica count %d to %d on volume %s", volinfo->replica_count, replica_count, volinfo->volname); @@ -2283,13 +2378,15 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) ret = glusterd_create_volfiles_and_notify_services (volinfo); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to create volfiles"); + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_VOLFILE_CREATE_FAIL, "failed to create volfiles"); goto out; } ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to store volinfo"); + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_VOLINFO_STORE_FAIL, "failed to store volinfo"); goto out; } @@ -2297,7 +2394,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) volinfo->status == GLUSTERD_STATUS_STARTED) { ret = glusterd_svcs_reconfigure (volinfo); if (ret) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_NFS_RECONF_FAIL, "Unable to reconfigure NFS-Server"); goto out; } @@ -2325,7 +2423,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) volinfo->decommission_in_progress = 1; if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_REBALANCE_START_FAIL, "failed to start the rebalance"); } } else { @@ -2358,7 +2457,8 @@ glusterd_op_stage_barrier (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Volname not present in " + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Volname not present in " "dict"); goto out; } @@ -2366,7 +2466,8 @@ glusterd_op_stage_barrier (dict_t *dict, char **op_errstr) ret = glusterd_volinfo_find (volname, &vol); if (ret) { gf_asprintf (op_errstr, "Volume %s does not exist", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "%s", *op_errstr); goto out; } @@ -2380,12 +2481,13 @@ glusterd_op_stage_barrier (dict_t *dict, char **op_errstr) if (ret == -1) { gf_asprintf (op_errstr, "Barrier op for volume %s not present " "in dict", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "%s", *op_errstr); goto out; } ret = 0; out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -2404,7 +2506,8 @@ glusterd_op_barrier (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Volname not present in " + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Volname not present in " "dict"); goto out; } @@ -2412,7 +2515,8 @@ glusterd_op_barrier (dict_t *dict, char **op_errstr) ret = glusterd_volinfo_find (volname, &vol); if (ret) { gf_asprintf (op_errstr, "Volume %s does not exist", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "%s", *op_errstr); goto out; } @@ -2420,14 +2524,16 @@ glusterd_op_barrier (dict_t *dict, char **op_errstr) if (ret) { gf_asprintf (op_errstr, "Barrier op for volume %s not present " "in dict", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "%s", *op_errstr); goto out; } ret = dict_set_dynstr_with_alloc (vol->dict, "features.barrier", barrier_op); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to set barrier op in" + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Failed to set barrier op in" " volume option dict"); goto out; } @@ -2435,13 +2541,14 @@ glusterd_op_barrier (dict_t *dict, char **op_errstr) gd_update_volume_op_versions (vol); ret = glusterd_create_volfiles (vol); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to create volfiles"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLFILE_CREATE_FAIL, "Failed to create volfiles"); goto out; } ret = glusterd_store_volinfo (vol, GLUSTERD_VOLINFO_VER_AC_INCREMENT); out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-log-ops.c b/xlators/mgmt/glusterd/src/glusterd-log-ops.c index 449b28cdbf1..76116377496 100644 --- a/xlators/mgmt/glusterd/src/glusterd-log-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-log-ops.c @@ -20,6 +20,7 @@ #include "glusterd-store.h" #include "glusterd-utils.h" #include "glusterd-volgen.h" +#include "glusterd-messages.h" #include <signal.h> @@ -53,7 +54,8 @@ __glusterd_handle_log_rotate (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (msg, sizeof (msg), "Unable to decode the " @@ -65,7 +67,8 @@ __glusterd_handle_log_rotate (rpcsvc_request_t *req) ret = dict_get_str (dict, "volname", &volname); if (ret) { snprintf (msg, sizeof (msg), "Failed to get volume name"); - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", msg); goto out; } @@ -110,7 +113,8 @@ glusterd_op_stage_log_rotate (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get volume name"); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } @@ -119,7 +123,8 @@ glusterd_op_stage_log_rotate (dict_t *dict, char **op_errstr) if (!exists) { snprintf (msg, sizeof (msg), "Volume %s does not exist", volname); - gf_log ("", GF_LOG_ERROR, "%s", msg); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "%s", msg); *op_errstr = gf_strdup (msg); ret = -1; goto out; @@ -128,7 +133,8 @@ glusterd_op_stage_log_rotate (dict_t *dict, char **op_errstr) if (_gf_false == glusterd_is_volume_started (volinfo)) { snprintf (msg, sizeof (msg), "Volume %s needs to be started before" " log rotate.", volname); - gf_log ("", GF_LOG_ERROR, "%s", msg); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_STARTED, "%s", msg); *op_errstr = gf_strdup (msg); ret = -1; goto out; @@ -146,12 +152,13 @@ glusterd_op_stage_log_rotate (dict_t *dict, char **op_errstr) if (ret) { snprintf (msg, sizeof (msg), "Incorrect brick %s " "for volume %s", brick, volname); - gf_log ("", GF_LOG_ERROR, "%s", msg); + gf_msg ("glusterd", GF_LOG_ERROR, EINVAL, + GD_MSG_INVALID_ENTRY, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } out: - gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug ("glusterd", 0, "Returning %d", ret); return ret; } @@ -182,13 +189,15 @@ glusterd_op_log_rotate (dict_t *dict) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log ("", GF_LOG_ERROR, "volname not found"); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "volname not found"); goto out; } ret = dict_get_uint64 (dict, "rotate-key", &key); if (ret) { - gf_log ("", GF_LOG_ERROR, "rotate key not found"); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "rotate key not found"); goto out; } @@ -200,7 +209,8 @@ glusterd_op_log_rotate (dict_t *dict) ret = glusterd_brickinfo_new_from_brick (brick, &tmpbrkinfo); if (ret) { - gf_log ("glusterd", GF_LOG_ERROR, + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_BRICK_NOT_FOUND, "cannot get brickinfo from brick"); goto out; } @@ -225,7 +235,8 @@ cont: GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, priv); file = fopen (pidfile, "r+"); if (!file) { - gf_log ("", GF_LOG_ERROR, "Unable to open pidfile: %s", + gf_msg ("glusterd", GF_LOG_ERROR, errno, + GD_MSG_FILE_OP_FAILED, "Unable to open pidfile: %s", pidfile); ret = -1; goto out; @@ -233,7 +244,8 @@ cont: ret = fscanf (file, "%d", &pid); if (ret <= 0) { - gf_log ("", GF_LOG_ERROR, "Unable to read pidfile: %s", + gf_msg ("glusterd", GF_LOG_ERROR, errno, + GD_MSG_FILE_OP_FAILED, "Unable to read pidfile: %s", pidfile); ret = -1; goto out; @@ -246,11 +258,13 @@ cont: ret = rename (brickinfo->logfile, logfile); if (ret) - gf_log ("", GF_LOG_WARNING, "rename failed"); + gf_msg ("glusterd", GF_LOG_WARNING, errno, + GD_MSG_FILE_OP_FAILED, "rename failed"); ret = kill (pid, SIGHUP); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to SIGHUP to %d", pid); + gf_msg ("glusterd", GF_LOG_ERROR, errno, + GD_MSG_PID_KILL_FAIL, "Unable to SIGHUP to %d", pid); goto out; } ret = 0; diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c index 2b800e69c16..e987208cfe0 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c @@ -81,7 +81,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, if (ctx) { ret = dict_get_int32 (ctx, "status", &status); if (ret) { - gf_log (this->name, GF_LOG_TRACE, + gf_msg_trace (this->name, 0, "failed to get status"); } } @@ -104,7 +104,8 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, if (ctx && dict_get_int32 (ctx, "count", &count)) { ret = dict_set_int32 (ctx, "count", 0); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "failed to set count in dictionary"); } } @@ -113,14 +114,15 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, case GD_OP_START_BRICK: case GD_OP_STOP_BRICK: { - gf_log (this->name, GF_LOG_DEBUG, "op '%s' not supported", + gf_msg_debug (this->name, 0, "op '%s' not supported", gd_op_list[op]); break; } case GD_OP_NONE: case GD_OP_MAX: { - gf_log (this->name, GF_LOG_ERROR, "invalid operation"); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + GD_MSG_OP_UNSUPPORTED, "invalid operation"); break; } case GD_OP_CREATE_VOLUME: @@ -179,7 +181,8 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, ret = dict_allocate_and_serialize (ctx, &rsp.dict.dict_val, &rsp.dict.dict_len); if (ret < 0 ) - gf_log (this->name, GF_LOG_ERROR, "failed to " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SERL_LENGTH_GET_FAIL, "failed to " "serialize buffer"); else free_ptr = rsp.dict.dict_val; @@ -197,7 +200,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, ret = 0; GF_FREE (free_ptr); - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -238,7 +241,8 @@ __glusterd_probe_cbk (struct rpc_req *req, struct iovec *iov, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_probe_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "error"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RES_DECODE_FAIL, "error"); //rsp.op_ret = -1; //rsp.op_errno = EINVAL; goto out; @@ -301,19 +305,22 @@ __glusterd_probe_cbk (struct rpc_req *req, struct iovec *iov, if (ctx->req == NULL) goto cont; - gf_log (this->name, GF_LOG_DEBUG, "Adding address '%s' to " + gf_msg_debug (this->name, 0, "Adding address '%s' to " "existing peer %s", rsp.hostname, uuid_utoa (rsp.uuid)); ret = glusterd_friend_remove (NULL, rsp.hostname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Could not remove " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_STALE_PEERINFO_REMOVE_FAIL, + "Could not remove " "stale peerinfo with name %s", rsp.hostname); goto reply; } ret = gd_add_address_to_peer (peerinfo, rsp.hostname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_HOSTNAME_ADD_TO_PEERLIST_FAIL, "Couldn't add hostname to peer list"); goto reply; } @@ -386,7 +393,8 @@ cont: (GD_FRIEND_EVENT_INIT_FRIEND_REQ, &event); if (ret) { - gf_log ("glusterd", GF_LOG_ERROR, + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_NEW_FRIEND_SM_EVENT_GET_FAIL, "Unable to get event"); goto unlock; } @@ -450,7 +458,8 @@ __glusterd_friend_add_cbk (struct rpc_req * req, struct iovec *iov, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_friend_rsp); if (ret < 0) { - gf_log ("", GF_LOG_ERROR, "error"); + gf_msg ("glusterd", GF_LOG_ERROR, errno, + GD_MSG_RES_DECODE_FAIL, "error"); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -468,7 +477,9 @@ __glusterd_friend_add_cbk (struct rpc_req * req, struct iovec *iov, peerinfo = glusterd_peerinfo_find (rsp.uuid, rsp.hostname); if (peerinfo == NULL) { ret = -1; - gf_log ("", GF_LOG_ERROR, "received friend add response from" + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_RESP_FROM_UNKNOWN_PEER, + "received friend add response from" " unknown peer uuid: %s", uuid_utoa (rsp.uuid)); goto unlock; } @@ -481,7 +492,8 @@ __glusterd_friend_add_cbk (struct rpc_req * req, struct iovec *iov, ret = glusterd_friend_sm_new_event (event_type, &event); if (ret) { - gf_log ("glusterd", GF_LOG_ERROR, + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_EVENT_NEW_GET_FAIL, "Unable to get event"); goto unlock; } @@ -563,7 +575,8 @@ __glusterd_friend_remove_cbk (struct rpc_req * req, struct iovec *iov, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_friend_rsp); if (ret < 0) { - gf_log ("", GF_LOG_ERROR, "error"); + gf_msg ("glusterd", GF_LOG_ERROR, errno, + GD_MSG_RES_DECODE_FAIL, "error"); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto respond; @@ -592,7 +605,8 @@ inject: ret = glusterd_friend_sm_new_event (event_type, &event); if (ret) { - gf_log ("glusterd", GF_LOG_ERROR, + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_EVENT_NEW_GET_FAIL, "Unable to get event"); goto unlock; } @@ -651,14 +665,16 @@ __glusterd_friend_update_cbk (struct rpc_req *req, struct iovec *iov, this = THIS; if (-1 == req->rpc_status) { - gf_log (this->name, GF_LOG_ERROR, "RPC Error"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RPC_FAILURE, "RPC Error"); goto out; } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_friend_update_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "Failed to serialize friend" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RES_DECODE_FAIL, "Failed to serialize friend" " update repsonse"); goto out; } @@ -703,7 +719,8 @@ __glusterd_cluster_lock_cbk (struct rpc_req *req, struct iovec *iov, txn_id = &priv->global_txn_id; if (-1 == req->rpc_status) { - gf_log (this->name, GF_LOG_ERROR, "Lock response is not " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_NO_LOCK_RESP_FROM_PEER, "Lock response is not " "received from one of the peer"); err_str = "Lock response is not received from one of the peer"; glusterd_set_opinfo (err_str, ENETRESET, -1); @@ -714,7 +731,8 @@ __glusterd_cluster_lock_cbk (struct rpc_req *req, struct iovec *iov, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_cluster_lock_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "Failed to decode " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RES_DECODE_FAIL, "Failed to decode " "cluster lock response received from peer"); err_str = "Failed to decode cluster lock response received from" " peer"; @@ -725,16 +743,24 @@ __glusterd_cluster_lock_cbk (struct rpc_req *req, struct iovec *iov, op_ret = rsp.op_ret; - gf_log (this->name, (op_ret) ? GF_LOG_ERROR : GF_LOG_DEBUG, - "Received lock %s from uuid: %s", (op_ret) ? "RJT" : "ACC", - uuid_utoa (rsp.uuid)); + if (op_ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_LOCK_FROM_UUID_REJCT, + "Received lock RJT from uuid: %s", + uuid_utoa (rsp.uuid)); + } else { + gf_msg_debug (this->name, 0, + "Received lock ACC from uuid: %s", + uuid_utoa (rsp.uuid)); + } rcu_read_lock (); ret = (glusterd_peerinfo_find (rsp.uuid, NULL) == NULL); rcu_read_unlock (); if (ret) { - gf_log (this->name, GF_LOG_CRITICAL, + gf_msg (this->name, GF_LOG_CRITICAL, 0, + GD_MSG_RESP_FROM_UNKNOWN_PEER, "cluster lock response received from unknown peer: %s." "Ignoring response", uuid_utoa (rsp.uuid)); err_str = "cluster lock response received from unknown peer"; @@ -802,7 +828,8 @@ glusterd_mgmt_v3_lock_peers_cbk_fn (struct rpc_req *req, struct iovec *iov, frame->cookie = NULL; if (-1 == req->rpc_status) { - gf_log (this->name, GF_LOG_ERROR, "Lock response is not " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_NO_LOCK_RESP_FROM_PEER, "Lock response is not " "received from one of the peer"); err_str = "Lock response is not received from one of the peer"; glusterd_set_opinfo (err_str, ENETRESET, -1); @@ -813,7 +840,8 @@ glusterd_mgmt_v3_lock_peers_cbk_fn (struct rpc_req *req, struct iovec *iov, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_v3_lock_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "Failed to decode " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RES_DECODE_FAIL, "Failed to decode " "mgmt_v3 lock response received from peer"); err_str = "Failed to decode mgmt_v3 lock response received from" " peer"; @@ -826,16 +854,24 @@ glusterd_mgmt_v3_lock_peers_cbk_fn (struct rpc_req *req, struct iovec *iov, txn_id = &rsp.txn_id; - gf_log (this->name, (op_ret) ? GF_LOG_ERROR : GF_LOG_DEBUG, - "Received mgmt_v3 lock %s from uuid: %s", - (op_ret) ? "RJT" : "ACC", uuid_utoa (rsp.uuid)); + if (op_ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_MGMTV3_LOCK_FROM_UUID_REJCT, + "Received mgmt_v3 lock RJT from uuid: %s", + uuid_utoa (rsp.uuid)); + } else { + gf_msg_debug (this->name, 0, + "Received mgmt_v3 lock ACC from uuid: %s", + uuid_utoa (rsp.uuid)); + } rcu_read_lock (); ret = (glusterd_peerinfo_find (rsp.uuid, NULL) == NULL); rcu_read_unlock (); if (ret) { - gf_log (this->name, GF_LOG_CRITICAL, + gf_msg (this->name, GF_LOG_CRITICAL, 0, + GD_MSG_RESP_FROM_UNKNOWN_PEER, "mgmt_v3 lock response received " "from unknown peer: %s. Ignoring response", uuid_utoa (rsp.uuid)); @@ -921,10 +957,16 @@ glusterd_mgmt_v3_unlock_peers_cbk_fn (struct rpc_req *req, struct iovec *iov, txn_id = &rsp.txn_id; - gf_log (this->name, (op_ret) ? GF_LOG_ERROR : GF_LOG_DEBUG, - "Received mgmt_v3 unlock %s from uuid: %s", - (op_ret) ? "RJT" : "ACC", - uuid_utoa (rsp.uuid)); + if (op_ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_MGMTV3_UNLOCK_FROM_UUID_REJCT, + "Received mgmt_v3 unlock RJT from uuid: %s", + uuid_utoa (rsp.uuid)); + } else { + gf_msg_debug (this->name, 0, + "Received mgmt_v3 unlock ACC from uuid: %s", + uuid_utoa (rsp.uuid)); + } rcu_read_lock (); ret = (glusterd_peerinfo_find (rsp.uuid, NULL) == NULL); @@ -1017,9 +1059,16 @@ __glusterd_cluster_unlock_cbk (struct rpc_req *req, struct iovec *iov, op_ret = rsp.op_ret; - gf_log (this->name, (op_ret) ? GF_LOG_ERROR : GF_LOG_DEBUG, - "Received unlock %s from uuid: %s", - (op_ret)?"RJT":"ACC", uuid_utoa (rsp.uuid)); + if (op_ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_UNLOCK_FROM_UUID_REJCT, + "Received unlock RJT from uuid: %s", + uuid_utoa (rsp.uuid)); + } else { + gf_msg_debug (this->name, 0, + "Received unlock ACC from uuid: %s", + uuid_utoa (rsp.uuid)); + } rcu_read_lock (); ret = (glusterd_peerinfo_find (rsp.uuid, NULL) == NULL); @@ -1095,7 +1144,8 @@ __glusterd_stage_op_cbk (struct rpc_req *req, struct iovec *iov, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_stage_op_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "Failed to decode stage " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RES_DECODE_FAIL, "Failed to decode stage " "response received from peer"); rsp.op_ret = -1; rsp.op_errno = EINVAL; @@ -1114,7 +1164,8 @@ __glusterd_stage_op_cbk (struct rpc_req *req, struct iovec *iov, rsp.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize rsp-buffer to dictionary"); event_type = GD_OP_EVENT_RCVD_RJT; @@ -1127,18 +1178,26 @@ __glusterd_stage_op_cbk (struct rpc_req *req, struct iovec *iov, out: op_ret = rsp.op_ret; - gf_log (this->name, (op_ret) ? GF_LOG_ERROR : GF_LOG_DEBUG, - "Received stage %s from uuid: %s", - (op_ret) ? "RJT" : "ACC", uuid_utoa (rsp.uuid)); + if (op_ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_STAGE_FROM_UUID_REJCT, + "Received stage RJT from uuid: %s", + uuid_utoa (rsp.uuid)); + } else { + gf_msg_debug (this->name, 0, + "Received stage ACC from uuid: %s", + uuid_utoa (rsp.uuid)); + } ret = dict_get_bin (dict, "transaction_id", (void **)&txn_id); - gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s", + gf_msg_debug (this->name, 0, "transaction ID = %s", uuid_utoa (*txn_id)); rcu_read_lock (); peerinfo = glusterd_peerinfo_find (rsp.uuid, NULL); if (peerinfo == NULL) { - gf_log (this->name, GF_LOG_CRITICAL, "Stage response received " + gf_msg (this->name, GF_LOG_CRITICAL, 0, + GD_MSG_RESP_FROM_UNKNOWN_PEER, "Stage response received " "from unknown peer: %s. Ignoring response.", uuid_utoa (rsp.uuid)); } @@ -1234,7 +1293,8 @@ __glusterd_commit_op_cbk (struct rpc_req *req, struct iovec *iov, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_commit_op_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "Failed to decode commit " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RES_DECODE_FAIL, "Failed to decode commit " "response received from peer"); rsp.op_ret = -1; rsp.op_errno = EINVAL; @@ -1254,7 +1314,8 @@ __glusterd_commit_op_cbk (struct rpc_req *req, struct iovec *iov, rsp.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize rsp-buffer to dictionary"); event_type = GD_OP_EVENT_RCVD_RJT; @@ -1266,18 +1327,25 @@ __glusterd_commit_op_cbk (struct rpc_req *req, struct iovec *iov, op_ret = rsp.op_ret; - gf_log (this->name, (op_ret) ? GF_LOG_ERROR : GF_LOG_DEBUG, - "Received commit %s from uuid: %s", - (op_ret)?"RJT":"ACC", uuid_utoa (rsp.uuid)); - + if (op_ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_COMMIT_FROM_UUID_REJCT, + "Received commit RJT from uuid: %s", + uuid_utoa (rsp.uuid)); + } else { + gf_msg_debug (this->name, 0, + "Received commit ACC from uuid: %s", + uuid_utoa (rsp.uuid)); + } ret = dict_get_bin (dict, "transaction_id", (void **)&txn_id); - gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s", + gf_msg_debug (this->name, 0, "transaction ID = %s", uuid_utoa (*txn_id)); rcu_read_lock (); peerinfo = glusterd_peerinfo_find (rsp.uuid, NULL); if (peerinfo == NULL) { - gf_log (this->name, GF_LOG_CRITICAL, "Commit response for " + gf_msg (this->name, GF_LOG_CRITICAL, 0, + GD_MSG_RESP_FROM_UNKNOWN_PEER, "Commit response for " "'Volume %s' received from unknown peer: %s", gd_op_list[opinfo.op], uuid_utoa (rsp.uuid)); } @@ -1420,7 +1488,7 @@ glusterd_rpc_probe (call_frame_t *frame, xlator_t *this, out: GF_FREE (req.hostname); - gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug ("glusterd", 0, "Returning %d", ret); return ret; } @@ -1466,7 +1534,8 @@ glusterd_rpc_friend_add (call_frame_t *frame, xlator_t *this, ret = glusterd_add_volumes_to_export_dict (&peer_data); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Unable to add list of volumes " "in the peer_data dict for handshake"); goto out; @@ -1484,7 +1553,8 @@ glusterd_rpc_friend_add (call_frame_t *frame, xlator_t *this, if (priv->op_version >= GD_OP_VERSION_3_6_0) { ret = glusterd_add_missed_snaps_to_export_dict (peer_data); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_MISSED_SNAP_LIST_STORE_FAIL, "Unable to add list of missed snapshots " "in the peer_data dict for handshake"); goto out; @@ -1492,7 +1562,8 @@ glusterd_rpc_friend_add (call_frame_t *frame, xlator_t *this, ret = glusterd_add_snapshots_to_export_dict (peer_data); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SNAP_LIST_SET_FAIL, "Unable to add list of snapshots " "in the peer_data dict for handshake"); goto out; @@ -1517,7 +1588,7 @@ out: if (peer_data) dict_unref (peer_data); - gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug ("glusterd", 0, "Returning %d", ret); return ret; } @@ -1565,7 +1636,7 @@ glusterd_rpc_friend_remove (call_frame_t *frame, xlator_t *this, out: GF_FREE (req.hostname); - gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug ("glusterd", 0, "Returning %d", ret); return ret; } @@ -1611,7 +1682,7 @@ glusterd_rpc_friend_update (call_frame_t *frame, xlator_t *this, out: GF_FREE (req.friends.friends_val); - gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug ("glusterd", 0, "Returning %d", ret); return ret; } @@ -1645,7 +1716,7 @@ glusterd_cluster_lock (call_frame_t *frame, xlator_t *this, this, glusterd_cluster_lock_cbk, (xdrproc_t)xdr_gd1_mgmt_cluster_lock_req); out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug ("glusterd", 0, "Returning %d", ret); return ret; } @@ -1680,7 +1751,8 @@ glusterd_mgmt_v3_lock_peers (call_frame_t *frame, xlator_t *this, ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, &req.dict.dict_len); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to serialize dict " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SERL_LENGTH_GET_FAIL, "Failed to serialize dict " "to request buffer"); goto out; } @@ -1689,11 +1761,12 @@ glusterd_mgmt_v3_lock_peers (call_frame_t *frame, xlator_t *this, ret = dict_get_bin (dict, "transaction_id", (void **)&txn_id); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_TRANS_ID_GET_FAIL, "Failed to get transaction id."); goto out; } else { - gf_log (this->name, GF_LOG_DEBUG, + gf_msg_debug (this->name, 0, "Transaction_id = %s", uuid_utoa (*txn_id)); gf_uuid_copy (req.txn_id, *txn_id); } @@ -1718,7 +1791,7 @@ glusterd_mgmt_v3_lock_peers (call_frame_t *frame, xlator_t *this, this, glusterd_mgmt_v3_lock_peers_cbk, (xdrproc_t)xdr_gd1_mgmt_v3_lock_req); out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -1753,7 +1826,9 @@ glusterd_mgmt_v3_unlock_peers (call_frame_t *frame, xlator_t *this, ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, &req.dict.dict_len); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to serialize dict " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SERL_LENGTH_GET_FAIL, + "Failed to serialize dict " "to request buffer"); goto out; } @@ -1762,11 +1837,12 @@ glusterd_mgmt_v3_unlock_peers (call_frame_t *frame, xlator_t *this, ret = dict_get_bin (dict, "transaction_id", (void **)&txn_id); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_TRANS_ID_GET_FAIL, "Failed to get transaction id."); goto out; } else { - gf_log (this->name, GF_LOG_DEBUG, + gf_msg_debug (this->name, 0, "Transaction_id = %s", uuid_utoa (*txn_id)); gf_uuid_copy (req.txn_id, *txn_id); } @@ -1792,7 +1868,7 @@ glusterd_mgmt_v3_unlock_peers (call_frame_t *frame, xlator_t *this, (xdrproc_t) xdr_gd1_mgmt_v3_unlock_req); out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -1826,7 +1902,7 @@ glusterd_cluster_unlock (call_frame_t *frame, xlator_t *this, this, glusterd_cluster_unlock_cbk, (xdrproc_t)xdr_gd1_mgmt_cluster_unlock_req); out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this ? this->name : "glusterd", 0, "Returning %d", ret); return ret; } @@ -1864,7 +1940,9 @@ glusterd_stage_op (call_frame_t *frame, xlator_t *this, ret = dict_allocate_and_serialize (dict, &req.buf.buf_val, &req.buf.buf_len); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to serialize dict " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SERL_LENGTH_GET_FAIL, + "Failed to serialize dict " "to request buffer"); goto out; } @@ -1884,7 +1962,7 @@ out: if ((_gf_true == is_alloc) && req.buf.buf_val) GF_FREE (req.buf.buf_val); - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -1921,7 +1999,9 @@ glusterd_commit_op (call_frame_t *frame, xlator_t *this, ret = dict_allocate_and_serialize (dict, &req.buf.buf_val, &req.buf.buf_len); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to serialize dict to " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SERL_LENGTH_GET_FAIL, + "Failed to serialize dict to " "request buffer"); goto out; } @@ -1940,7 +2020,7 @@ out: if ((_gf_true == is_alloc) && req.buf.buf_val) GF_FREE (req.buf.buf_val); - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -1984,7 +2064,9 @@ __glusterd_brick_op_cbk (struct rpc_req *req, struct iovec *iov, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_brick_op_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "Failed to decode brick op " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RES_DECODE_FAIL, + "Failed to decode brick op " "response received"); rsp.op_ret = -1; rsp.op_errno = EINVAL; @@ -2001,7 +2083,9 @@ __glusterd_brick_op_cbk (struct rpc_req *req, struct iovec *iov, rsp.output.output_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "Failed to " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, + "Failed to " "unserialize rsp-buffer to dictionary"); event_type = GD_OP_EVENT_RCVD_RJT; goto out; @@ -2018,7 +2102,8 @@ __glusterd_brick_op_cbk (struct rpc_req *req, struct iovec *iov, index = node->index; ret = dict_set_int32 (dict, "index", index); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Error setting index on brick status rsp dict"); rsp.op_ret = -1; event_type = GD_OP_EVENT_RCVD_RJT; @@ -2030,7 +2115,7 @@ out: if (req_ctx && req_ctx->dict) { ret = dict_get_bin (req_ctx->dict, "transaction_id", (void **)&txn_id); - gf_log (this->name, GF_LOG_DEBUG, + gf_msg_debug (this->name, 0, "transaction ID = %s", uuid_utoa (*txn_id)); } @@ -2098,14 +2183,15 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this, CDS_INIT_LIST_HEAD (&opinfo.pending_bricks); ret = dict_get_bin (req_ctx->dict, "transaction_id", (void **)&txn_id); - gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s", + gf_msg_debug (this->name, 0, "transaction ID = %s", uuid_utoa (*txn_id)); ret = glusterd_op_bricks_select (req_ctx->op, req_ctx->dict, &op_errstr, &opinfo.pending_bricks, NULL); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to select bricks " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BRICK_SELECT_FAIL, "Failed to select bricks " "while performing brick op during 'Volume %s'", gd_op_list[opinfo.op]); opinfo.op_errstr = op_errstr; @@ -2133,7 +2219,9 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this, req_ctx->dict); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BRICK_OP_PAYLOAD_BUILD_FAIL, + "Failed to " "build brick op payload during " "'Volume %s'", gd_op_list[req_ctx->op]); goto out; @@ -2165,7 +2253,8 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this, } ret = -1; - gf_log (this->name, GF_LOG_ERROR, "Brick Op failed " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RPC_FAILURE, "Brick Op failed " "due to rpc failure."); goto out; } @@ -2186,7 +2275,7 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this, glusterd_pending_node_put_rpc (pending_node); } - gf_log (this->name, GF_LOG_DEBUG, "Sent brick op req for operation " + gf_msg_trace (this->name, 0, "Sent brick op req for operation " "'Volume %s' to %d bricks", gd_op_list[req_ctx->op], pending_bricks); opinfo.brick_pending_count = pending_bricks; @@ -2197,7 +2286,9 @@ out: txn_id, data); opinfo.op_ret = ret; } - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + + gf_msg_debug (this ? this->name : "glusterd", 0, "Returning %d", ret); + return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 017193fcc53..d801a13fc09 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -117,7 +117,9 @@ glusterd_check_brick_order(dict_t *dict, char *err_str) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, + "Unable to get volume name"); goto out; } @@ -125,20 +127,24 @@ glusterd_check_brick_order(dict_t *dict, char *err_str) if (ret) { snprintf (err_str, 512, "Unable to get type of volume %s", volname); - gf_log (this->name, GF_LOG_WARNING, "%s", err_str); + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_DICT_GET_FAILED, + "%s", err_str); goto out; } ret = dict_get_str (dict, "bricks", &brick_list); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Bricks check : Could not " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Bricks check : Could not " "retrieve bricks list"); goto out; } ret = dict_get_int32 (dict, "count", &brick_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Bricks check : Could not " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Bricks check : Could not " "retrieve brick count"); goto out; } @@ -146,16 +152,18 @@ glusterd_check_brick_order(dict_t *dict, char *err_str) if (type != GF_CLUSTER_TYPE_DISPERSE) { ret = dict_get_int32 (dict, "replica-count", &sub_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Bricks check : Could" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Bricks check : Could" " not retrieve replica count"); goto out; } - gf_log (this->name, GF_LOG_DEBUG, "Replicate cluster type " + gf_msg_debug (this->name, 0, "Replicate cluster type " "found. Checking brick order."); } else { ret = dict_get_int32 (dict, "disperse-count", &sub_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Bricks check : Could" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Bricks check : Could" " not retrieve disperse count"); goto out; } @@ -177,14 +185,17 @@ glusterd_check_brick_order(dict_t *dict, char *err_str) ret = getaddrinfo (brick, NULL, NULL, &ai_info); if (ret != 0) { ret = 0; - gf_log (this->name, GF_LOG_ERROR, "unable to resolve " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_HOSTNAME_RESOLVE_FAIL, + "unable to resolve " "host name"); goto out; } ai_list_tmp1 = malloc (sizeof (addrinfo_list_t)); if (ai_list_tmp1 == NULL) { ret = 0; - gf_log (this->name, GF_LOG_ERROR, "failed to allocate " + gf_msg (this->name, GF_LOG_ERROR, ENOMEM, + GD_MSG_NO_MEMORY, "failed to allocate " "memory"); goto out; } @@ -222,18 +233,20 @@ glusterd_check_brick_order(dict_t *dict, char *err_str) } ++j; } - gf_log (this->name, GF_LOG_DEBUG, "Brick order okay"); + gf_msg_debug (this->name, 0, "Brick order okay"); ret = 0; goto out; check_failed: - gf_log (this->name, GF_LOG_ERROR, "Failed bad brick order check"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BAD_BRKORDER_CHECK_FAIL, "Failed bad brick order check"); snprintf (err_str, sizeof (failed_string), failed_string); ret = -1; goto out; found_bad_brick_order: - gf_log (this->name, GF_LOG_INFO, "Bad brick order found"); + gf_msg (this->name, GF_LOG_INFO, 0, + GD_MSG_BAD_BRKORDER, "Bad brick order found"); snprintf (err_str, sizeof (found_string), found_string); ret = -1; out: @@ -281,11 +294,12 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) req->rpc_err = GARBAGE_ARGS; snprintf (err_str, sizeof (err_str), "Failed to decode request " "received from cli"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_REQ_DECODE_FAIL, "%s", err_str); goto out; } - gf_log (this->name, GF_LOG_DEBUG, "Received create volume req"); + gf_msg_debug (this->name, 0, "Received create volume req"); if (cli_req.dict.dict_len) { /* Unserialize the dictionary */ @@ -295,7 +309,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (err_str, sizeof (err_str), "Unable to decode " @@ -311,14 +326,16 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get volume " "name"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } if ((ret = glusterd_check_volume_exists (volname))) { snprintf (err_str, sizeof (err_str), "Volume %s already exists", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, EEXIST, + GD_MSG_VOL_ALREADY_EXIST, "%s", err_str); goto out; } @@ -326,7 +343,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get brick count" " for volume %s", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } @@ -334,7 +352,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get type of " "volume %s", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } @@ -342,19 +361,22 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get " "transport-type of volume %s", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } ret = dict_get_str (dict, "bricks", &bricks); if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get bricks for " "volume %s", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } if (!dict_get (dict, "force")) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get 'force' flag"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get 'force' flag"); goto out; } @@ -364,7 +386,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to set volume " "id of volume %s", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "%s", err_str); goto out; } free_ptr = NULL; @@ -375,7 +398,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) username = gf_strdup (uuid_utoa (tmp_uuid)); ret = dict_set_dynstr (dict, "internal-username", username); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to set username for " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set username for " "volume %s", volname); goto out; } @@ -384,7 +408,8 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) password = gf_strdup (uuid_utoa (tmp_uuid)); ret = dict_set_dynstr (dict, "internal-password", password); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to set password for " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set password for " "volume %s", volname); goto out; } @@ -437,7 +462,8 @@ __glusterd_handle_cli_start_volume (rpcsvc_request_t *req) snprintf (errstr, sizeof (errstr), "Failed to decode message " "received from cli"); req->rpc_err = GARBAGE_ARGS; - gf_log (this->name, sizeof (errstr), "%s", errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_REQ_DECODE_FAIL, "%s", errstr); goto out; } @@ -449,7 +475,8 @@ __glusterd_handle_cli_start_volume (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (errstr, sizeof (errstr), "Unable to decode " @@ -461,12 +488,13 @@ __glusterd_handle_cli_start_volume (rpcsvc_request_t *req) ret = dict_get_str (dict, "volname", &volname); if (ret) { snprintf (errstr, sizeof (errstr), "Unable to get volume name"); - gf_log (this->name, GF_LOG_ERROR, "%s", errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", errstr); goto out; } - gf_log (this->name, GF_LOG_DEBUG, "Received start vol req" - " for volume %s", volname); + gf_msg_debug (this->name, 0, "Received start vol req" + " for volume %s", volname); ret = glusterd_op_begin_synctask (req, GD_OP_START_VOLUME, dict); @@ -510,7 +538,8 @@ __glusterd_handle_cli_stop_volume (rpcsvc_request_t *req) snprintf (err_str, sizeof (err_str), "Failed to decode message " "received from cli"); req->rpc_err = GARBAGE_ARGS; - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_REQ_DECODE_FAIL, "%s", err_str); goto out; } if (cli_req.dict.dict_len) { @@ -521,7 +550,8 @@ __glusterd_handle_cli_stop_volume (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (err_str, sizeof (err_str), "Unable to decode " @@ -535,11 +565,12 @@ __glusterd_handle_cli_stop_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Failed to get volume " "name"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } - gf_log (this->name, GF_LOG_DEBUG, "Received stop vol req " + gf_msg_debug (this->name, 0, "Received stop vol req " "for volume %s", dup_volname); ret = glusterd_op_begin_synctask (req, GD_OP_STOP_VOLUME, dict); @@ -585,7 +616,8 @@ __glusterd_handle_cli_delete_volume (rpcsvc_request_t *req) if (ret < 0) { snprintf (err_str, sizeof (err_str), "Failed to decode request " "received from cli"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_REQ_DECODE_FAIL, "%s", err_str); req->rpc_err = GARBAGE_ARGS; goto out; } @@ -598,7 +630,8 @@ __glusterd_handle_cli_delete_volume (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (err_str, sizeof (err_str), "Unable to decode " @@ -611,12 +644,13 @@ __glusterd_handle_cli_delete_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Failed to get volume " "name"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); req->rpc_err = GARBAGE_ARGS; goto out; } - gf_log (this->name, GF_LOG_DEBUG, "Received delete vol req" + gf_msg_debug (this->name, 0, "Received delete vol req" "for volume %s", volname); ret = glusterd_op_begin_synctask (req, GD_OP_DELETE_VOLUME, dict); @@ -727,7 +761,8 @@ __glusterd_handle_cli_heal_volume (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (op_errstr, sizeof (op_errstr), @@ -742,7 +777,8 @@ __glusterd_handle_cli_heal_volume (rpcsvc_request_t *req) if (ret) { snprintf (op_errstr, sizeof (op_errstr), "Unable to find " "volume name"); - gf_log (this->name, GF_LOG_ERROR, "%s", op_errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", op_errstr); goto out; } @@ -786,7 +822,8 @@ out: if (op_errstr[0] == '\0') snprintf (op_errstr, sizeof (op_errstr), "operation failed"); - gf_log (this->name, GF_LOG_ERROR, "%s", op_errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_GLUSTERD_OP_FAILED, "%s", op_errstr); ret = glusterd_op_send_cli_response (cli_op, ret, 0, req, dict, op_errstr); } @@ -836,7 +873,8 @@ __glusterd_handle_cli_statedump_volume (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (err_str, sizeof (err_str), "Unable to " @@ -848,14 +886,16 @@ __glusterd_handle_cli_statedump_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get the volume " "name"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } ret = dict_get_str (dict, "options", &options); if (ret) { snprintf (err_str, sizeof (err_str), "Unable to get options"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } @@ -863,7 +903,8 @@ __glusterd_handle_cli_statedump_volume (rpcsvc_request_t *req) if (ret) { snprintf (err_str , sizeof (err_str), "Unable to get option " "count"); - gf_log (this->name, GF_LOG_ERROR, "%s", err_str); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", err_str); goto out; } @@ -1030,7 +1071,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } @@ -1046,28 +1088,34 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, ret = dict_get_int32 (dict, "count", &brick_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get brick count " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get brick count " "for volume %s", volname); goto out; } ret = dict_get_str (dict, "volume-id", &volume_uuid_str); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume id of " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume id of " "volume %s", volname); goto out; } ret = gf_uuid_parse (volume_uuid_str, volume_uuid); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to parse volume id of" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_UUID_PARSE_FAIL, + "Unable to parse volume id of" " volume %s", volname); goto out; } ret = dict_get_str (dict, "bricks", &bricks); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get bricks for " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, + "Unable to get bricks for " "volume %s", volname); goto out; } @@ -1115,7 +1163,9 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, ret = glusterd_resolve_brick (brick_info); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_RESOLVE_BRICK, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RESOLVE_BRICK_FAIL, + FMTSTR_RESOLVE_BRICK, brick_info->hostname, brick_info->path); goto out; } @@ -1142,7 +1192,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, (brick_info->path, brick_info->hostname, brick_info->mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BRICK_MOUNTDIR_GET_FAIL, "Failed to get brick mount_dir"); goto out; } @@ -1152,7 +1203,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, ret = dict_set_dynstr_with_alloc (rsp_dict, key, brick_info->mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set %s", key); goto out; } @@ -1173,7 +1225,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, if (ret) { snprintf (msg, sizeof (msg), "Unable to get type of " "volume %s", volname); - gf_log (this->name, GF_LOG_WARNING, "%s", msg); + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_DICT_GET_FAILED, "%s", msg); goto out; } @@ -1183,7 +1236,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, (type == GF_CLUSTER_TYPE_DISPERSE)) { ret = glusterd_check_brick_order(dict, msg); if (ret) { - gf_log(this->name, GF_LOG_ERROR, "Not " + gf_msg(this->name, GF_LOG_ERROR, 0, + GD_MSG_BAD_BRKORDER, "Not " "creating volume because of bad " "brick order"); goto out; @@ -1194,7 +1248,8 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, ret = dict_set_int32 (rsp_dict, "brick_count", local_brick_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set local_brick_count"); goto out; } @@ -1207,7 +1262,7 @@ out: gf_log (this->name, GF_LOG_ERROR, "%s", msg); *op_errstr = gf_strdup (msg); } - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -1226,13 +1281,15 @@ glusterd_op_stop_volume_args_get (dict_t *dict, char** volname, int *flags) ret = dict_get_str (dict, "volname", volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } ret = dict_get_int32 (dict, "flags", flags); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get flags"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get flags"); goto out; } out: @@ -1250,19 +1307,22 @@ glusterd_op_statedump_volume_args_get (dict_t *dict, char **volname, ret = dict_get_str (dict, "volname", volname); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get volname"); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volname"); goto out; } ret = dict_get_str (dict, "options", options); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get options"); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get options"); goto out; } ret = dict_get_int32 (dict, "option_cnt", option_cnt); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get option count"); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get option count"); goto out; } @@ -1311,7 +1371,8 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_CHECK_VOL_EXISTS, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLINFO_GET_FAIL, FMTSTR_CHECK_VOL_EXISTS, volname); goto out; } @@ -1333,7 +1394,8 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, brick_count++; ret = glusterd_resolve_brick (brickinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_RESOLVE_BRICK, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RESOLVE_BRICK_FAIL, FMTSTR_RESOLVE_BRICK, brickinfo->hostname, brickinfo->path); goto out; } @@ -1396,7 +1458,8 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, (brickinfo->path, brickinfo->hostname, brickinfo->mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BRICK_MOUNTDIR_GET_FAIL, "Failed to get brick mount_dir"); goto out; } @@ -1406,7 +1469,8 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, ret = dict_set_dynstr_with_alloc (rsp_dict, key, brickinfo->mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set %s", key); goto out; } @@ -1433,7 +1497,8 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, ret = dict_set_int32 (rsp_dict, "brick_count", local_brick_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set local_brick_count"); goto out; } @@ -1471,7 +1536,8 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr) if (!exists) { snprintf (msg, sizeof (msg), FMTSTR_CHECK_VOL_EXISTS, volname); - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "%s", msg); ret = -1; goto out; } @@ -1479,7 +1545,8 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr) ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { snprintf (msg, sizeof (msg), FMTSTR_CHECK_VOL_EXISTS, volname); - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLINFO_GET_FAIL, "%s", msg); goto out; } @@ -1494,7 +1561,8 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr) if (_gf_false == glusterd_is_volume_started (volinfo)) { snprintf (msg, sizeof(msg), "Volume %s " "is not in the started state", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_STARTED, "%s", msg); ret = -1; goto out; } @@ -1519,14 +1587,15 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr) if (glusterd_is_defrag_on (volinfo)) { snprintf (msg, sizeof(msg), "rebalance session is " "in progress for the volume '%s'", volname); - gf_log (this->name, GF_LOG_WARNING, "%s", msg); + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_OIP, "%s", msg); ret = -1; goto out; } out: if (msg[0] != 0) *op_errstr = gf_strdup (msg); - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -1546,7 +1615,8 @@ glusterd_op_stage_delete_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } @@ -1595,7 +1665,7 @@ out: gf_log (this->name, GF_LOG_ERROR, "%s", msg); *op_errstr = gf_strdup (msg); } - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -1699,14 +1769,16 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) priv = this->private; if (!priv) { ret = -1; - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_PRIV_NULL, "priv is NULL"); goto out; } ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get volume name"); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } @@ -1714,7 +1786,8 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) if (ret) { ret = -1; snprintf (msg, sizeof (msg), "Volume %s does not exist", volname); - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1727,7 +1800,8 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) ret = -1; snprintf (msg, sizeof (msg), "Volume %s is not started.", volname); - gf_log (THIS->name, GF_LOG_WARNING, "%s", msg); + gf_msg (THIS->name, GF_LOG_WARNING, 0, + GD_MSG_VOL_NOT_STARTED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1745,7 +1819,8 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) snprintf (msg, sizeof (msg), "Self-heal-daemon is " "disabled. Heal will not be triggered on volume %s", volname); - gf_log (this->name, GF_LOG_WARNING, "%s", msg); + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_SELF_HEALD_DISABLED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1756,7 +1831,7 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) ret = 0; out: - gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug ("glusterd", 0, "Returning %d", ret); return ret; } @@ -1820,7 +1895,7 @@ glusterd_op_stage_statedump_volume (dict_t *dict, char **op_errstr) out: if (ret && msg[0] != '\0') *op_errstr = gf_strdup (msg); - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -1838,7 +1913,8 @@ glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "volname", &volname); if (ret) { snprintf (msg, sizeof(msg), "Failed to get volume name"); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1846,7 +1922,8 @@ glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "path", &path); if (ret) { snprintf (msg, sizeof(msg), "Failed to get path"); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1854,7 +1931,8 @@ glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "kind", &kind); if (ret) { snprintf (msg, sizeof(msg), "Failed to get kind"); - gf_log ("", GF_LOG_ERROR, "%s", msg); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1862,7 +1940,8 @@ glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "type", &type); if (ret) { snprintf (msg, sizeof(msg), "Failed to get type"); - gf_log ("", GF_LOG_ERROR, "%s", msg); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1871,7 +1950,8 @@ glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr) if (ret) { snprintf (msg, sizeof(msg), "Volume %s does not exist", volname); - gf_log ("", GF_LOG_ERROR, "%s", msg); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } @@ -1883,14 +1963,15 @@ glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr) if (!glusterd_is_volume_started (volinfo)) { snprintf (msg, sizeof(msg), "Volume %s is not started", volname); - gf_log ("", GF_LOG_ERROR, "%s", msg); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_STARTED, "%s", msg); *op_errstr = gf_strdup (msg); goto out; } ret = 0; out: - gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug ("glusterd", 0, "Returning %d", ret); return ret; } @@ -1930,7 +2011,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = glusterd_volinfo_new (&volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, ENOMEM, + GD_MSG_NO_MEMORY, "Unable to allocate memory for volinfo"); goto out; } @@ -1938,7 +2020,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } @@ -1947,21 +2030,24 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "type", &volinfo->type); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get type of volume" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get type of volume" " %s", volname); goto out; } ret = dict_get_int32 (dict, "count", &volinfo->brick_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get brick count of" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get brick count of" " volume %s", volname); goto out; } ret = dict_get_int32 (dict, "port", &volinfo->port); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get port"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get port"); goto out; } @@ -1969,7 +2055,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "bricks", &bricks); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get bricks for " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get bricks for " "volume %s", volname); goto out; } @@ -1983,7 +2070,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "replica-count", &volinfo->replica_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get " "replica count for volume %s", volname); goto out; } @@ -1993,7 +2081,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "stripe-count", &volinfo->stripe_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get stripe" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get stripe" " count for volume %s", volname); goto out; } @@ -2001,14 +2090,16 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "stripe-count", &volinfo->stripe_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get stripe" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get stripe" " count for volume %s", volname); goto out; } ret = dict_get_int32 (dict, "replica-count", &volinfo->replica_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get " "replica count for volume %s", volname); goto out; } @@ -2018,19 +2109,22 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_int32 (dict, "disperse-count", &volinfo->disperse_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get " "disperse count for volume %s", volname); goto out; } ret = dict_get_int32 (dict, "redundancy-count", &volinfo->redundancy_count); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get " "redundancy count for volume %s", volname); goto out; } if (priv->op_version < GD_OP_VERSION_3_6_0) { - gf_log (this->name, GF_LOG_ERROR, "Disperse volume " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_UNSUPPORTED_VERSION, "Disperse volume " "needs op-version 3.6.0 or higher"); ret = -1; goto out; @@ -2053,27 +2147,31 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "transport", &trans_type); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get transport type of volume %s", volname); goto out; } ret = dict_get_str (dict, "volume-id", &str); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume-id of volume %s", volname); goto out; } ret = gf_uuid_parse (str, volinfo->volume_id); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_UUID_PARSE_FAIL, "unable to parse uuid %s of volume %s", str, volname); goto out; } ret = dict_get_str (dict, "internal-username", &username); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "unable to get internal username of volume %s", volname); goto out; @@ -2082,7 +2180,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, "internal-password", &password); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "unable to get internal password of volume %s", volname); goto out; @@ -2119,7 +2218,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) ret = glusterd_resolve_brick (brickinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_RESOLVE_BRICK, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_RESOLVE_BRICK_FAIL, FMTSTR_RESOLVE_BRICK, brickinfo->hostname, brickinfo->path); goto out; } @@ -2132,7 +2232,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) snprintf (key, sizeof(key), "brick%d.mount_dir", i); ret = dict_get_str (dict, key, &brick_mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s not present", key); goto out; } @@ -2145,7 +2246,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) && brickinfo->vg[0]) { ret = glusterd_is_valid_vg (brickinfo, 0, msg); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "%s", msg); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_INVALID_VG, "%s", msg); goto out; } @@ -2244,12 +2346,14 @@ glusterd_start_volume (glusterd_volinfo_t *volinfo, int flags, ret = glusterd_store_volinfo (volinfo, verincrement); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to store volinfo of " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLINFO_SET_FAIL, + "Failed to store volinfo of " "%s volume", volinfo->volname); goto out; } out: - gf_log (this->name, GF_LOG_TRACE, "returning %d ", ret); + gf_msg_trace (this->name, 0, "returning %d ", ret); return ret; } @@ -2279,7 +2383,8 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr) ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_CHECK_VOL_EXISTS, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, FMTSTR_CHECK_VOL_EXISTS, volname); goto out; } @@ -2302,7 +2407,8 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr) ret = dict_get_str (dict, key, &brick_mount_dir); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "%s not present", key); goto out; } @@ -2326,7 +2432,7 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr) ret = glusterd_svcs_manager (volinfo); out: - gf_log (this->name, GF_LOG_TRACE, "returning %d ", ret); + gf_msg_trace (this->name, 0, "returning %d ", ret); return ret; } @@ -2348,7 +2454,8 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo) cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { ret = glusterd_brick_stop (volinfo, brickinfo, _gf_false); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to stop " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BRICK_STOP_FAIL, "Failed to stop " "brick (%s)", brickinfo->path); goto out; } @@ -2358,7 +2465,8 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo) ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to store volinfo of " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLINFO_SET_FAIL, "Failed to store volinfo of " "%s volume", volinfo->volname); goto out; } @@ -2367,7 +2475,7 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo) GLUSTERFS_GET_AUX_MOUNT_PIDFILE (pidfile, volinfo->volname); if (!gf_is_service_running (pidfile, NULL)) { - gf_log (this->name, GF_LOG_DEBUG, "Aux mount of volume %s " + gf_msg_debug (this->name, 0, "Aux mount of volume %s " "absent", volinfo->volname); } else { GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mountdir, volinfo->volname, @@ -2375,9 +2483,10 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo) ret = gf_umount_lazy (this->name, mountdir, 0); if (ret) - gf_log (this->name, GF_LOG_ERROR, - "umount on %s failed, reason : %s", - mountdir, strerror (errno)); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_UNOUNT_FAILED, + "umount on %s failed", + mountdir); } if (!volinfo->is_snap_volume) { @@ -2389,7 +2498,8 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo) ret = glusterd_svcs_manager (volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to notify graph " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_GRAPH_CHANGE_NOTIFY_FAIL, "Failed to notify graph " "change for %s volume", volinfo->volname); goto out; @@ -2417,14 +2527,16 @@ glusterd_op_stop_volume (dict_t *dict) ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_CHECK_VOL_EXISTS, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, FMTSTR_CHECK_VOL_EXISTS, volname); goto out; } ret = glusterd_stop_volume (volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to stop %s volume", + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_STOP_FAILED, "Failed to stop %s volume", volname); goto out; } @@ -2448,13 +2560,15 @@ glusterd_op_delete_volume (dict_t *dict) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } ret = glusterd_volinfo_find (volname, &volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, FMTSTR_CHECK_VOL_EXISTS, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, FMTSTR_CHECK_VOL_EXISTS, volname); goto out; } @@ -2465,7 +2579,7 @@ glusterd_op_delete_volume (dict_t *dict) ret = glusterd_delete_volume (volinfo); out: - gf_log (this->name, GF_LOG_DEBUG, "returning %d", ret); + gf_msg_debug (this->name, 0, "returning %d", ret); return ret; } @@ -2496,7 +2610,7 @@ glusterd_op_statedump_volume (dict_t *dict, char **op_errstr) ret = glusterd_volinfo_find (volname, &volinfo); if (ret) goto out; - gf_log ("", GF_LOG_DEBUG, "Performing statedump on volume %s", volname); + gf_msg_debug ("glusterd", 0, "Performing statedump on volume %s", volname); if (strstr (options, "nfs") != NULL) { ret = glusterd_nfs_statedump (options, option_cnt, op_errstr); if (ret) @@ -2517,7 +2631,8 @@ glusterd_op_statedump_volume (dict_t *dict, char **op_errstr) * exiting, if statedump of this brick fails. */ if (ret) - gf_log (THIS->name, GF_LOG_WARNING, "could not " + gf_msg (THIS->name, GF_LOG_WARNING, 0, + GD_MSG_BRK_STATEDUMP_FAIL, "could not " "take the statedump of the brick %s:%s." " Proceeding to other bricks", brickinfo->hostname, brickinfo->path); @@ -2544,7 +2659,7 @@ glusterd_clearlocks_send_cmd (glusterd_volinfo_t *volinfo, char *cmd, if (ret < 0) { snprintf (errstr, err_len, "clear-locks getxattr command " "failed. Reason: %s", strerror (errno)); - gf_log (THIS->name, GF_LOG_DEBUG, "%s", errstr); + gf_msg_debug (THIS->name, 0, "%s", errstr); goto out; } @@ -2563,7 +2678,7 @@ glusterd_clearlocks_rmdir_mount (glusterd_volinfo_t *volinfo, char *mntpt) ret = rmdir (mntpt); if (ret) { - gf_log (THIS->name, GF_LOG_DEBUG, "rmdir failed"); + gf_msg_debug (THIS->name, 0, "rmdir failed"); goto out; } @@ -2594,7 +2709,7 @@ glusterd_clearlocks_unmount (glusterd_volinfo_t *volinfo, char *mntpt) synclock_lock (&priv->big_lock); if (ret) { ret = 0; - gf_log ("", GF_LOG_DEBUG, + gf_msg_debug ("glusterd", 0, "umount failed on maintenance client"); } @@ -2615,7 +2730,7 @@ glusterd_clearlocks_create_mount (glusterd_volinfo_t *volinfo, char **mntpt) volinfo->volname); tmpl = mkdtemp (template); if (!tmpl) { - gf_log (THIS->name, GF_LOG_DEBUG, "Couldn't create temporary " + gf_msg_debug (THIS->name, 0, "Couldn't create temporary " "mount directory. Reason %s", strerror (errno)); goto out; } @@ -2667,11 +2782,11 @@ glusterd_clearlocks_mount (glusterd_volinfo_t *volinfo, char **xl_opts, ret = runner_run (&runner); synclock_lock (&priv->big_lock); if (ret) { - gf_log (THIS->name, GF_LOG_DEBUG, + gf_msg_debug (THIS->name, 0, "Could not start glusterfs"); goto out; } - gf_log (THIS->name, GF_LOG_DEBUG, + gf_msg_debug (THIS->name, 0, "Started glusterfs successfully"); out: @@ -2692,7 +2807,7 @@ glusterd_clearlocks_get_local_client_ports (glusterd_volinfo_t *volinfo, GF_ASSERT (xl_opts); if (!xl_opts) { - gf_log (THIS->name, GF_LOG_DEBUG, "Should pass non-NULL " + gf_msg_debug (THIS->name, 0, "Should pass non-NULL " "xl_opts"); goto out; } @@ -2716,7 +2831,7 @@ glusterd_clearlocks_get_local_client_ports (glusterd_volinfo_t *volinfo, GF_PMAP_PORT_BRICKSERVER); if (!port) { ret = -1; - gf_log (THIS->name, GF_LOG_DEBUG, "Couldn't get port " + gf_msg_debug (THIS->name, 0, "Couldn't get port " " for brick %s:%s", brickinfo->hostname, brickinfo->path); goto out; @@ -2756,26 +2871,30 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Failed to get volume name"); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get volume name"); goto out; } - gf_log ("", GF_LOG_DEBUG, "Performing clearlocks on volume %s", volname); + gf_msg_debug ("glusterd", 0, "Performing clearlocks on volume %s", volname); ret = dict_get_str (dict, "path", &path); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Failed to get path"); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get path"); goto out; } ret = dict_get_str (dict, "kind", &kind); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Failed to get kind"); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get kind"); goto out; } ret = dict_get_str (dict, "type", &type); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Failed to get type"); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Failed to get type"); goto out; } @@ -2800,7 +2919,8 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) if (ret) { snprintf (msg, sizeof (msg), "Volume %s doesn't exist.", volname); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_VOL_NOT_FOUND, "%s", msg); goto out; } @@ -2813,7 +2933,8 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) if (ret) { snprintf (msg, sizeof (msg), "Couldn't get port numbers of " "local bricks"); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_BRK_PORT_NUM_GET_FAIL, "%s", msg); goto out; } @@ -2821,7 +2942,8 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) if (ret) { snprintf (msg, sizeof (msg), "Creating mount directory " "for clear-locks failed."); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_CLRLOCKS_MOUNTDIR_CREATE_FAIL, "%s", msg); goto out; } @@ -2829,7 +2951,8 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) if (ret) { snprintf (msg, sizeof (msg), "Failed to mount clear-locks " "maintenance client."); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_CLRLOCKS_CLNT_MOUNT_FAIL, "%s", msg); goto out; } @@ -2845,14 +2968,16 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) GF_FREE (free_ptr); snprintf (msg, sizeof (msg), "Failed to set clear-locks " "result"); - gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "%s", msg); } umount: glusterd_clearlocks_unmount (volinfo, mntpt); if (glusterd_clearlocks_rmdir_mount (volinfo, mntpt)) - gf_log (THIS->name, GF_LOG_WARNING, "Couldn't unmount " + gf_msg (THIS->name, GF_LOG_WARNING, 0, + GD_MSG_CLRLOCKS_CLNT_UMOUNT_FAIL, "Couldn't unmount " "clear-locks mount point"); out: |