summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorNandaja Varma <nandaja.varma@gmail.com>2015-03-17 13:16:06 +0530
committerAtin Mukherjee <amukherj@redhat.com>2015-06-16 00:26:07 -0700
commit70bb8bf65b4cefb503fa94452c200b0b71a06535 (patch)
tree135b97dda78f21a38789688f96a4558df0cb54a7 /xlators/mgmt
parent25f28a9c23b1adf665a982c2f5157bf13361521b (diff)
downloadglusterfs-70bb8bf65b4cefb503fa94452c200b0b71a06535.tar.gz
glusterfs-70bb8bf65b4cefb503fa94452c200b0b71a06535.tar.xz
glusterfs-70bb8bf65b4cefb503fa94452c200b0b71a06535.zip
ops/glusterd: Porting messages to new logging framework
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>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c349
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-log-ops.c42
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c263
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c422
4 files changed, 703 insertions, 373 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 06a735758d..984a24523f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -17,6 +17,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>
@@ -101,7 +102,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);
@@ -134,7 +135,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;
@@ -155,7 +157,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;
@@ -166,7 +169,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) {
@@ -198,7 +202,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;
}
@@ -230,7 +235,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;
@@ -238,7 +244,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);
@@ -252,7 +259,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;
@@ -263,7 +271,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) {
@@ -294,7 +303,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:
@@ -321,7 +331,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:
@@ -333,7 +344,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) {
@@ -347,7 +359,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;
}
@@ -418,7 +431,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 "
@@ -432,7 +446,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;
}
@@ -440,7 +455,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;
}
@@ -448,24 +464,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;
}
@@ -473,7 +493,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;
}
@@ -526,7 +547,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;
}
@@ -542,7 +564,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;
}
@@ -552,7 +575,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;
}
@@ -564,7 +588,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;
}
@@ -574,7 +599,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;
}
@@ -584,14 +610,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;
}
@@ -650,7 +678,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);
@@ -781,7 +809,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 "
@@ -794,7 +823,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;
}
@@ -802,7 +832,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;
}
@@ -810,7 +841,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;
}
@@ -840,7 +872,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,
@@ -857,7 +890,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;
@@ -883,7 +917,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;
}
@@ -895,7 +930,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;
}
@@ -907,7 +943,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;
}
@@ -921,7 +958,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;
}
@@ -953,10 +991,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,
@@ -965,7 +1004,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);
@@ -999,7 +1039,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,
@@ -1050,7 +1091,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;
@@ -1061,7 +1103,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);
@@ -1074,9 +1117,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;
}
@@ -1087,11 +1133,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;
@@ -1100,7 +1147,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;
@@ -1111,11 +1158,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;
}
@@ -1164,16 +1212,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);
}
@@ -1197,8 +1248,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,
@@ -1273,7 +1325,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,
@@ -1286,7 +1339,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;
}
@@ -1304,7 +1358,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.");
}
@@ -1323,7 +1377,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;
}
@@ -1363,7 +1417,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;
@@ -1372,7 +1427,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;
}
@@ -1408,7 +1463,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");
}
@@ -1416,21 +1471,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;
}
@@ -1442,20 +1500,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;
}
@@ -1476,7 +1537,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;
@@ -1486,7 +1548,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;
@@ -1506,7 +1569,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;
@@ -1528,7 +1592,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;
}
@@ -1538,7 +1603,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;
}
@@ -1557,7 +1623,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;
}
@@ -1569,7 +1636,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;
}
@@ -1599,21 +1666,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;
}
@@ -1623,7 +1693,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;
}
@@ -1631,7 +1702,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;
}
@@ -1670,7 +1742,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;
}
@@ -1680,7 +1753,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)) {
@@ -1689,7 +1763,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;
@@ -1697,7 +1772,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;
}
@@ -1724,7 +1800,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;
}
@@ -1732,7 +1809,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;
}
@@ -1818,7 +1896,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;
@@ -1961,27 +2039,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;
}
@@ -1992,7 +2074,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;
}
@@ -2049,19 +2132,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;
@@ -2080,7 +2166,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;
}
@@ -2117,7 +2204,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;
}
@@ -2125,7 +2213,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;
}
@@ -2143,7 +2232,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 {
@@ -2186,7 +2275,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;
}
@@ -2202,7 +2292,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;
}
@@ -2215,7 +2306,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;
}
@@ -2224,13 +2316,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;
}
@@ -2248,7 +2342,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);
@@ -2279,13 +2374,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;
}
@@ -2293,7 +2390,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;
}
@@ -2324,7 +2422,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 {
@@ -2357,7 +2456,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;
}
@@ -2365,7 +2465,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;
}
@@ -2379,12 +2480,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;
}
@@ -2403,7 +2505,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;
}
@@ -2411,7 +2514,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;
}
@@ -2419,14 +2523,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;
}
@@ -2434,13 +2540,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 0d3be8eb40..561d354b72 100644
--- a/xlators/mgmt/glusterd/src/glusterd-log-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-log-ops.c
@@ -15,6 +15,7 @@
#include "glusterd-store.h"
#include "glusterd-utils.h"
#include "glusterd-volgen.h"
+#include "glusterd-messages.h"
#include <signal.h>
@@ -48,7 +49,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 "
@@ -60,7 +62,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;
}
@@ -105,7 +108,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;
}
@@ -114,7 +118,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;
@@ -123,7 +128,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;
@@ -141,12 +147,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;
}
@@ -177,13 +184,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;
}
@@ -195,7 +204,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;
}
@@ -220,7 +230,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;
@@ -228,7 +239,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;
@@ -241,11 +253,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 90bbd0cc40..f777d85f53 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -76,7 +76,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");
}
}
@@ -99,7 +99,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");
}
}
@@ -108,14 +109,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:
@@ -174,7 +176,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;
@@ -192,7 +195,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;
}
@@ -233,7 +236,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;
@@ -296,19 +300,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;
}
@@ -381,7 +388,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;
}
@@ -445,7 +453,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;
@@ -463,7 +472,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;
}
@@ -476,7 +487,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;
}
@@ -558,7 +570,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;
@@ -587,7 +600,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;
}
@@ -646,14 +660,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;
}
@@ -698,7 +714,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);
@@ -709,7 +726,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";
@@ -720,16 +738,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";
@@ -797,7 +823,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);
@@ -808,7 +835,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";
@@ -821,16 +849,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));
@@ -916,10 +952,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);
@@ -1012,9 +1054,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);
@@ -1090,7 +1139,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;
@@ -1109,7 +1159,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;
@@ -1122,18 +1173,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));
}
@@ -1229,7 +1288,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;
@@ -1249,7 +1309,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;
@@ -1261,18 +1322,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));
}
@@ -1415,7 +1483,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;
}
@@ -1461,7 +1529,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;
@@ -1479,7 +1548,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;
@@ -1487,7 +1557,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;
@@ -1512,7 +1583,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;
}
@@ -1561,7 +1632,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;
}
@@ -1607,7 +1678,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;
}
@@ -1641,8 +1712,8 @@ 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 ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
- return ret;
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
+ return ret;
}
int32_t
@@ -1676,7 +1747,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;
}
@@ -1685,11 +1757,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);
}
@@ -1714,7 +1787,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;
}
@@ -1749,7 +1822,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;
}
@@ -1758,11 +1833,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);
}
@@ -1788,7 +1864,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;
}
@@ -1822,9 +1898,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 ? this->name : "glusterd",
- GF_LOG_DEBUG, "Returning %d", ret);
-
+ gf_msg_debug (this ? this->name : "glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -1862,7 +1936,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;
}
@@ -1882,9 +1958,7 @@ out:
if ((_gf_true == is_alloc) && req.buf.buf_val)
GF_FREE (req.buf.buf_val);
- gf_log (this ? this->name : "glusterd",
- GF_LOG_DEBUG, "Returning %d", ret);
-
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -1921,7 +1995,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 +2016,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 +2060,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 +2079,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 +2098,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 +2111,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 +2179,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 +2215,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 +2249,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 +2271,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;
@@ -2198,9 +2283,7 @@ out:
opinfo.op_ret = ret;
}
- gf_log (this ? this->name : "glusterd",
- 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 20fbc678a3..aadbb10681 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -112,7 +112,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;
}
@@ -120,20 +122,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;
}
@@ -141,16 +147,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;
}
@@ -172,14 +180,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;
}
@@ -217,18 +228,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:
@@ -276,11 +289,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 */
@@ -290,7 +304,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 "
@@ -306,14 +321,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;
}
@@ -321,7 +338,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;
}
@@ -329,7 +347,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;
}
@@ -337,19 +356,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;
}
@@ -359,7 +381,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;
@@ -370,7 +393,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;
}
@@ -379,7 +403,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;
}
@@ -432,7 +457,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;
}
@@ -444,7 +470,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 "
@@ -456,12 +483,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);
@@ -505,7 +533,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) {
@@ -516,7 +545,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 "
@@ -530,11 +560,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);
@@ -580,7 +611,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;
}
@@ -593,7 +625,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 "
@@ -606,12 +639,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);
@@ -722,7 +756,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),
@@ -737,7 +772,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;
}
@@ -781,7 +817,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);
}
@@ -831,7 +868,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 "
@@ -843,14 +881,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;
}
@@ -858,7 +898,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;
}
@@ -1025,7 +1066,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;
}
@@ -1041,28 +1083,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;
}
@@ -1110,7 +1158,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;
}
@@ -1137,7 +1187,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;
}
@@ -1147,7 +1198,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;
}
@@ -1168,7 +1220,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;
}
@@ -1178,7 +1231,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;
@@ -1189,7 +1243,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;
}
@@ -1202,7 +1257,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;
}
@@ -1221,13 +1276,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:
@@ -1245,19 +1302,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;
}
@@ -1306,7 +1366,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;
}
@@ -1328,7 +1389,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;
}
@@ -1391,7 +1453,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;
}
@@ -1401,7 +1464,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;
}
@@ -1428,7 +1492,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;
}
@@ -1466,7 +1531,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;
}
@@ -1474,7 +1540,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;
}
@@ -1489,7 +1556,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;
}
@@ -1514,14 +1582,16 @@ 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;
}
@@ -1541,7 +1611,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;
}
@@ -1590,7 +1661,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;
}
@@ -1694,14 +1765,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;
}
@@ -1709,7 +1782,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;
}
@@ -1722,7 +1796,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;
}
@@ -1740,7 +1815,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;
}
@@ -1751,7 +1827,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;
}
@@ -1815,7 +1891,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;
}
@@ -1833,7 +1909,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;
}
@@ -1841,7 +1918,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;
}
@@ -1849,7 +1927,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;
}
@@ -1857,7 +1936,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;
}
@@ -1866,7 +1946,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;
}
@@ -1878,14 +1959,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;
}
@@ -1925,7 +2007,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;
}
@@ -1933,7 +2016,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;
}
@@ -1942,21 +2026,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;
}
@@ -1964,7 +2051,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;
}
@@ -1978,7 +2066,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;
}
@@ -1988,7 +2077,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;
}
@@ -1996,14 +2086,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;
}
@@ -2013,19 +2105,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;
@@ -2048,27 +2143,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;
@@ -2077,7 +2176,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;
@@ -2114,7 +2214,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;
}
@@ -2127,7 +2228,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;
}
@@ -2140,7 +2242,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;
}
@@ -2239,12 +2342,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;
}
@@ -2274,7 +2379,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;
}
@@ -2297,7 +2403,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;
}
@@ -2323,7 +2430,7 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr)
if (ret) {
ret = ganesha_manage_export (dict, "on", op_errstr);
if (ret) {
- gf_log ("", GF_LOG_WARNING, "NFS-Ganesha couldn't"
+ gf_log ("glusterd", GF_LOG_WARNING, "NFS-Ganesha couldn't"
"export the volume. %s", *op_errstr);
ret = 0;
}
@@ -2331,7 +2438,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;
}
@@ -2353,7 +2460,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;
}
@@ -2363,7 +2471,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;
}
@@ -2372,7 +2481,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,
@@ -2380,9 +2489,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) {
@@ -2394,7 +2504,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;
@@ -2422,14 +2533,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;
}
@@ -2453,13 +2566,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;
}
@@ -2470,7 +2585,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;
}
@@ -2501,7 +2616,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)
@@ -2522,7 +2637,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);
@@ -2549,7 +2665,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;
}
@@ -2568,7 +2684,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;
}
@@ -2599,7 +2715,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");
}
@@ -2620,7 +2736,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;
}
@@ -2672,11 +2788,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:
@@ -2697,7 +2813,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;
}
@@ -2721,7 +2837,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;
@@ -2761,26 +2877,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;
}
@@ -2805,7 +2925,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;
}
@@ -2818,7 +2939,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;
}
@@ -2826,7 +2948,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;
}
@@ -2834,7 +2957,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;
}
@@ -2850,14 +2974,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: