summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
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-20 21:27:06 -0700
commit38d602e820b99b0c9e2efe788df7450e4d863196 (patch)
tree81d2d62adaae3e55662fe11c9772b9944f54a7aa /xlators/mgmt/glusterd/src/glusterd-brick-ops.c
parent16115c232e48f080624b68eb94f813fb3c226e58 (diff)
ops/glusterd: Porting messages to new logging framework
cherry-picked from commit 70bb8bf65b4cefb503fa94452c200b0b71a06535 >Change-Id: Iafeb07aabc1781d98f51c6c2627bf3bbdf493153 >BUG: 1194640 >Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com> >Reviewed-on: http://review.gluster.org/9905 >Tested-by: Gluster Build System <jenkins@build.gluster.com> >Tested-by: NetBSD Build System <jenkins@build.gluster.org> >Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Change-Id: Iafeb07aabc1781d98f51c6c2627bf3bbdf493153 BUG: 1217722 Signed-off-by: Nandaja Varma <nvarma@redhat.com> Reviewed-on: http://review.gluster.org/11230 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c349
1 files changed, 228 insertions, 121 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 3a9d3188278..0b3c24cd7c4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -22,6 +22,7 @@
#include "glusterd-utils.h"
#include "glusterd-volgen.h"
#include "glusterd-svc-helper.h"
+#include "glusterd-messages.h"
#include "run.h"
#include <sys/signal.h>
@@ -106,7 +107,7 @@ insert_brick:
i++;
if (i < idx)
continue;
- gf_log (THIS->name, GF_LOG_DEBUG, "brick:%s index=%d, count=%d",
+ gf_msg_debug (THIS->name, 0, "brick:%s index=%d, count=%d",
brick->path, idx, count);
cds_list_add (&brickinfo->brick_list, &brick->brick_list);
@@ -139,7 +140,8 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count,
"bricks (%d) supplied for stripe count (%d).",
(total_bricks - volinfo->brick_count),
stripe_count);
- gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s", err_str);
goto out;
}
break;
@@ -160,7 +162,8 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count,
(total_bricks - volinfo->brick_count),
stripe_count,
(volinfo->replica_count * stripe_count));
- gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s", err_str);
goto out;
}
break;
@@ -171,7 +174,8 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count,
"Incorrect stripe count (%d) supplied. "
"Volume already has stripe count (%d)",
stripe_count, volinfo->stripe_count);
- gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s", err_str);
goto out;
}
if (stripe_count == volinfo->stripe_count) {
@@ -203,7 +207,8 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count,
snprintf (err_str, err_len, "Volume %s cannot be converted "
"from dispersed to striped-"
"dispersed", volinfo->volname);
- gf_log(THIS->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg(THIS->name, GF_LOG_ERROR, EPERM,
+ GD_MSG_OP_NOT_PERMITTED, "%s", err_str);
goto out;
}
@@ -235,7 +240,8 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count,
"bricks (%d) supplied for replica count (%d).",
(total_bricks - volinfo->brick_count),
replica_count);
- gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s", err_str);
goto out;
}
break;
@@ -243,7 +249,8 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count,
if (!(total_bricks % (volinfo->dist_leaf_count * replica_count))) {
/* Change the volume type */
*type = GF_CLUSTER_TYPE_STRIPE_REPLICATE;
- gf_log (THIS->name, GF_LOG_INFO,
+ gf_msg (THIS->name, GF_LOG_INFO, 0,
+ GD_MSG_VOL_TYPE_CHANGING_INFO,
"Changing the type of volume %s from "
"'stripe' to 'replicate-stripe'",
volinfo->volname);
@@ -257,7 +264,8 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count,
(total_bricks - volinfo->brick_count),
replica_count, (volinfo->dist_leaf_count *
replica_count));
- gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s", err_str);
goto out;
}
break;
@@ -268,7 +276,8 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count,
"Incorrect replica count (%d) supplied. "
"Volume already has (%d)",
replica_count, volinfo->replica_count);
- gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s", err_str);
goto out;
}
if (replica_count == volinfo->replica_count) {
@@ -299,7 +308,8 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count,
snprintf (err_str, err_len, "Volume %s cannot be converted "
"from dispersed to replicated-"
"dispersed", volinfo->volname);
- gf_log(THIS->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg(THIS->name, GF_LOG_ERROR, EPERM,
+ GD_MSG_OP_NOT_PERMITTED, "%s", err_str);
goto out;
}
out:
@@ -326,7 +336,8 @@ gd_rmbr_validate_replica_count (glusterd_volinfo_t *volinfo,
snprintf (err_str, err_len,
"replica count (%d) option given for non replicate "
"volume %s", replica_count, volinfo->volname);
- gf_log (THIS->name, GF_LOG_WARNING, "%s", err_str);
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ GD_MSG_VOL_NOT_REPLICA, "%s", err_str);
goto out;
case GF_CLUSTER_TYPE_REPLICATE:
@@ -338,7 +349,8 @@ gd_rmbr_validate_replica_count (glusterd_volinfo_t *volinfo,
"than volume %s's replica count (%d)",
replica_count, volinfo->volname,
volinfo->replica_count);
- gf_log (THIS->name, GF_LOG_WARNING, "%s", err_str);
+ gf_msg (THIS->name, GF_LOG_WARNING, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s", err_str);
goto out;
}
if (replica_count == volinfo->replica_count) {
@@ -352,7 +364,8 @@ gd_rmbr_validate_replica_count (glusterd_volinfo_t *volinfo,
"(or %dxN)", brick_count,
volinfo->dist_leaf_count,
volinfo->dist_leaf_count);
- gf_log (THIS->name, GF_LOG_WARNING, "%s",
+ gf_msg (THIS->name, GF_LOG_WARNING, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s",
err_str);
goto out;
}
@@ -423,7 +436,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
snprintf (err_str, sizeof (err_str), "Unable to decode "
@@ -437,7 +451,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get volume "
"name");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "%s", err_str);
goto out;
}
@@ -445,7 +460,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
ret = -1;
snprintf (err_str, sizeof (err_str), "Volume %s does not exist",
volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_VOL_NOT_FOUND, "%s", err_str);
goto out;
}
@@ -453,24 +469,28 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get volume "
"brick count");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "%s", err_str);
goto out;
}
ret = dict_get_int32 (dict, "replica-count", &replica_count);
if (!ret) {
- gf_log (this->name, GF_LOG_INFO, "replica-count is %d",
+ gf_msg (this->name, GF_LOG_INFO, errno,
+ GD_MSG_DICT_GET_FAILED, "replica-count is %d",
replica_count);
}
ret = dict_get_int32 (dict, "stripe-count", &stripe_count);
if (!ret) {
- gf_log (this->name, GF_LOG_INFO, "stripe-count is %d",
+ gf_msg (this->name, GF_LOG_INFO, errno,
+ GD_MSG_DICT_GET_FAILED, "stripe-count is %d",
stripe_count);
}
if (!dict_get (dict, "force")) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get flag");
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Failed to get flag");
goto out;
}
@@ -478,7 +498,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get volinfo "
"for volume name %s", volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_GET_FAIL, "%s", err_str);
goto out;
}
@@ -531,7 +552,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
snprintf (err_str, sizeof (err_str), "Incorrect number "
"of bricks supplied %d with count %d",
brick_count, volinfo->dist_leaf_count);
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_VOL_NOT_REPLICA, "%s", err_str);
ret = -1;
goto out;
}
@@ -547,7 +569,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
err_str,
sizeof (err_str));
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_COUNT_VALIDATE_FAILED, "%s", err_str);
goto out;
}
@@ -557,7 +580,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
ret = dict_set_int32 (dict, "stripe-count", stripe_count);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
"failed to set the stripe-count in dict");
goto out;
}
@@ -569,7 +593,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
&type, err_str,
sizeof (err_str));
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_COUNT_VALIDATE_FAILED, "%s", err_str);
goto out;
}
@@ -579,7 +604,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
ret = dict_set_int32 (dict, "replica-count", replica_count);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
"failed to set the replica-count in dict");
goto out;
}
@@ -589,14 +615,16 @@ brick_val:
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get volume "
"bricks");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "%s", err_str);
goto out;
}
if (type != volinfo->type) {
ret = dict_set_int32 (dict, "type", type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
"failed to set the new type in dict");
goto out;
}
@@ -655,7 +683,7 @@ subvol_matcher_update (int *subvols, glusterd_volinfo_t *volinfo,
pos++;
continue;
}
- gf_log (THIS->name, GF_LOG_DEBUG, LOGSTR_FOUND_BRICK,
+ gf_msg_debug (THIS->name, 0, LOGSTR_FOUND_BRICK,
brickinfo->hostname, brickinfo->path,
volinfo->volname);
sub_volume = (pos / volinfo->dist_leaf_count);
@@ -786,7 +814,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
snprintf (err_str, sizeof (err_str), "Unable to decode "
@@ -799,7 +828,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get volume "
"name");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "%s", err_str);
goto out;
}
@@ -807,7 +837,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get brick "
"count");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "%s", err_str);
goto out;
}
@@ -815,7 +846,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str),"Volume %s does not exist",
volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_VOL_NOT_FOUND, "%s", err_str);
goto out;
}
@@ -845,7 +877,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
ret = dict_get_int32 (dict, "replica-count", &replica_count);
if (!ret) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, errno,
+ GD_MSG_DICT_GET_FAILED,
"request to change replica-count to %d", replica_count);
ret = gd_rmbr_validate_replica_count (volinfo, replica_count,
count, err_str,
@@ -862,7 +895,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
ret = dict_set_int32 (dict, "replica-count",
replica_count);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ GD_MSG_DICT_SET_FAILED,
"failed to set the replica_count "
"in dict");
goto out;
@@ -888,7 +922,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
(volinfo->brick_count == volinfo->stripe_count)) {
snprintf (err_str, sizeof (err_str),
"Removing brick from a stripe volume is not allowed");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, EPERM,
+ GD_MSG_OP_NOT_PERMITTED, "%s", err_str);
ret = -1;
goto out;
}
@@ -900,7 +935,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
"Removing bricks from stripe-replicate"
" configuration is not allowed without reducing "
"replica or stripe count explicitly.");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, EPERM,
+ GD_MSG_OP_NOT_PERMITTED_AC_REQD, "%s", err_str);
ret = -1;
goto out;
}
@@ -912,7 +948,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
"Removing bricks from replicate configuration "
"is not allowed without reducing replica count "
"explicitly.");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, EPERM,
+ GD_MSG_OP_NOT_PERMITTED_AC_REQD, "%s", err_str);
ret = -1;
goto out;
}
@@ -926,7 +963,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
snprintf (err_str, sizeof (err_str), "Remove brick "
"incorrect brick count of %d for %s %d",
count, vol_type, volinfo->dist_leaf_count);
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s", err_str);
ret = -1;
goto out;
}
@@ -958,10 +996,11 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get %s",
key);
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "%s", err_str);
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "Remove brick count %d brick:"
+ gf_msg_debug (this->name, 0, "Remove brick count %d brick:"
" %s", i, brick);
ret = glusterd_volume_brickinfo_get_by_brick(brick, volinfo,
@@ -970,7 +1009,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Incorrect brick "
"%s for volume %s", brick, volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_BRICK_NOT_FOUND, "%s", err_str);
goto out;
}
strcat(brick_list, brick);
@@ -1004,7 +1044,8 @@ out:
if (err_str[0] == '\0')
snprintf (err_str, sizeof (err_str),
"Operation failed");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_GLUSTERD_OP_FAILED, "%s", err_str);
rsp.op_errstr = err_str;
cli_rsp = &rsp;
glusterd_to_cli (req, cli_rsp, NULL, 0, NULL,
@@ -1055,7 +1096,8 @@ _glusterd_restart_gsync_session (dict_t *this, char *key,
slave++;
slave_buf = gf_strdup (slave);
if (!slave_buf) {
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY,
"Failed to gf_strdup");
ret = -1;
goto out;
@@ -1066,7 +1108,8 @@ _glusterd_restart_gsync_session (dict_t *this, char *key,
ret = dict_set_dynstr (param->rsp_dict, "slave", slave_buf);
if (ret) {
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
"Unable to store slave");
if (slave_buf)
GF_FREE(slave_buf);
@@ -1079,9 +1122,12 @@ _glusterd_restart_gsync_session (dict_t *this, char *key,
&conf_path, errmsg);
if (ret) {
if (*errmsg)
- gf_log ("", GF_LOG_ERROR, "%s", *errmsg);
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_SLAVE_CONFPATH_DETAILS_FETCH_FAIL,
+ "%s", *errmsg);
else
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_SLAVE_CONFPATH_DETAILS_FETCH_FAIL,
"Unable to fetch slave or confpath details.");
goto out;
}
@@ -1092,11 +1138,12 @@ _glusterd_restart_gsync_session (dict_t *this, char *key,
slave, conf_path,
&is_running);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "gsync running validation failed.");
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_GSYNC_VALIDATION_FAIL, "gsync running validation failed.");
goto out;
}
if (_gf_false == is_running) {
- gf_log ("", GF_LOG_DEBUG, "gsync session for %s and %s is"
+ gf_msg_debug ("glusterd", 0, "gsync session for %s and %s is"
" not running on this node. Hence not restarting.",
param->volinfo->volname, slave);
ret = 0;
@@ -1105,7 +1152,7 @@ _glusterd_restart_gsync_session (dict_t *this, char *key,
ret = glusterd_get_local_brickpaths (param->volinfo, &path_list);
if (!path_list) {
- gf_log ("", GF_LOG_DEBUG, "This node not being part of"
+ gf_msg_debug ("glusterd", 0, "This node not being part of"
" volume should not be running gsyncd. Hence"
" no gsyncd process to restart.");
ret = 0;
@@ -1116,11 +1163,12 @@ _glusterd_restart_gsync_session (dict_t *this, char *key,
param->rsp_dict, path_list,
conf_path, 0);
if (ret)
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_GSYNC_RESTART_FAIL,
"Unable to restart gsync session.");
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d.", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d.", ret);
return ret;
}
@@ -1169,16 +1217,19 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count,
if (dict) {
ret = dict_get_int32 (dict, "stripe-count", &stripe_count);
if (!ret)
- gf_log (THIS->name, GF_LOG_INFO,
+ gf_msg (THIS->name, GF_LOG_INFO, errno,
+ GD_MSG_DICT_GET_FAILED,
"stripe-count is set %d", stripe_count);
ret = dict_get_int32 (dict, "replica-count", &replica_count);
if (!ret)
- gf_log (THIS->name, GF_LOG_INFO,
+ gf_msg (THIS->name, GF_LOG_INFO, errno,
+ GD_MSG_DICT_GET_FAILED,
"replica-count is set %d", replica_count);
ret = dict_get_int32 (dict, "type", &type);
if (!ret)
- gf_log (THIS->name, GF_LOG_INFO,
+ gf_msg (THIS->name, GF_LOG_INFO, errno,
+ GD_MSG_DICT_GET_FAILED,
"type is set %d, need to change it", type);
}
@@ -1202,8 +1253,9 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count,
snprintf (key, sizeof(key), "brick%d.mount_dir", i);
ret = dict_get_str (dict, key, &brick_mount_dir);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "%s not present", key);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
+ "%s not present", key);
goto out;
}
strncpy (brickinfo->mount_dir, brick_mount_dir,
@@ -1278,7 +1330,8 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count,
if (brickinfo->vg[0]) {
ret = glusterd_is_valid_vg (brickinfo, 0, msg);
if (ret) {
- gf_log (THIS->name, GF_LOG_CRITICAL, "%s", msg);
+ gf_msg (THIS->name, GF_LOG_CRITICAL, 0,
+ GD_MSG_INVALID_VG, "%s", msg);
goto out;
}
/* if anyone of the brick does not have thin support,
@@ -1291,7 +1344,8 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count,
if (gf_uuid_is_null (brickinfo->uuid)) {
ret = glusterd_resolve_brick (brickinfo);
if (ret) {
- gf_log ("", GF_LOG_ERROR, FMTSTR_RESOLVE_BRICK,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_RESOLVE_BRICK_FAIL, FMTSTR_RESOLVE_BRICK,
brickinfo->hostname, brickinfo->path);
goto out;
}
@@ -1309,7 +1363,7 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count,
if ((!gf_uuid_compare (brickinfo->uuid, MY_UUID)) &&
!restart_needed) {
restart_needed = 1;
- gf_log ("", GF_LOG_DEBUG,
+ gf_msg_debug ("glusterd", 0,
"Restart gsyncd session, if it's already "
"running.");
}
@@ -1328,7 +1382,7 @@ out:
GF_FREE (free_ptr1);
GF_FREE (free_ptr2);
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -1368,7 +1422,8 @@ glusterd_op_perform_remove_brick (glusterd_volinfo_t *volinfo, char *brick,
ret = glusterd_brick_stop (volinfo, brickinfo,
_gf_true);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "Unable to stop "
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_STOP_FAIL, "Unable to stop "
"glusterfs, ret: %d", ret);
}
goto out;
@@ -1377,7 +1432,7 @@ glusterd_op_perform_remove_brick (glusterd_volinfo_t *volinfo, char *brick,
brickinfo->decommissioned = 1;
ret = 0;
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -1413,7 +1468,7 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = dict_get_int32 (dict, "replica-count", &replica_count);
if (ret) {
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"Unable to get replica count");
}
@@ -1421,21 +1476,24 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = op_version_check (this, GD_OP_VER_PERSISTENT_AFR_XATTRS,
msg, sizeof(msg));
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_VERSION_MISMATCH, "%s", msg);
*op_errstr = gf_strdup (msg);
goto out;
}
}
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
"Unable to get volume name");
goto out;
}
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_NOT_FOUND,
"Unable to find volume: %s", volname);
goto out;
}
@@ -1447,20 +1505,23 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
if (glusterd_is_defrag_on(volinfo)) {
snprintf (msg, sizeof(msg), "Volume name %s rebalance is in "
"progress. Please retry after completion", volname);
- gf_log (THIS->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_OIP_RETRY_LATER, "%s", msg);
*op_errstr = gf_strdup (msg);
ret = -1;
goto out;
}
ret = dict_get_int32 (dict, "count", &count);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to get count");
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get count");
goto out;
}
ret = dict_get_str (dict, "bricks", &bricks);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "Unable to get bricks");
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get bricks");
goto out;
}
@@ -1481,7 +1542,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
!glusterd_is_valid_volfpath (volname, brick)) {
snprintf (msg, sizeof (msg), "brick path %s is "
"too long", brick);
- gf_log (THIS->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRKPATH_TOO_LONG, "%s", msg);
*op_errstr = gf_strdup (msg);
ret = -1;
@@ -1491,7 +1553,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = glusterd_brickinfo_new_from_brick (brick, &brickinfo);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_NOT_FOUND,
"Add-brick: Unable"
" to get brickinfo");
goto out;
@@ -1511,7 +1574,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
if (brickinfo->vg[0]) {
ret = glusterd_is_valid_vg (brickinfo, 1, msg);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "%s",
+ gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_VG, "%s",
msg);
*op_errstr = gf_strdup (msg);
goto out;
@@ -1533,7 +1597,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
(brickinfo->path, brickinfo->hostname,
brickinfo->mount_dir);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_MOUNTDIR_GET_FAIL,
"Failed to get brick mount_dir");
goto out;
}
@@ -1543,7 +1608,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = dict_set_dynstr_with_alloc
(rsp_dict, key, brickinfo->mount_dir);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
"Failed to set %s", key);
goto out;
}
@@ -1562,7 +1628,8 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = dict_set_int32 (rsp_dict, "brick_count",
local_brick_count);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
"Failed to set local_brick_count");
goto out;
}
@@ -1574,7 +1641,7 @@ out:
GF_FREE (str_ret);
GF_FREE (all_bricks);
- gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (THIS->name, 0, "Returning %d", ret);
return ret;
}
@@ -1604,21 +1671,24 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
ret = op_version_check (this, GD_OP_VER_PERSISTENT_AFR_XATTRS,
msg, sizeof(msg));
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_VERSION_MISMATCH, "%s", msg);
*op_errstr = gf_strdup (msg);
goto out;
}
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name");
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Unable to get volume name");
goto out;
}
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Volume %s does not exist", volname);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_NOT_FOUND, "Volume %s does not exist", volname);
goto out;
}
@@ -1628,7 +1698,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
ret = dict_get_int32 (dict, "command", &flag);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
"Unable to get brick command");
goto out;
}
@@ -1636,7 +1707,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
ret = dict_get_int32 (dict, "count", &brick_count);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get brick count");
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get brick count");
goto out;
}
@@ -1675,7 +1747,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
"needed when reducing replica count. Use the"
" 'force' option");
errstr = gf_strdup (msg);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_USE_THE_FORCE, "%s", errstr);
goto out;
}
@@ -1685,7 +1758,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
"'force' or 'commit' to override this "
"behavior)", volinfo->volname);
errstr = gf_strdup (msg);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_NOT_STARTED, "%s", errstr);
goto out;
}
if (!gd_is_remove_brick_committed (volinfo)) {
@@ -1694,7 +1768,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
" or stop it before starting a new task.",
volinfo->volname);
errstr = gf_strdup (msg);
- gf_log (this->name, GF_LOG_ERROR, "Earlier remove-brick"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OLD_REMOVE_BRICK_EXISTS, "Earlier remove-brick"
" task exists for volume %s.",
volinfo->volname);
goto out;
@@ -1702,7 +1777,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
if (glusterd_is_defrag_on(volinfo)) {
errstr = gf_strdup("Rebalance is in progress. Please "
"retry after completion");
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OIP_RETRY_LATER, "%s", errstr);
goto out;
}
@@ -1729,7 +1805,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
ret = glusterd_generate_and_set_task_id
(dict, GF_REMOVE_BRICK_TID_KEY);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_TASKID_GEN_FAIL,
"Failed to generate task-id");
goto out;
}
@@ -1737,7 +1814,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
ret = dict_get_str (dict, GF_REMOVE_BRICK_TID_KEY,
&task_id_str);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ GD_MSG_DICT_GET_FAILED,
"Missing remove-brick-id");
ret = 0;
}
@@ -1823,7 +1901,7 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
ret = 0;
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
if (ret && errstr) {
if (op_errstr)
*op_errstr = errstr;
@@ -1966,27 +2044,31 @@ glusterd_op_add_brick (dict_t *dict, char **op_errstr)
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to get volume name");
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get volume name");
goto out;
}
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to allocate memory");
+ gf_msg ("glusterd", GF_LOG_ERROR, EINVAL,
+ GD_MSG_VOL_NOT_FOUND, "Unable to allocate memory");
goto out;
}
ret = dict_get_int32 (dict, "count", &count);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to get count");
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get count");
goto out;
}
ret = dict_get_str (dict, "bricks", &bricks);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to get bricks");
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get bricks");
goto out;
}
@@ -1997,7 +2079,8 @@ glusterd_op_add_brick (dict_t *dict, char **op_errstr)
ret = glusterd_op_perform_add_bricks (volinfo, count, bricks, dict);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to add bricks");
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_ADD_FAIL, "Unable to add bricks");
goto out;
}
@@ -2053,19 +2136,22 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_ADD_FAIL, "Unable to get volume name");
goto out;
}
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to allocate memory");
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_VOL_NOT_FOUND, "Unable to allocate memory");
goto out;
}
ret = dict_get_int32 (dict, "command", &flag);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get command");
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get command");
goto out;
}
cmd = flag;
@@ -2084,7 +2170,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
(volinfo->rebal.rebalance_id, dict,
GF_REMOVE_BRICK_TID_KEY);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REMOVE_BRICK_ID_SET_FAIL,
"Failed to set remove-brick-id");
goto out;
}
@@ -2121,7 +2208,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
}
ret = glusterd_create_volfiles_and_notify_services (volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL,
"failed to create volfiles");
goto out;
}
@@ -2129,7 +2217,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
ret = glusterd_store_volinfo (volinfo,
GLUSTERD_VOLINFO_VER_AC_INCREMENT);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_VOLINFO_SET_FAIL,
"failed to store volinfo");
goto out;
}
@@ -2147,7 +2236,7 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
volinfo->rebal.defrag_status = GF_DEFRAG_STATUS_NOT_STARTED;
ret = dict_get_str (dict, GF_REMOVE_BRICK_TID_KEY, &task_id_str);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, errno,
"Missing remove-brick-id");
ret = 0;
} else {
@@ -2190,7 +2279,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
ret = dict_get_int32 (dict, "count", &count);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to get count");
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get count");
goto out;
}
@@ -2206,7 +2296,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
}
ret = dict_set_int32 (bricks_dict, "count", count);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
"Failed to save remove-brick count");
goto out;
}
@@ -2219,7 +2310,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
snprintf (key, 256, "brick%d", i);
ret = dict_get_str (dict, key, &brick);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get %s",
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get %s",
key);
goto out;
}
@@ -2228,13 +2320,15 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
brick_tmpstr = gf_strdup (brick);
if (!brick_tmpstr) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY,
"Failed to duplicate brick name");
goto out;
}
ret = dict_set_dynstr (bricks_dict, key, brick_tmpstr);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
"Failed to add brick to dict");
goto out;
}
@@ -2252,7 +2346,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
ret = dict_get_int32 (dict, "replica-count", &replica_count);
if (!ret) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, errno,
+ GD_MSG_DICT_GET_FAILED,
"changing replica count %d to %d on volume %s",
volinfo->replica_count, replica_count,
volinfo->volname);
@@ -2283,13 +2378,15 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
ret = glusterd_create_volfiles_and_notify_services (volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "failed to create volfiles");
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL, "failed to create volfiles");
goto out;
}
ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "failed to store volinfo");
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_VOLINFO_STORE_FAIL, "failed to store volinfo");
goto out;
}
@@ -2297,7 +2394,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
volinfo->status == GLUSTERD_STATUS_STARTED) {
ret = glusterd_svcs_reconfigure (volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_NFS_RECONF_FAIL,
"Unable to reconfigure NFS-Server");
goto out;
}
@@ -2325,7 +2423,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
volinfo->decommission_in_progress = 1;
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REBALANCE_START_FAIL,
"failed to start the rebalance");
}
} else {
@@ -2358,7 +2457,8 @@ glusterd_op_stage_barrier (dict_t *dict, char **op_errstr)
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Volname not present in "
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Volname not present in "
"dict");
goto out;
}
@@ -2366,7 +2466,8 @@ glusterd_op_stage_barrier (dict_t *dict, char **op_errstr)
ret = glusterd_volinfo_find (volname, &vol);
if (ret) {
gf_asprintf (op_errstr, "Volume %s does not exist", volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_NOT_FOUND, "%s", *op_errstr);
goto out;
}
@@ -2380,12 +2481,13 @@ glusterd_op_stage_barrier (dict_t *dict, char **op_errstr)
if (ret == -1) {
gf_asprintf (op_errstr, "Barrier op for volume %s not present "
"in dict", volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "%s", *op_errstr);
goto out;
}
ret = 0;
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -2404,7 +2506,8 @@ glusterd_op_barrier (dict_t *dict, char **op_errstr)
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Volname not present in "
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Volname not present in "
"dict");
goto out;
}
@@ -2412,7 +2515,8 @@ glusterd_op_barrier (dict_t *dict, char **op_errstr)
ret = glusterd_volinfo_find (volname, &vol);
if (ret) {
gf_asprintf (op_errstr, "Volume %s does not exist", volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_NOT_FOUND, "%s", *op_errstr);
goto out;
}
@@ -2420,14 +2524,16 @@ glusterd_op_barrier (dict_t *dict, char **op_errstr)
if (ret) {
gf_asprintf (op_errstr, "Barrier op for volume %s not present "
"in dict", volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "%s", *op_errstr);
goto out;
}
ret = dict_set_dynstr_with_alloc (vol->dict, "features.barrier",
barrier_op);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set barrier op in"
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to set barrier op in"
" volume option dict");
goto out;
}
@@ -2435,13 +2541,14 @@ glusterd_op_barrier (dict_t *dict, char **op_errstr)
gd_update_volume_op_versions (vol);
ret = glusterd_create_volfiles (vol);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to create volfiles");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL, "Failed to create volfiles");
goto out;
}
ret = glusterd_store_volinfo (vol, GLUSTERD_VOLINFO_VER_AC_INCREMENT);
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}