summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNandaja Varma <nandaja.varma@gmail.com>2015-06-25 00:57:00 +0530
committerKaushal M <kaushal@redhat.com>2015-06-26 23:56:09 -0700
commit8708953fa3d9187997dc6d484dae663b4469c7ca (patch)
tree38e9ef4db291ee0c1c50805bc08aee6fa3c7780f
parent08586ee518de438fe2bbbaa74ae4c9a02a5d88cf (diff)
glusterd: Porting left out log messages to new framework
This is a backport of http://review.gluster.org/11388 cherry-picked from commit 23c1e6dc0fa86c014e1a8b6aa5729675f6d69017 >Change-Id: I70d40ae3b5f49a21e1b93f82885cd58fa2723647 >BUG: 1235538 >Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com> Change-Id: I70d40ae3b5f49a21e1b93f82885cd58fa2723647 BUG: 1217722 Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com> Reviewed-on: http://review.gluster.org/11422 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Anand Nekkunti <anekkunt@redhat.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-bitd-svc.c8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-bitrot.c87
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c54
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-ganesha.c90
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c93
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-hooks.c50
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-log-ops.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-messages.h830
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c80
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-peer-utils.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quota.c20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c11
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c37
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c30
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-scrub-svc.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c42
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c28
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c10
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c189
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c349
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c35
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c19
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c68
25 files changed, 1677 insertions, 476 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c b/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c
index c1acd40184d..1b71b6ca7a5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c
@@ -43,12 +43,14 @@ glusterd_bitdsvc_create_volfile ()
ret = glusterd_create_global_volfile (build_bitd_graph,
filepath, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to create volfile");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL,
+ "Failed to create volfile");
goto out;
}
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -84,7 +86,7 @@ glusterd_bitdsvc_manager (glusterd_svc_t *svc, void *data, int flags)
}
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-bitrot.c b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
index 758a46b3834..897916ed860 100644
--- a/xlators/mgmt/glusterd/src/glusterd-bitrot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
@@ -26,6 +26,7 @@
#include "byte-order.h"
#include "compat-errno.h"
#include "glusterd-scrub-svc.h"
+#include "glusterd-messages.h"
#include <sys/wait.h>
#include <dlfcn.h>
@@ -75,7 +76,8 @@ __glusterd_handle_bitrot (rpcsvc_request_t *req)
cli_req.dict.dict_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 req-buffer to dictionary");
snprintf (msg, sizeof (msg), "Unable to decode the "
"command");
@@ -88,7 +90,8 @@ __glusterd_handle_bitrot (rpcsvc_request_t *req)
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
snprintf (msg, sizeof (msg), "Unable to get volume name");
- gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name, "
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get volume name, "
"while handling bitrot command");
goto out;
}
@@ -96,7 +99,8 @@ __glusterd_handle_bitrot (rpcsvc_request_t *req)
ret = dict_get_int32 (dict, "type", &type);
if (ret) {
snprintf (msg, sizeof (msg), "Unable to get type of command");
- gf_log (this->name, GF_LOG_ERROR, "Unable to get type of cmd, "
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get type of cmd, "
"while handling bitrot command");
goto out;
}
@@ -143,7 +147,8 @@ glusterd_bitrot_scrub_throttle (glusterd_volinfo_t *volinfo, dict_t *dict,
ret = dict_get_str (dict, "scrub-throttle-value", &scrub_throttle);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to fetch scrub-"
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to fetch scrub-"
"throttle value");
goto out;
}
@@ -151,14 +156,17 @@ glusterd_bitrot_scrub_throttle (glusterd_volinfo_t *volinfo, dict_t *dict,
option = gf_strdup (scrub_throttle);
ret = dict_set_dynstr (volinfo->dict, key, option);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set option %s",
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to set option %s",
key);
goto out;
}
ret = glusterd_scrubsvc_reconfigure ();
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to reconfigure scrub "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SCRUBSVC_RECONF_FAIL,
+ "Failed to reconfigure scrub "
"services");
goto out;
}
@@ -181,7 +189,8 @@ glusterd_bitrot_scrub_freq (glusterd_volinfo_t *volinfo, dict_t *dict,
ret = dict_get_str (dict, "scrub-frequency-value", &scrub_freq);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to fetch scrub-"
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to fetch scrub-"
"freq value");
goto out;
}
@@ -189,14 +198,17 @@ glusterd_bitrot_scrub_freq (glusterd_volinfo_t *volinfo, dict_t *dict,
option = gf_strdup (scrub_freq);
ret = dict_set_dynstr (volinfo->dict, key, option);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set option %s",
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to set option %s",
key);
goto out;
}
ret = glusterd_scrubsvc_reconfigure ();
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to reconfigure scrub "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SCRUBSVC_RECONF_FAIL,
+ "Failed to reconfigure scrub "
"services");
goto out;
}
@@ -219,7 +231,8 @@ glusterd_bitrot_scrub (glusterd_volinfo_t *volinfo, dict_t *dict,
ret = dict_get_str (dict, "scrub-value", &scrub_value);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to fetch scrub"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to fetch scrub"
"value");
goto out;
}
@@ -232,14 +245,17 @@ glusterd_bitrot_scrub (glusterd_volinfo_t *volinfo, dict_t *dict,
ret = dict_set_dynstr (volinfo->dict, key, option);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set option %s",
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to set option %s",
key);
goto out;
}
ret = glusterd_scrubsvc_reconfigure ();
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to reconfigure scrub "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SCRUBSVC_RECONF_FAIL,
+ "Failed to reconfigure scrub "
"services");
goto out;
}
@@ -262,7 +278,8 @@ glusterd_bitrot_expiry_time (glusterd_volinfo_t *volinfo, dict_t *dict,
ret = dict_get_uint32 (dict, "expiry-time", &expiry_time);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get bitrot expiry"
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get bitrot expiry"
" timer value.");
goto out;
}
@@ -271,14 +288,17 @@ glusterd_bitrot_expiry_time (glusterd_volinfo_t *volinfo, dict_t *dict,
ret = dict_set_dynstr_with_alloc (volinfo->dict, key, dkey);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set option %s",
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to set option %s",
key);
goto out;
}
ret = glusterd_bitdsvc_reconfigure ();
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to reconfigure bitrot"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BITDSVC_RECONF_FAIL,
+ "Failed to reconfigure bitrot"
"services");
goto out;
}
@@ -315,7 +335,8 @@ glusterd_bitrot_enable (glusterd_volinfo_t *volinfo, char **op_errstr)
ret = dict_set_dynstr_with_alloc (volinfo->dict, VKEY_FEATURES_BITROT,
"on");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "dict set failed");
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "dict set failed");
goto out;
}
@@ -323,7 +344,8 @@ glusterd_bitrot_enable (glusterd_volinfo_t *volinfo, char **op_errstr)
ret = dict_set_dynstr_with_alloc (volinfo->dict, "features.scrub",
"Active");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set option "
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to set option "
"features.scrub value");
goto out;
}
@@ -351,7 +373,8 @@ glusterd_bitrot_disable (glusterd_volinfo_t *volinfo, char **op_errstr)
ret = dict_set_dynstr_with_alloc (volinfo->dict, VKEY_FEATURES_BITROT,
"off");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "dict set failed");
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "dict set failed");
goto out;
}
@@ -359,7 +382,8 @@ glusterd_bitrot_disable (glusterd_volinfo_t *volinfo, char **op_errstr)
ret = dict_set_dynstr_with_alloc (volinfo->dict, "features.scrub",
"Inactive");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set "
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to set "
"features.scrub value");
goto out;
}
@@ -461,7 +485,8 @@ glusterd_op_bitrot (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, "Unable to get volume name");
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get volume name");
goto out;
}
@@ -473,7 +498,8 @@ glusterd_op_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = dict_get_int32 (dict, "type", &type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get type from "
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get type from "
"dict");
goto out;
}
@@ -536,7 +562,8 @@ glusterd_op_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = glusterd_create_volfiles_and_notify_services (volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to re-create "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL, "Unable to re-create "
"volfiles");
ret = -1;
goto out;
@@ -545,7 +572,7 @@ glusterd_op_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = glusterd_store_volinfo (volinfo,
GLUSTERD_VOLINFO_VER_AC_INCREMENT);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG, "Failed to store volinfo for "
+ gf_msg_debug (this->name, 0, "Failed to store volinfo for "
"bitrot");
goto out;
}
@@ -577,7 +604,8 @@ glusterd_op_stage_bitrot (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, "Unable to get volume name");
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get volume name");
goto out;
}
@@ -596,7 +624,8 @@ glusterd_op_stage_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = dict_get_int32 (dict, "type", &type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get type for "
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get type for "
"operation");
*op_errstr = gf_strdup ("Staging stage failed for bitrot "
@@ -619,7 +648,8 @@ glusterd_op_stage_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
if (!ret) {
ret = dict_get_str (dict, "scrub-value", &scrub_cmd);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to "
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to "
"get scrub-value");
*op_errstr = gf_strdup ("Staging failed for "
"bitrot operation. "
@@ -646,8 +676,9 @@ glusterd_op_stage_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
out:
if (ret && op_errstr && *op_errstr)
- gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_STAGE_BITROT_FAIL, "%s", *op_errstr);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 0b3c24cd7c4..6491a1f9c5f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -130,7 +130,8 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count,
if ((volinfo->brick_count * stripe_count) == total_bricks) {
/* Change the volume type */
*type = GF_CLUSTER_TYPE_STRIPE;
- 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 "
"'distribute' to 'stripe'", volinfo->volname);
ret = 0;
@@ -149,7 +150,8 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count,
if (!(total_bricks % (volinfo->replica_count * stripe_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 "
"'replicate' to 'replicate-stripe'",
volinfo->volname);
@@ -193,7 +195,8 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count,
volinfo->replica_count)) ==
(total_bricks * volinfo->dist_leaf_count)) {
/* Change the dist_leaf_count */
- gf_log (THIS->name, GF_LOG_INFO,
+ gf_msg (THIS->name, GF_LOG_INFO, 0,
+ GD_MSG_STRIPE_COUNT_CHANGE_INFO,
"Changing the stripe count of "
"volume %s from %d to %d",
volinfo->volname,
@@ -229,7 +232,8 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count,
if ((volinfo->brick_count * replica_count) == total_bricks) {
/* Change the volume type */
*type = GF_CLUSTER_TYPE_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 "
"'distribute' to 'replica'", volinfo->volname);
ret = 0;
@@ -294,7 +298,8 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count,
(volinfo->brick_count * (replica_count *
volinfo->stripe_count))) {
/* Change the dist_leaf_count */
- gf_log (THIS->name, GF_LOG_INFO,
+ gf_msg (THIS->name, GF_LOG_INFO, 0,
+ GD_MSG_REPLICA_COUNT_CHANGE_INFO,
"Changing the replica count of "
"volume %s from %d to %d",
volinfo->volname, volinfo->replica_count,
@@ -426,7 +431,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
goto out;
}
- gf_log (this->name, GF_LOG_INFO, "Received add brick req");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_ADD_BRICK_REQ_RECVD, "Received add brick req");
if (cli_req.dict.dict_len) {
/* Unserialize the dictionary */
@@ -510,13 +516,15 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
if (volinfo->type == GF_CLUSTER_TYPE_TIER) {
snprintf (err_str, sizeof (err_str),
"Volume %s is already a tier.", volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_ALREADY_TIER, "%s", err_str);
ret = -1;
goto out;
}
if (glusterd_is_tiering_supported(err_str) == _gf_false) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VERSION_UNSUPPORTED,
"Tiering not supported at this version");
ret = -1;
goto out;
@@ -524,7 +532,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
ret = dict_get_int32 (dict, "hot-type", &type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
"failed to get type from dictionary");
goto out;
}
@@ -536,7 +545,8 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Add-brick operation is "
"not supported on a tiered volume %s", volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_UNSUPPORTED, "%s", err_str);
goto out;
}
@@ -804,7 +814,9 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
goto out;
}
- gf_log (this->name, GF_LOG_INFO, "Received rem brick req");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_REM_BRICK_REQ_RECVD,
+ "Received rem brick req");
if (cli_req.dict.dict_len) {
/* Unserialize the dictionary */
@@ -853,7 +865,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
if ((volinfo->type == GF_CLUSTER_TYPE_TIER) &&
(glusterd_is_tiering_supported(err_str) == _gf_false)) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VERSION_UNSUPPORTED,
"Tiering not supported at this version");
ret = -1;
goto out;
@@ -863,7 +876,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get cmd "
"ccommand");
- 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;
}
@@ -871,7 +885,8 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str),
"Removing brick from a Tier volume is not allowed");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_UNSUPPORTED, "%s", err_str);
goto out;
}
@@ -1735,7 +1750,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
snprintf (msg, sizeof(msg), "volume %s is not a tier "
"volume", 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_TIER, "%s", errstr);
goto out;
}
@@ -1833,7 +1849,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
snprintf (msg, sizeof(msg), "volume %s is not a tier "
"volume", 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_TIER, "%s", errstr);
goto out;
}
@@ -1892,7 +1909,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)
snprintf (msg, sizeof(msg), "volume %s is not a tier "
"volume", 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_TIER, "%s", errstr);
goto out;
}
case GF_OP_CMD_COMMIT_FORCE:
@@ -2073,7 +2091,7 @@ glusterd_op_add_brick (dict_t *dict, char **op_errstr)
}
if (dict_get(dict, "attach-tier")) {
- gf_log (THIS->name, GF_LOG_DEBUG, "Adding tier");
+ gf_msg_debug (THIS->name, 0, "Adding tier");
glusterd_op_perform_attach_tier (dict, volinfo, count, bricks);
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index df2dd6d653e..f0b20a01b1c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -21,6 +21,7 @@
#include "glusterd-utils.h"
#include "glusterd-nfs-svc.h"
#include "glusterd-volgen.h"
+#include "glusterd-messages.h"
#define MAXBUF 1024
#define DELIM "=\""
#define SHARED_STORAGE_MNT "/var/run/gluster/shared_storage/nfs-ganesha"
@@ -80,7 +81,7 @@ manage_service (char *action)
while (sc_list[i].binary != NULL) {
ret = stat (sc_list[i].binary, &stbuf);
if (ret == 0) {
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"%s found.", sc_list[i].binary);
if (strcmp (sc_list[i].binary, "/usr/bin/systemctl") == 0)
ret = sc_systemctl_action (&sc_list[i], action);
@@ -91,7 +92,8 @@ manage_service (char *action)
}
i++;
}
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_UNRECOGNIZED_SVC_MNGR,
"Could not %s NFS-Ganesha.Service manager for distro"
" not recognized.", action);
return ret;
@@ -108,7 +110,7 @@ glusterd_check_ganesha_export (glusterd_volinfo_t *volinfo) {
ret = glusterd_volinfo_get (volinfo, "ganesha.enable", &value);
if ((ret == 0) && value) {
if (strcmp (value, "on") == 0) {
- gf_log (THIS->name, GF_LOG_DEBUG, "ganesha.enable set"
+ gf_msg_debug (THIS->name, 0, "ganesha.enable set"
" to %s", value);
is_exported = _gf_true;
}
@@ -137,7 +139,9 @@ glusterd_check_ganesha_cmd (char *key, char *value, char **errstr, dict_t *dict)
}
ret = glusterd_handle_ganesha_op (dict, errstr, key, value);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Handling NFS-Ganesha"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_NFS_GNS_OP_HANDLE_FAIL,
+ "Handling NFS-Ganesha"
" op failed.");
}
}
@@ -169,7 +173,8 @@ glusterd_op_stage_set_ganesha (dict_t *dict, char **op_errstr)
value = dict_get_str_boolean (dict, "value", _gf_false);
if (value == -1) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
"value not present.");
goto out;
}
@@ -177,7 +182,8 @@ glusterd_op_stage_set_ganesha (dict_t *dict, char **op_errstr)
/*Ignoring the ret value and proceeding */
ret = dict_get_str (priv->opts, GLUSTERD_STORE_KEY_GANESHA_GLOBAL, &str);
if (ret == -1) {
- gf_log (this->name, GF_LOG_WARNING, "Global dict not present.");
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ GD_MSG_DICT_GET_FAILED, "Global dict not present.");
ret = 0;
goto out;
}
@@ -193,7 +199,8 @@ glusterd_op_stage_set_ganesha (dict_t *dict, char **op_errstr)
if (value) {
ret = start_ganesha (op_errstr);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_NFS_GNS_START_FAIL,
"Could not start NFS-Ganesha");
}
@@ -204,11 +211,11 @@ out:
if (ret) {
if (!(*op_errstr)) {
*op_errstr = gf_strdup ("Error, Validation Failed");
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Error, Cannot Validate option :%s",
GLUSTERD_STORE_KEY_GANESHA_GLOBAL);
} else {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Error, Cannot Validate option");
}
}
@@ -236,22 +243,25 @@ glusterd_op_set_ganesha (dict_t *dict, char **errstr)
ret = dict_get_str (dict, "key", &key);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Couldn't get key in global option set");
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
+ "Couldn't get key in global option set");
goto out;
}
ret = dict_get_str (dict, "value", &value);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
"Couldn't get value in global option set");
goto out;
}
ret = glusterd_handle_ganesha_op (dict, errstr, key, value);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Initial NFS-Ganesha set up failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_NFS_GNS_SETUP_FAIL,
+ "Initial NFS-Ganesha set up failed");
ret = -1;
goto out;
}
@@ -259,14 +269,15 @@ glusterd_op_set_ganesha (dict_t *dict, char **errstr)
GLUSTERD_STORE_KEY_GANESHA_GLOBAL,
value);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "Failed to set"
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to set"
" nfs-ganesha in dict.");
goto out;
}
ret = glusterd_get_next_global_opt_version_str (priv->opts,
&next_version);
if (ret) {
- gf_log (THIS->name, GF_LOG_DEBUG, "Could not fetch "
+ gf_msg_debug (THIS->name, 0, "Could not fetch "
" global op version");
goto out;
}
@@ -277,13 +288,13 @@ glusterd_op_set_ganesha (dict_t *dict, char **errstr)
ret = glusterd_store_options (this, priv->opts);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "Failed to store options");
- goto out;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_STORE_FAIL, "Failed to store options");
+ goto out;
}
out:
- gf_log (this->name, GF_LOG_DEBUG, "returning %d", ret);
+ gf_msg_debug (this->name, 0, "returning %d", ret);
return ret;
}
@@ -312,7 +323,8 @@ is_ganesha_host (void)
fp = fopen (GANESHA_HA_CONF, "r");
if (fp == NULL) {
- gf_log (this->name, GF_LOG_INFO, "couldn't open the file %s",
+ gf_msg (this->name, GF_LOG_INFO, errno,
+ GD_MSG_FILE_OP_FAILED, "couldn't open the file %s",
GANESHA_HA_CONF);
return _gf_false;
}
@@ -331,7 +343,9 @@ is_ganesha_host (void)
ret = gf_is_local_addr (host_from_file);
if (ret) {
- gf_log (this->name, GF_LOG_INFO, "ganesha host found "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_NFS_GNS_HOST_FOUND,
+ "ganesha host found "
"Hostname is %s", host_from_file);
}
@@ -360,7 +374,8 @@ check_host_list (void)
fp = fopen (GANESHA_HA_CONF, "r");
if (fp == NULL) {
- gf_log (this->name, GF_LOG_INFO, "couldn't open the file %s",
+ gf_msg (this->name, GF_LOG_INFO, errno,
+ GD_MSG_FILE_OP_FAILED, "couldn't open the file %s",
GANESHA_HA_CONF);
return 0;
}
@@ -382,7 +397,9 @@ check_host_list (void)
while (hostname != NULL) {
ret = gf_is_local_addr (hostname);
if (ret) {
- gf_log (this->name, GF_LOG_INFO, "ganesha host found "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_NFS_GNS_HOST_FOUND,
+ "ganesha host found "
"Hostname is %s", hostname);
break;
}
@@ -440,19 +457,22 @@ ganesha_manage_export (dict_t *dict, char *value, char **op_errstr)
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 = gf_string2boolean (value, &option);
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR, "invalid value.");
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "invalid value.");
goto out;
}
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_VOL_NOT_FOUND,
FMTSTR_CHECK_VOL_EXISTS, volname);
goto out;
}
@@ -475,7 +495,7 @@ ganesha_manage_export (dict_t *dict, char *value, char **op_errstr)
ret = dict_get_str_boolean (priv->opts,
GLUSTERD_STORE_KEY_GANESHA_GLOBAL, _gf_false);
if (ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG, "Failed to get "
+ gf_msg_debug (this->name, 0, "Failed to get "
"global option dict.");
gf_asprintf (op_errstr, "The option "
"nfs-ganesha should be "
@@ -494,7 +514,9 @@ ganesha_manage_export (dict_t *dict, char *value, char **op_errstr)
if (option) {
ret = create_export_config (volname, op_errstr);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to create"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_EXPORT_FILE_CREATE_FAIL,
+ "Failed to create"
"export file for NFS-Ganesha\n");
goto out;
}
@@ -585,7 +607,7 @@ teardown (char **op_errstr)
"cleanup", CONFDIR, NULL);
ret = runner_run (&runner);
if (ret)
- gf_log (THIS->name, GF_LOG_DEBUG, "Could not clean up"
+ gf_msg_debug (THIS->name, 0, "Could not clean up"
" NFS-Ganesha related config");
cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
@@ -594,7 +616,8 @@ teardown (char **op_errstr)
unexported, hence setting the appropriate key */
ret = dict_set_str (vol_opts, "ganesha.enable", "off");
if (ret)
- gf_log (THIS->name, GF_LOG_WARNING,
+ gf_msg (THIS->name, GF_LOG_WARNING, errno,
+ GD_MSG_DICT_SET_FAILED,
"Could not set ganesha.enable to off");
}
out:
@@ -667,8 +690,9 @@ pre_setup (char **op_errstr)
ret = mkdir (SHARED_STORAGE_MNT, 0775);
if ((-1 == ret) && (EEXIST != errno)) {
- gf_log ("THIS->name", GF_LOG_ERROR, "mkdir() failed on path %s,"
- "errno: %s", SHARED_STORAGE_MNT, strerror (errno));
+ gf_msg ("THIS->name", GF_LOG_ERROR, errno,
+ GD_MSG_CREATE_DIR_FAILED, "mkdir() failed on path %s,",
+ SHARED_STORAGE_MNT);
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index ab2f310b6a0..b8e02ba1332 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -697,7 +697,8 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
* not be held */
ret = dict_get_str (dict, "volname", &tmp);
if (ret) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, errno,
+ GD_MSG_DICT_GET_FAILED,
"No Volume name present. "
"Locks not being held.");
goto local_locking_done;
@@ -1162,7 +1163,9 @@ __glusterd_handle_cli_probe (rpcsvc_request_t *req)
goto out;
}
- gf_log ("glusterd", GF_LOG_INFO, "Received CLI probe req %s %d",
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_CLI_REQ_RECVD,
+ "Received CLI probe req %s %d",
hostname, port);
if (dict_get_str(this->options,"transport.socket.bind-address",
@@ -1273,7 +1276,9 @@ __glusterd_handle_cli_deprobe (rpcsvc_request_t *req)
}
}
- gf_log ("glusterd", GF_LOG_INFO, "Received CLI deprobe req");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_CLI_REQ_RECVD,
+ "Received CLI deprobe req");
ret = dict_get_str (dict, "hostname", &hostname);
if (ret) {
@@ -1392,7 +1397,9 @@ __glusterd_handle_cli_list_friends (rpcsvc_request_t *req)
goto out;
}
- gf_log ("glusterd", GF_LOG_INFO, "Received cli list req");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_CLI_REQ_RECVD,
+ "Received cli list req");
if (cli_req.dict.dict_len) {
/* Unserialize the dictionary */
@@ -1451,7 +1458,9 @@ __glusterd_handle_cli_get_volume (rpcsvc_request_t *req)
goto out;
}
- gf_log ("glusterd", GF_LOG_INFO, "Received get vol req");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_GET_VOL_REQ_RCVD,
+ "Received get vol req");
if (cli_req.dict.dict_len) {
/* Unserialize the dictionary */
@@ -1843,7 +1852,7 @@ __glusterd_handle_ganesha_cmd (rpcsvc_request_t *req)
}
}
- gf_log (this->name, GF_LOG_TRACE, "Received global option request");
+ gf_msg_trace (this->name, 0, "Received global option request");
ret = glusterd_op_begin_synctask (req, GD_OP_GANESHA, dict);
out:
@@ -2123,7 +2132,8 @@ __glusterd_handle_sync_volume (rpcsvc_request_t *req)
}
}
- gf_log (this->name, GF_LOG_INFO, "Received volume sync req "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_VOL_SYNC_REQ_RCVD, "Received volume sync req "
"for volume %s", (flags & GF_CLI_SYNC_ALL) ? "all" : volname);
if (gf_is_local_addr (hostname)) {
@@ -2515,7 +2525,8 @@ __glusterd_handle_incoming_friend_req (rpcsvc_request_t *req)
goto out;
}
- gf_log ("glusterd", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_PROBE_RCVD,
"Received probe from uuid: %s", uuid_utoa (friend_req.uuid));
ret = glusterd_handle_friend_req (req, friend_req.uuid,
friend_req.hostname, friend_req.port,
@@ -2564,7 +2575,8 @@ __glusterd_handle_incoming_unfriend_req (rpcsvc_request_t *req)
goto out;
}
- gf_log ("glusterd", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_UNFRIEND_REQ_RCVD,
"Received unfriend from uuid: %s", uuid_utoa (friend_req.uuid));
ret = glusterd_remote_hostname_get (req, remote_hostname,
@@ -2689,7 +2701,8 @@ __glusterd_handle_friend_update (rpcsvc_request_t *req)
goto out;
}
- gf_log ("glusterd", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_FRIEND_UPDATE_RCVD,
"Received friend update from uuid: %s", uuid_utoa (friend_req.uuid));
if (friend_req.friends.friends_len) {
@@ -2733,7 +2746,8 @@ __glusterd_handle_friend_update (rpcsvc_request_t *req)
gf_uuid_parse (uuid_buf, uuid);
if (!gf_uuid_compare (uuid, MY_UUID)) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_UUID_RECEIVED,
"Received my uuid as Friend");
i++;
continue;
@@ -2856,7 +2870,8 @@ __glusterd_handle_probe_query (rpcsvc_request_t *req)
else
port = GF_DEFAULT_BASE_PORT;
- gf_log ("glusterd", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_PROBE_RCVD,
"Received probe from uuid: %s", uuid_utoa (probe_req.uuid));
/* Check for uuid collision and handle it in a user friendly way by
@@ -2889,7 +2904,9 @@ __glusterd_handle_probe_query (rpcsvc_request_t *req)
rsp.op_ret = -1;
rsp.op_errno = GF_PROBE_ANOTHER_CLUSTER;
} else if (peerinfo == NULL) {
- gf_log ("glusterd", GF_LOG_INFO, "Unable to find peerinfo"
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_PEER_NOT_FOUND,
+ "Unable to find peerinfo"
" for host: %s (%d)", remote_hostname, port);
args.mode = GD_MODE_ON;
ret = glusterd_friend_add (remote_hostname, port,
@@ -2915,7 +2932,8 @@ respond:
(xdrproc_t)xdr_gd1_mgmt_probe_rsp);
ret = 0;
- gf_log ("glusterd", GF_LOG_INFO, "Responded to %s, op_ret: %d, "
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_RESPONSE_INFO, "Responded to %s, op_ret: %d, "
"op_errno: %d, ret: %d", remote_hostname,
rsp.op_ret, rsp.op_errno, ret);
@@ -2976,7 +2994,9 @@ __glusterd_handle_cli_profile_volume (rpcsvc_request_t *req)
goto out;
}
- gf_log (this->name, GF_LOG_INFO, "Received volume profile req "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_VOL_PROFILE_REQ_RCVD,
+ "Received volume profile req "
"for volume %s", volname);
ret = dict_get_int32 (dict, "op", &op);
if (ret) {
@@ -3025,7 +3045,8 @@ __glusterd_handle_getwd (rpcsvc_request_t *req)
priv = THIS->private;
GF_ASSERT (priv);
- gf_log ("glusterd", GF_LOG_INFO, "Received getwd req");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_GETWD_REQ_RCVD, "Received getwd req");
rsp.wd = priv->workdir;
@@ -3070,7 +3091,9 @@ __glusterd_handle_mount (rpcsvc_request_t *req)
goto out;
}
- gf_log ("glusterd", GF_LOG_INFO, "Received mount req");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_MOUNT_REQ_RCVD,
+ "Received mount req");
if (mnt_req.dict.dict_len) {
/* Unserialize the dictionary */
@@ -3154,7 +3177,9 @@ __glusterd_handle_umount (rpcsvc_request_t *req)
goto out;
}
- gf_log ("glusterd", GF_LOG_INFO, "Received umount req");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_UMOUNT_REQ_RCVD,
+ "Received umount req");
if (dict_get_str (this->options, "mountbroker-root",
&mountbroker_root) != 0) {
@@ -3476,7 +3501,8 @@ glusterd_friend_add (const char *hoststr, int port,
}
out:
- gf_log (this->name, GF_LOG_INFO, "connect returned %d", ret);
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_CONNECT_RETURNED, "connect returned %d", ret);
return ret;
}
@@ -3525,7 +3551,9 @@ glusterd_friend_add_from_peerinfo (glusterd_peerinfo_t *friend,
}
out:
- gf_log (this->name, GF_LOG_INFO, "connect returned %d", ret);
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_CONNECT_RETURNED,
+ "connect returned %d", ret);
return ret;
}
@@ -3544,7 +3572,8 @@ glusterd_probe_begin (rpcsvc_request_t *req, const char *hoststr, int port,
peerinfo = glusterd_peerinfo_find (NULL, hoststr);
if (peerinfo == NULL) {
- gf_log ("glusterd", GF_LOG_INFO, "Unable to find peerinfo"
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_PEER_NOT_FOUND, "Unable to find peerinfo"
" for host: %s (%d)", hoststr, port);
args.mode = GD_MODE_ON;
args.req = req;
@@ -3608,7 +3637,8 @@ glusterd_deprobe_begin (rpcsvc_request_t *req, const char *hoststr, int port,
peerinfo = glusterd_peerinfo_find (uuid, hoststr);
if (peerinfo == NULL) {
ret = -1;
- gf_log ("glusterd", GF_LOG_INFO, "Unable to find peerinfo"
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_PEER_NOT_FOUND, "Unable to find peerinfo"
" for host: %s %d", hoststr, port);
goto out;
}
@@ -3689,7 +3719,8 @@ glusterd_xfer_friend_remove_resp (rpcsvc_request_t *req, char *hostname, int por
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_friend_rsp);
- gf_log ("glusterd", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_RESPONSE_INFO,
"Responded to %s (%d), ret: %d", hostname, port, ret);
return ret;
}
@@ -3721,7 +3752,8 @@ glusterd_xfer_friend_add_resp (rpcsvc_request_t *req, char *myhostname,
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_friend_rsp);
- gf_log ("glusterd", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_RESPONSE_INFO,
"Responded to %s (%d), ret: %d", remote_hostname, port, ret);
GF_FREE (rsp.hostname);
return ret;
@@ -4207,7 +4239,8 @@ __glusterd_handle_status_volume (rpcsvc_request_t *req)
GD_MSG_VOL_NOT_FOUND, "%s", err_str);
goto out;
}
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_STATUS_VOL_REQ_RCVD,
"Received status volume req for volume %s", volname);
}
@@ -4330,7 +4363,8 @@ __glusterd_handle_cli_clearlocks_volume (rpcsvc_request_t *req)
goto out;
}
- gf_log (this->name, GF_LOG_INFO, "Received clear-locks volume req "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_CLRCLK_VOL_REQ_RCVD, "Received clear-locks volume req "
"for volume %s", volname);
ret = glusterd_op_begin_synctask (req, GD_OP_CLEARLOCKS_VOLUME, dict);
@@ -4452,7 +4486,9 @@ __glusterd_handle_barrier (rpcsvc_request_t *req)
"dict");
goto out;
}
- gf_log (this->name, GF_LOG_INFO, "Received barrier volume request for "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_BARRIER_VOL_REQ_RCVD,
+ "Received barrier volume request for "
"volume %s", volname);
ret = glusterd_op_begin_synctask (req, GD_OP_BARRIER, dict);
@@ -4807,7 +4843,8 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
* need to stop the brick
*/
if (brickinfo->snap_status == -1) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_SNAPSHOT_PENDING,
"Snapshot is pending on %s:%s. "
"Hence not starting the brick",
brickinfo->hostname,
diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.c b/xlators/mgmt/glusterd/src/glusterd-hooks.c
index 3e3f18959b0..220c6b022f5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-hooks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-hooks.c
@@ -28,6 +28,7 @@
#include "glusterd-utils.h"
#include "glusterd-store.h"
#include "glusterd-hooks.h"
+#include "glusterd-messages.h"
#include <fnmatch.h>
@@ -89,16 +90,18 @@ glusterd_hooks_create_hooks_directory (char *basedir)
snprintf (path, sizeof (path), "%s/hooks", basedir);
ret = mkdir_p (path, 0777, _gf_true);
if (ret) {
- gf_log (THIS->name, GF_LOG_CRITICAL, "Unable to create %s due"
- "to %s", path, strerror (errno));
+ gf_msg (THIS->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED, "Unable to create %s",
+ path);
goto out;
}
GLUSTERD_GET_HOOKS_DIR (version_dir, GLUSTERD_HOOK_VER, priv);
ret = mkdir_p (version_dir, 0777, _gf_true);
if (ret) {
- gf_log (THIS->name, GF_LOG_CRITICAL, "Unable to create %s due "
- "to %s", version_dir, strerror (errno));
+ gf_msg (THIS->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED, "Unable to create %s",
+ version_dir);
goto out;
}
@@ -111,9 +114,10 @@ glusterd_hooks_create_hooks_directory (char *basedir)
cmd_subdir);
ret = mkdir_p (path, 0777, _gf_true);
if (ret) {
- gf_log (THIS->name, GF_LOG_CRITICAL,
- "Unable to create %s due to %s",
- path, strerror (errno));
+ gf_msg (THIS->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
+ "Unable to create %s",
+ path);
goto out;
}
@@ -123,9 +127,10 @@ glusterd_hooks_create_hooks_directory (char *basedir)
version_dir, cmd_subdir, type_subdir[type]);
ret = mkdir_p (path, 0777, _gf_true);
if (ret) {
- gf_log (THIS->name, GF_LOG_CRITICAL,
- "Unable to create %s due to %s",
- path, strerror (errno));
+ gf_msg (THIS->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
+ "Unable to create %s",
+ path);
goto out;
}
}
@@ -176,10 +181,10 @@ glusterd_hooks_add_custom_args (dict_t *dict, runner_t *runner)
ret = dict_get_str (dict, "hooks_args", &hooks_args);
if (ret)
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"No Hooks Arguments.");
else
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Hooks Args = %s", hooks_args);
if (hooks_args)
@@ -337,7 +342,8 @@ glusterd_hooks_run_hooks (char *hooks_path, glusterd_op_t op, dict_t *op_ctx,
ret = dict_get_str (op_ctx, "volname", &volname);
if (ret) {
- gf_log (this->name, GF_LOG_CRITICAL, "Failed to get volname "
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_DICT_GET_FAILED, "Failed to get volname "
"from operation context");
goto out;
}
@@ -345,8 +351,10 @@ glusterd_hooks_run_hooks (char *hooks_path, glusterd_op_t op, dict_t *op_ctx,
hookdir = opendir (hooks_path);
if (!hookdir) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Failed to open dir %s, due "
- "to %s", hooks_path, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DIR_OP_FAILED,
+ "Failed to open dir %s",
+ hooks_path);
goto out;
}
@@ -390,7 +398,8 @@ glusterd_hooks_run_hooks (char *hooks_path, glusterd_op_t op, dict_t *op_ctx,
runner_argprintf (&runner, "--volname=%s", volname);
ret = glusterd_hooks_add_op_args (&runner, op, op_ctx, type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to add "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_ADD_OP_ARGS_FAIL, "Failed to add "
"command specific arguments");
goto out;
}
@@ -480,7 +489,8 @@ glusterd_hooks_stub_init (glusterd_hooks_stub_t **stub, char *scriptdir,
ret = 0;
out:
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to initialize "
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_POST_HOOK_STUB_INIT_FAIL, "Failed to initialize "
"post hooks stub");
glusterd_hooks_stub_cleanup (hooks_stub);
}
@@ -492,7 +502,8 @@ void
glusterd_hooks_stub_cleanup (glusterd_hooks_stub_t *stub)
{
if (!stub) {
- gf_log_callingfn (THIS->name, GF_LOG_WARNING,
+ gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0,
+ GD_MSG_HOOK_STUB_NULL,
"hooks_stub is NULL");
return;
}
@@ -582,7 +593,8 @@ glusterd_hooks_spawn_worker (xlator_t *this)
ret = pthread_create (&hooks_priv->worker, NULL, hooks_worker,
(void *)this);
if (ret)
- gf_log (this->name, GF_LOG_CRITICAL, "Failed to spawn post "
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_SPAWN_THREADS_FAIL, "Failed to spawn post "
"hooks worker thread");
out:
return ret;
diff --git a/xlators/mgmt/glusterd/src/glusterd-log-ops.c b/xlators/mgmt/glusterd/src/glusterd-log-ops.c
index 76116377496..b2d4582a207 100644
--- a/xlators/mgmt/glusterd/src/glusterd-log-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-log-ops.c
@@ -72,7 +72,9 @@ __glusterd_handle_log_rotate (rpcsvc_request_t *req)
goto out;
}
- gf_log (this->name, GF_LOG_INFO, "Received log rotate req "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_LOG_ROTATE_REQ_RECVD,
+ "Received log rotate req "
"for volume %s", volname);
ret = dict_set_uint64 (dict, "rotate-key", (uint64_t)time (NULL));
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
index b7729fb125c..ea44e1897f6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-messages.h
+++ b/xlators/mgmt/glusterd/src/glusterd-messages.h
@@ -45,7 +45,7 @@
*/
#define GLUSTERD_COMP_BASE GLFS_MSGID_GLUSTERD
-#define GLFS_NUM_MESSAGES 459
+#define GLFS_NUM_MESSAGES 563
#define GLFS_MSGID_END (GLUSTERD_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
#define glfs_msg_start_x GLFS_COMP_BASE, "Invalid: Start of messages"
@@ -3728,7 +3728,833 @@
* @recommendedaction
*
*/
+#define GD_MSG_BITROT_NOT_RUNNING (GLUSTERD_COMP_BASE + 460)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_SCRUBBER_NOT_RUNNING (GLUSTERD_COMP_BASE + 461)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_SRC_BRICK_PORT_UNAVAIL (GLUSTERD_COMP_BASE + 462)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_BITD_INIT_FAIL (GLUSTERD_COMP_BASE + 463)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_SCRUB_INIT_FAIL (GLUSTERD_COMP_BASE + 464)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_VAR_RUN_DIR_INIT_FAIL (GLUSTERD_COMP_BASE + 465)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_VAR_RUN_DIR_FIND_FAIL (GLUSTERD_COMP_BASE + 466)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_SCRUBSVC_RECONF_FAIL (GLUSTERD_COMP_BASE + 467)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_BITDSVC_RECONF_FAIL (GLUSTERD_COMP_BASE + 468)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_NFS_GNS_START_FAIL (GLUSTERD_COMP_BASE + 469)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_NFS_GNS_SETUP_FAIL (GLUSTERD_COMP_BASE + 470)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_UNRECOGNIZED_SVC_MNGR (GLUSTERD_COMP_BASE + 471)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_NFS_GNS_OP_HANDLE_FAIL (GLUSTERD_COMP_BASE + 472)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_EXPORT_FILE_CREATE_FAIL (GLUSTERD_COMP_BASE + 473)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_NFS_GNS_HOST_FOUND (GLUSTERD_COMP_BASE + 474)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_REBALANCE_CMD_IN_TIER_VOL (GLUSTERD_COMP_BASE + 475)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_INCOMPATIBLE_VALUE (GLUSTERD_COMP_BASE + 476)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_GENERATED_UUID (GLUSTERD_COMP_BASE + 477)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_FILE_DESC_LIMIT_SET (GLUSTERD_COMP_BASE + 478)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_CURR_WORK_DIR_INFO (GLUSTERD_COMP_BASE + 479)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_STRIPE_COUNT_CHANGE_INFO (GLUSTERD_COMP_BASE + 480)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_REPLICA_COUNT_CHANGE_INFO (GLUSTERD_COMP_BASE + 481)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_ADD_BRICK_REQ_RECVD (GLUSTERD_COMP_BASE + 482)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_VOL_ALREADY_TIER (GLUSTERD_COMP_BASE + 483)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_REM_BRICK_REQ_RECVD (GLUSTERD_COMP_BASE + 484)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_VOL_NOT_TIER (GLUSTERD_COMP_BASE + 485)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_LOG_ROTATE_REQ_RECVD (GLUSTERD_COMP_BASE + 486)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_CLI_REQ_RECVD (GLUSTERD_COMP_BASE + 487)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_GET_VOL_REQ_RCVD (GLUSTERD_COMP_BASE + 488)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_VOL_SYNC_REQ_RCVD (GLUSTERD_COMP_BASE + 489)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_PROBE_RCVD (GLUSTERD_COMP_BASE + 490)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_UNFRIEND_REQ_RCVD (GLUSTERD_COMP_BASE + 491)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_FRIEND_UPDATE_RCVD (GLUSTERD_COMP_BASE + 492)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_RESPONSE_INFO (GLUSTERD_COMP_BASE + 493)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_VOL_PROFILE_REQ_RCVD (GLUSTERD_COMP_BASE + 494)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_GETWD_REQ_RCVD (GLUSTERD_COMP_BASE + 495)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_MOUNT_REQ_RCVD (GLUSTERD_COMP_BASE + 496)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_UMOUNT_REQ_RCVD (GLUSTERD_COMP_BASE + 497)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_CONNECT_RETURNED (GLUSTERD_COMP_BASE + 498)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_STATUS_VOL_REQ_RCVD (GLUSTERD_COMP_BASE + 499)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_CLRCLK_VOL_REQ_RCVD (GLUSTERD_COMP_BASE + 500)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_BARRIER_VOL_REQ_RCVD (GLUSTERD_COMP_BASE + 501)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_UUID_RECEIVED (GLUSTERD_COMP_BASE + 502)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_REPLACE_BRK_COMMIT_FORCE_REQ_RCVD (GLUSTERD_COMP_BASE + 503)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_BRK_PORT_NO_ADD_INDO (GLUSTERD_COMP_BASE + 504)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_REPLACE_BRK_REQ_RCVD (GLUSTERD_COMP_BASE + 505)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_ADD_OP_ARGS_FAIL (GLUSTERD_COMP_BASE + 506)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_POST_HOOK_STUB_INIT_FAIL (GLUSTERD_COMP_BASE + 507)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_HOOK_STUB_NULL (GLUSTERD_COMP_BASE + 508)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_SPAWN_THREADS_FAIL (GLUSTERD_COMP_BASE + 509)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_STALE_VOL_DELETE_INFO (GLUSTERD_COMP_BASE + 510)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_PROBE_REQ_RESP_RCVD (GLUSTERD_COMP_BASE + 511)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_HOST_PRESENT_ALREADY (GLUSTERD_COMP_BASE + 512)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_OP_VERS_INFO (GLUSTERD_COMP_BASE + 513)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_OP_VERS_SET_INFO (GLUSTERD_COMP_BASE + 514)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_NEW_NODE_STATE_CREATION (GLUSTERD_COMP_BASE + 515)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_ALREADY_MOUNTED (GLUSTERD_COMP_BASE + 516)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_SHARED_STRG_VOL_OPT_VALIDATE_FAIL (GLUSTERD_COMP_BASE + 517)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_NFS_GNS_STOP_FAIL (GLUSTERD_COMP_BASE + 518)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_NFS_GNS_RESET_FAIL (GLUSTERD_COMP_BASE + 519)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_SHARED_STRG_SET_FAIL (GLUSTERD_COMP_BASE + 520)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_VOL_TRANSPORT_TYPE_CHANGE (GLUSTERD_COMP_BASE + 521)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_PEER_COUNT_GET_FAIL (GLUSTERD_COMP_BASE + 522)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_INSUFFICIENT_UP_NODES (GLUSTERD_COMP_BASE + 523)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_OP_STAGE_STATS_VOL_FAIL (GLUSTERD_COMP_BASE + 524)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_VOL_ID_SET_FAIL (GLUSTERD_COMP_BASE + 525)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_OP_STAGE_RESET_VOL_FAIL (GLUSTERD_COMP_BASE + 526)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_OP_STAGE_BITROT_FAIL (GLUSTERD_COMP_BASE + 527)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_OP_STAGE_QUOTA_FAIL (GLUSTERD_COMP_BASE + 528)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_OP_STAGE_DELETE_VOL_FAIL (GLUSTERD_COMP_BASE + 529)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_HANDLE_HEAL_CMD_FAIL (GLUSTERD_COMP_BASE + 530)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_CLRCLK_SND_CMD_FAIL (GLUSTERD_COMP_BASE + 531)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_DISPERSE_CLUSTER_FOUND (GLUSTERD_COMP_BASE + 532)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_HEAL_VOL_REQ_RCVD (GLUSTERD_COMP_BASE + 533)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_STATEDUMP_VOL_REQ_RCVD (GLUSTERD_COMP_BASE + 534)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_THINPOOLS_FOR_THINLVS (GLUSTERD_COMP_BASE + 535)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_OP_STAGE_CREATE_VOL_FAIL (GLUSTERD_COMP_BASE + 536)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_OP_STAGE_START_VOL_FAIL (GLUSTERD_COMP_BASE + 537)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_NFS_GNS_UNEXPRT_VOL_FAIL (GLUSTERD_COMP_BASE + 538)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_TASK_ID_INFO (GLUSTERD_COMP_BASE + 539)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_DEREGISTER_SUCCESS (GLUSTERD_COMP_BASE + 540)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_STATEDUMP_OPTS_RCVD (GLUSTERD_COMP_BASE + 541)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_STATEDUMP_INFO (GLUSTERD_COMP_BASE + 542)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_RECOVERING_CORRUPT_CONF (GLUSTERD_COMP_BASE + 543)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_RETRIEVED_UUID (GLUSTERD_COMP_BASE + 544)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_XLATOR_CREATE_FAIL (GLUSTERD_COMP_BASE + 545)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_GRAPH_ENTRY_ADD_FAIL (GLUSTERD_COMP_BASE + 546)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_ERROR_ENCOUNTERED (GLUSTERD_COMP_BASE + 547)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_FILTER_RUN_FAILED (GLUSTERD_COMP_BASE + 548)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_DEFAULT_OPT_INFO (GLUSTERD_COMP_BASE + 549)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_MARKER_STATUS_GET_FAIL (GLUSTERD_COMP_BASE + 550)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_MARKER_DISABLE_FAIL (GLUSTERD_COMP_BASE + 551)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_GRAPH_FEATURE_ADD_FAIL (GLUSTERD_COMP_BASE + 552)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_XLATOR_SET_OPT_FAIL (GLUSTERD_COMP_BASE + 553)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_BUILD_GRAPH_FAILED (GLUSTERD_COMP_BASE + 554)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_XML_TEXT_WRITE_FAIL (GLUSTERD_COMP_BASE + 555)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_XML_DOC_START_FAIL (GLUSTERD_COMP_BASE + 556)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_XML_ELE_CREATE_FAIL (GLUSTERD_COMP_BASE + 557)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_VOLUME_INCONSISTENCY (GLUSTERD_COMP_BASE + 558)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_XLATOR_LINK_FAIL (GLUSTERD_COMP_BASE + 559)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_REMOTE_HOST_GET_FAIL (GLUSTERD_COMP_BASE + 560)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_GRAPH_SET_OPT_FAIL (GLUSTERD_COMP_BASE + 561)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_ROOT_SQUASH_ENABLED (GLUSTERD_COMP_BASE + 562)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_ROOT_SQUASH_FAILED (GLUSTERD_COMP_BASE + 563)
+
/*------------*/
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
-
#endif /* !_GLUSTERD_MESSAGES_H_ */
+
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 06d9923ea14..492b3672869 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -235,7 +235,8 @@ glusterd_get_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo)
GF_ASSERT (priv);
if (!txn_id || !opinfo) {
- gf_log_callingfn (this->name, GF_LOG_ERROR,
+ gf_msg_callingfn (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_ID_GET_FAIL,
"Empty transaction id or opinfo received.");
ret = -1;
goto out;
@@ -245,7 +246,8 @@ glusterd_get_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo)
uuid_utoa (*txn_id),
(void **) &opinfo_obj);
if (ret) {
- gf_log_callingfn (this->name, GF_LOG_ERROR,
+ gf_msg_callingfn (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
"Unable to get transaction opinfo "
"for transaction ID : %s",
uuid_utoa (*txn_id));
@@ -278,7 +280,8 @@ glusterd_set_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo)
GF_ASSERT (priv);
if (!txn_id) {
- gf_log_callingfn (this->name, GF_LOG_ERROR,
+ gf_msg_callingfn (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_ID_GET_FAIL,
"Empty transaction id received.");
ret = -1;
goto out;
@@ -299,7 +302,8 @@ glusterd_set_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo)
uuid_utoa (*txn_id), opinfo_obj,
sizeof(glusterd_txn_opinfo_obj));
if (ret) {
- gf_log_callingfn (this->name, GF_LOG_ERROR,
+ gf_msg_callingfn (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
"Unable to set opinfo for transaction"
" ID : %s", uuid_utoa (*txn_id));
goto out;
@@ -784,7 +788,8 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr)
snprintf (errstr, PATH_MAX,
"Invalid option(%s). Valid options "
"are 'enable' and 'disable'", value);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s", errstr);
ret = -1;
goto out;
}
@@ -798,7 +803,8 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr)
snprintf (errstr, PATH_MAX,
"Shared storage volume("GLUSTER_SHARED_STORAGE
") already exists.");
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_ALREADY_EXIST, "%s", errstr);
ret = -1;
goto out;
}
@@ -807,7 +813,8 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr)
if (ret) {
snprintf (errstr, PATH_MAX,
"Failed to calculate number of connected peers.");
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEER_COUNT_GET_FAIL, "%s", errstr);
goto out;
}
@@ -815,7 +822,8 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr)
snprintf (errstr, PATH_MAX,
"More than one node should "
"be up/present in the cluster to enable this option");
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_INSUFFICIENT_UP_NODES, "%s", errstr);
ret = -1;
goto out;
}
@@ -1168,7 +1176,8 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
ret = glusterd_validate_shared_storage (key, value, errstr);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SHARED_STRG_VOL_OPT_VALIDATE_FAIL,
"Failed to validate shared "
"storage volume options");
goto out;
@@ -1433,7 +1442,8 @@ out:
GF_FREE (key_fixed);
if (msg[0] != '\0') {
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_STAGE_RESET_VOL_FAIL, "%s", msg);
*op_errstr = gf_strdup (msg);
}
@@ -1762,7 +1772,8 @@ glusterd_op_stage_stats_volume (dict_t *dict, char **op_errstr)
ret = 0;
out:
if (msg[0] != '\0') {
- gf_log ("glusterd", GF_LOG_ERROR, "%s", msg);
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_OP_STAGE_STATS_VOL_FAIL, "%s", msg);
*op_errstr = gf_strdup (msg);
}
gf_msg_debug ("glusterd", 0, "Returning %d", ret);
@@ -1940,11 +1951,13 @@ glusterd_op_reset_all_volume_options (xlator_t *this, dict_t *dict)
if (option) {
ret = tear_down_cluster();
if (ret == -1)
- gf_log (THIS->name, GF_LOG_WARNING,
+ gf_msg (THIS->name, GF_LOG_WARNING, errno,
+ GD_MSG_DICT_GET_FAILED,
"Could not tear down NFS-Ganesha cluster");
ret = stop_ganesha (&op_errstr);
if (ret)
- gf_log (THIS->name, GF_LOG_WARNING,
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ GD_MSG_NFS_GNS_STOP_FAIL,
"Could not stop NFS-Ganesha service");
}
@@ -2059,7 +2072,8 @@ glusterd_op_reset_volume (dict_t *dict, char **op_rspstr)
if (ret) {
ret = ganesha_manage_export (dict, "off", op_rspstr);
if (ret) {
- gf_log (THIS->name, GF_LOG_WARNING,
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ GD_MSG_NFS_GNS_RESET_FAIL,
"Could not reset ganesha.enable key");
ret = 0;
}
@@ -2170,7 +2184,8 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,
ret = glusterd_set_shared_storage (dict, key, value, op_errstr);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SHARED_STRG_SET_FAIL,
"Failed to set shared storage option");
goto out;
}
@@ -2287,7 +2302,8 @@ glusterd_set_shared_storage (dict_t *dict, char *key, char *value,
"storage brick(%s). "
"Reason: %s", ss_brick_path,
strerror (errno));
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DIR_OP_FAILED, "%s", errstr);
ret = -1;
goto out;
}
@@ -2299,7 +2315,8 @@ glusterd_set_shared_storage (dict_t *dict, char *key, char *value,
"storage brick(%s). "
"Reason: %s", ss_brick_path,
strerror (errno));
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_CREATE_DIR_FAILED, "%s", errstr);
goto out;
}
@@ -2315,7 +2332,8 @@ glusterd_set_shared_storage (dict_t *dict, char *key, char *value,
ret = dict_set_dynstr_with_alloc (dict, "hooks_args", hooks_args);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set"
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to set"
" hooks_args in dict.");
goto out;
}
@@ -2437,7 +2455,8 @@ glusterd_op_set_volume (dict_t *dict, char **errstr)
}
if (strcmp (key, "config.transport") == 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_VOL_TRANSPORT_TYPE_CHANGE,
"changing transport-type for volume %s to %s",
volname, value);
ret = 0;
@@ -3590,7 +3609,8 @@ glusterd_op_ac_lock (glusterd_op_sm_event_t *event, void *ctx)
ret = glusterd_mgmt_v3_lock (globalname, lock_ctx->uuid,
&op_errno, "global");
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_LOCK_GET_FAIL,
"Unable to acquire lock for %s",
globalname);
@@ -3653,7 +3673,8 @@ glusterd_op_ac_unlock (glusterd_op_sm_event_t *event, void *ctx)
ret = glusterd_mgmt_v3_unlock (globalname, lock_ctx->uuid,
"global");
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_UNLOCK_FAIL,
"Unable to release lock for %s",
globalname);
@@ -3745,7 +3766,8 @@ glusterd_dict_set_volid (dict_t *dict, char *volname, char **op_errstr)
}
out:
if (msg[0] != '\0') {
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_ID_SET_FAIL, "%s", msg);
*op_errstr = gf_strdup (msg);
}
return ret;
@@ -3985,7 +4007,8 @@ glusterd_op_build_payload (dict_t **req, char **op_errstr, dict_t *op_ctx)
if (do_common) {
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, -ret,
+ GD_MSG_DICT_GET_FAILED,
"volname is not present in "
"operation ctx");
goto out;
@@ -5641,14 +5664,15 @@ glusterd_bricks_select_remove_brick (dict_t *dict, char **op_errstr,
ret = dict_get_int32 (dict, "count", &count);
if (ret) {
- gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, -ret,
GD_MSG_DICT_GET_FAILED, "Unable to get count");
goto out;
}
ret = dict_get_int32 (dict, "command", &command);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR, "Unable to get command");
+ gf_msg ("glusterd", GF_LOG_ERROR, -ret,
+ GD_MSG_DICT_GET_FAILED, "Unable to get command");
goto out;
}
@@ -6555,7 +6579,8 @@ glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
ret = 0;
} else if ((cmd & GF_CLI_STATUS_BITD) != 0) {
if (!priv->bitd_svc.online) {
- gf_log (this->name, GF_LOG_ERROR, "Bitrot is not "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BITROT_NOT_RUNNING, "Bitrot is not "
"running");
ret = -1;
goto out;
@@ -6574,7 +6599,8 @@ glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
ret = 0;
} else if ((cmd & GF_CLI_STATUS_SCRUB) != 0) {
if (!priv->scrub_svc.online) {
- gf_log (this->name, GF_LOG_ERROR, "Scrubber is not "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SCRUBBER_NOT_RUNNING, "Scrubber is not "
"running");
ret = -1;
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
index 51003fb44eb..607ad3d38be 100644
--- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
@@ -990,7 +990,7 @@ glusterd_peerinfo_find_by_generation (uint32_t generation) {
cds_list_for_each_entry_rcu (entry, &priv->peers, uuid_list) {
if (entry->generation == generation) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Friend found... state: %s",
glusterd_friend_sm_state_name_get (entry->state.state));
found = entry; /* Probably should be rcu_dereferenced */
@@ -1000,7 +1000,7 @@ glusterd_peerinfo_find_by_generation (uint32_t generation) {
rcu_read_unlock ();
if (!found)
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Friend with generation: %"PRIu32", not found",
generation);
return found;
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
index f4fc8312a45..22dd3d38d86 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
@@ -405,7 +405,9 @@ glusterd_inode_quota_enable (glusterd_volinfo_t *volinfo, char **op_errstr,
ret = dict_set_dynstr_with_alloc (volinfo->dict,
VKEY_FEATURES_INODE_QUOTA, "on");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "dict set failed");
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
+ "dict set failed");
goto out;
}
@@ -471,7 +473,8 @@ glusterd_quota_enable (glusterd_volinfo_t *volinfo, char **op_errstr,
"features.quota-deem-statfs",
"on");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "setting quota-deem-statfs"
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "setting quota-deem-statfs"
"in volinfo failed");
goto out;
}
@@ -843,21 +846,25 @@ out:
} else if (!ret) {
ret = gf_store_rename_tmppath (volinfo->quota_conf_shandle);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to rename "
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_FILE_OP_FAILED,
+ "Failed to rename "
"quota conf file");
return ret;
}
ret = glusterd_compute_cksum (volinfo, _gf_true);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_CKSUM_COMPUTE_FAIL, "Failed to "
"compute cksum for quota conf file");
return ret;
}
ret = glusterd_store_save_quota_version_and_cksum (volinfo);
if (ret)
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_QUOTA_CKSUM_VER_STORE_FAIL, "Failed to "
"store quota version and cksum");
}
@@ -1828,7 +1835,8 @@ glusterd_op_stage_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
out:
if (ret && op_errstr && *op_errstr)
- gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_STAGE_QUOTA_FAIL, "%s", *op_errstr);
gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index 2078529ae12..7e8246c718a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -429,7 +429,9 @@ glusterd_rebalance_cmd_validate (int cmd, char *volname,
ret = glusterd_disallow_op_for_tier (*volinfo, GD_OP_REBALANCE, cmd);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR, "Received rebalance command "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_REBALANCE_CMD_IN_TIER_VOL,
+ "Received rebalance command "
"on Tier volume %s", volname);
snprintf (op_errstr, len, "Rebalance operations are not "
"supported on a tiered volume");
@@ -555,13 +557,16 @@ glusterd_brick_validation (dict_t *dict, char *key, data_t *value,
ret = glusterd_volume_brickinfo_get_by_brick (value->data, volinfo,
&brickinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Incorrect brick %s for "
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_BRICK_NOT_FOUND,
+ "Incorrect brick %s for "
"volume %s", value->data, volinfo->volname);
return ret;
}
if (!brickinfo->decommissioned) {
- gf_log (this->name, GF_LOG_ERROR, "Incorrect brick %s for "
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_BRICK_NOT_FOUND, "Incorrect brick %s for "
"volume %s", value->data, volinfo->volname);
ret = -1;
return ret;
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index 2180ace4229..be9f9aba6b9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -66,7 +66,9 @@ __glusterd_handle_replace_brick (rpcsvc_request_t *req)
goto out;
}
- gf_log (this->name, GF_LOG_INFO, "Received replace brick req");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_REPLACE_BRK_REQ_RCVD,
+ "Received replace brick req");
if (cli_req.dict.dict_len) {
/* Unserialize the dictionary */
@@ -123,7 +125,9 @@ __glusterd_handle_replace_brick (rpcsvc_request_t *req)
}
gf_msg_debug (this->name, 0, "dst brick=%s", dst_brick);
- gf_log (this->name, GF_LOG_INFO, "Received replace brick commit-force "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_REPLACE_BRK_COMMIT_FORCE_REQ_RCVD,
+ "Received replace brick commit-force "
"request operation");
ret = glusterd_op_begin (req, GD_OP_REPLACE_BRICK, dict,
@@ -331,7 +335,7 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
ret = dict_set_int32 (rsp_dict, "src-brick-port",
src_brickinfo->port);
if (ret) {
- gf_msg_debug ("", 0,
+ gf_msg_debug (this->name, 0,
"Could not set src-brick-port=%d",
src_brickinfo->port);
}
@@ -370,7 +374,8 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
if (ret) {
*op_errstr = gf_strdup (msg);
ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_VALIDATE_FAIL, "%s", *op_errstr);
goto out;
}
@@ -507,7 +512,8 @@ rb_update_srcbrick_port (glusterd_volinfo_t *volinfo,
src_brickinfo->port = src_port;
if (gf_is_local_addr (src_brickinfo->hostname)) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_BRK_PORT_NO_ADD_INDO,
"adding src-brick port no");
if (volinfo->transport_type == GF_TRANSPORT_RDMA) {
@@ -520,7 +526,8 @@ rb_update_srcbrick_port (glusterd_volinfo_t *volinfo,
src_brickinfo->port = pmap_registry_search (this,
brickname, GF_PMAP_PORT_BRICKSERVER);
if (!src_brickinfo->port) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SRC_BRICK_PORT_UNAVAIL,
"Src brick port not available");
ret = -1;
goto out;
@@ -530,7 +537,7 @@ rb_update_srcbrick_port (glusterd_volinfo_t *volinfo,
ret = dict_set_int32 (rsp_dict, "src-brick-port",
src_brickinfo->port);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Could not set src-brick port no");
goto out;
}
@@ -541,7 +548,7 @@ rb_update_srcbrick_port (glusterd_volinfo_t *volinfo,
ret = dict_set_int32 (ctx, "src-brick-port",
src_brickinfo->port);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Could not set src-brick port no");
goto out;
}
@@ -568,14 +575,15 @@ rb_update_dstbrick_port (glusterd_brickinfo_t *dst_brickinfo, dict_t *rsp_dict,
dst_brickinfo->port = dst_port;
if (gf_is_local_addr (dst_brickinfo->hostname)) {
- gf_log ("", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_BRK_PORT_NO_ADD_INDO,
"adding dst-brick port no");
if (rsp_dict) {
ret = dict_set_int32 (rsp_dict, "dst-brick-port",
dst_brickinfo->port);
if (ret) {
- gf_log ("", GF_LOG_DEBUG,
+ gf_msg_debug ("glusterd", 0,
"Could not set dst-brick port no in rsp dict");
goto out;
}
@@ -586,7 +594,7 @@ rb_update_dstbrick_port (glusterd_brickinfo_t *dst_brickinfo, dict_t *rsp_dict,
ret = dict_set_int32 (ctx, "dst-brick-port",
dst_brickinfo->port);
if (ret) {
- gf_log ("", GF_LOG_DEBUG,
+ gf_msg_debug ("glusterd", 0,
"Could not set dst-brick port no");
goto out;
}
@@ -670,7 +678,7 @@ glusterd_op_perform_replace_brick (glusterd_volinfo_t *volinfo,
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -786,7 +794,7 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
}
if (gf_is_local_addr (dst_brickinfo->hostname)) {
- gf_log (this->name, GF_LOG_DEBUG, "I AM THE DESTINATION HOST");
+ gf_msg_debug (this->name, 0, "I AM THE DESTINATION HOST");
ret = rb_kill_destination_brick (volinfo, dst_brickinfo);
if (ret) {
gf_msg (this->name, GF_LOG_CRITICAL, 0,
@@ -798,7 +806,8 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
ret = glusterd_svcs_stop (volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_NFS_SERVER_STOP_FAIL,
"Unable to stop nfs server, ret: %d", ret);
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index e987208cfe0..49c1c9ce2cc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -248,7 +248,8 @@ __glusterd_probe_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_PROBE_REQ_RESP_RCVD,
"Received probe resp from uuid: %s, host: %s",
uuid_utoa (rsp.uuid), rsp.hostname);
if (rsp.op_ret != 0) {
@@ -275,7 +276,8 @@ __glusterd_probe_cbk (struct rpc_req *req, struct iovec *iov,
peerinfo = glusterd_peerinfo_find (rsp.uuid, rsp.hostname);
if (peerinfo == NULL) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Could not find peerd %s(%s)",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEER_NOT_FOUND, "Could not find peerd %s(%s)",
rsp.hostname, uuid_utoa (rsp.uuid));
goto unlock;
}
@@ -358,7 +360,8 @@ reply:
goto unlock;
} else if (strncasecmp (rsp.hostname, peerinfo->hostname, 1024)) {
- gf_log (THIS->name, GF_LOG_INFO, "Host: %s with uuid: %s "
+ gf_msg (THIS->name, GF_LOG_INFO, 0,
+ GD_MSG_HOST_PRESENT_ALREADY, "Host: %s with uuid: %s "
"already present in cluster with alias hostname: %s",
rsp.hostname, uuid_utoa (rsp.uuid), peerinfo->hostname);
@@ -407,7 +410,8 @@ cont:
ret = glusterd_friend_sm_inject_event (event);
- gf_log ("glusterd", GF_LOG_INFO, "Received resp to probe req");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_PROBE_REQ_RESP_RCVD, "Received resp to probe req");
unlock:
rcu_read_unlock ();
@@ -468,7 +472,8 @@ __glusterd_friend_add_cbk (struct rpc_req * req, struct iovec *iov,
op_ret = rsp.op_ret;
op_errno = rsp.op_errno;
- gf_log ("glusterd", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_RESPONSE_INFO,
"Received %s from uuid: %s, host: %s, port: %d",
(op_ret)?"RJT":"ACC", uuid_utoa (rsp.uuid), rsp.hostname, rsp.port);
@@ -585,7 +590,8 @@ __glusterd_friend_remove_cbk (struct rpc_req * req, struct iovec *iov,
op_ret = rsp.op_ret;
op_errno = rsp.op_errno;
- gf_log ("glusterd", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_RESPONSE_INFO,
"Received %s from uuid: %s, host: %s, port: %d",
(op_ret)?"RJT":"ACC", uuid_utoa (rsp.uuid), rsp.hostname, rsp.port);
@@ -681,7 +687,8 @@ __glusterd_friend_update_cbk (struct rpc_req *req, struct iovec *iov,
ret = 0;
out:
- gf_log (this->name, GF_LOG_INFO, "Received %s from uuid: %s",
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_RESPONSE_INFO, "Received %s from uuid: %s",
(ret)?"RJT":"ACC", uuid_utoa (rsp.uuid));
GLUSTERD_STACK_DESTROY (((call_frame_t *)myframe));
@@ -1521,7 +1528,8 @@ glusterd_rpc_friend_add (call_frame_t *frame, xlator_t *this,
if (!peerinfo) {
rcu_read_unlock ();
ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Could not find peer %s(%s)",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEER_NOT_FOUND, "Could not find peer %s(%s)",
event->peername, uuid_utoa (event->peerid));
goto out;
}
@@ -1545,7 +1553,8 @@ glusterd_rpc_friend_add (call_frame_t *frame, xlator_t *this,
"hostname_in_cluster",
peerinfo->hostname);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
"Unable to add hostname of the peer");
goto out;
}
@@ -1618,7 +1627,8 @@ glusterd_rpc_friend_remove (call_frame_t *frame, xlator_t *this,
if (!peerinfo) {
rcu_read_unlock ();
ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Could not find peer %s(%s)",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEER_NOT_FOUND, "Could not find peer %s(%s)",
event->peername, uuid_utoa (event->peerid));
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c b/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c
index 8d1133f9f55..36863e2a248 100644
--- a/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c
@@ -44,12 +44,13 @@ glusterd_scrubsvc_create_volfile ()
ret = glusterd_create_global_volfile (build_scrub_graph,
filepath, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to create volfile");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL, "Failed to create volfile");
goto out;
}
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -80,7 +81,7 @@ glusterd_scrubsvc_manager (glusterd_svc_t *svc, void *data, int flags)
}
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-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index 92118745903..ec8d50d6062 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -619,7 +619,8 @@ glusterd_peer_detach_cleanup (glusterd_conf_t *priv)
*/
if (!glusterd_friend_contains_vol_bricks (volinfo,
MY_UUID)) {
- gf_log (THIS->name, GF_LOG_INFO,
+ gf_msg (THIS->name, GF_LOG_INFO, 0,
+ GD_MSG_STALE_VOL_DELETE_INFO,
"Deleting stale volume %s", volinfo->volname);
ret = glusterd_delete_volume (volinfo);
if (ret) {
@@ -870,7 +871,7 @@ glusterd_ac_handle_friend_add_req (glusterd_friend_sm_event_t *event, void *ctx)
ret = dict_get_str (ev_ctx->vols, "hostname_in_cluster",
&hostname);
if (ret || !hostname) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Unable to fetch local hostname from peer");
} else
strncpy (local_node_hostname, hostname,
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
index 0b061d0806d..8a111f23c94 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
@@ -1995,7 +1995,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
uint64_t voldisplaycount = 0;
if (!dst || !src) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_EMPTY, "Source or Destination "
"dict is empty.");
goto out;
@@ -2003,7 +2003,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
ret = dict_get_int32 (dst, "config-command", &config_command);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED,
"failed to get config-command type");
goto out;
@@ -2019,7 +2019,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
GLUSTERD_STORE_KEY_SNAP_MAX_HARD_LIMIT,
hard_limit);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_SET_FAILED,
"Unable to set snap_max_hard_limit");
goto out;
@@ -2034,7 +2034,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
GLUSTERD_STORE_KEY_SNAP_MAX_SOFT_LIMIT,
&soft_limit);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED,
"Unable to get snap_max_soft_limit");
goto out;
@@ -2044,7 +2044,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
GLUSTERD_STORE_KEY_SNAP_MAX_SOFT_LIMIT,
soft_limit);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_SET_FAILED,
"Unable to set snap_max_soft_limit");
goto out;
@@ -2053,7 +2053,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
ret = dict_get_uint64 (src, "voldisplaycount",
&voldisplaycount);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED,
"Unable to get voldisplaycount");
goto out;
@@ -2062,7 +2062,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
ret = dict_set_uint64 (dst, "voldisplaycount",
voldisplaycount);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_SET_FAILED,
"Unable to set voldisplaycount");
goto out;
@@ -2073,14 +2073,14 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
"volume%"PRIu64"-volname", i);
ret = dict_get_str (src, buf, &volname);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED,
"Unable to get %s", buf);
goto out;
}
ret = dict_set_str (dst, buf, volname);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_SET_FAILED,
"Unable to set %s", buf);
goto out;
@@ -2090,14 +2090,14 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
"volume%"PRIu64"-snap-max-hard-limit", i);
ret = dict_get_uint64 (src, buf, &value);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED,
"Unable to get %s", buf);
goto out;
}
ret = dict_set_uint64 (dst, buf, value);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_SET_FAILED,
"Unable to set %s", buf);
goto out;
@@ -2107,14 +2107,14 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
"volume%"PRIu64"-active-hard-limit", i);
ret = dict_get_uint64 (src, buf, &value);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED,
"Unable to get %s", buf);
goto out;
}
ret = dict_set_uint64 (dst, buf, value);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_SET_FAILED,
"Unable to set %s", buf);
goto out;
@@ -2124,14 +2124,14 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
"volume%"PRIu64"-snap-max-soft-limit", i);
ret = dict_get_uint64 (src, buf, &value);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED,
"Unable to get %s", buf);
goto out;
}
ret = dict_set_uint64 (dst, buf, value);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_SET_FAILED,
"Unable to set %s", buf);
goto out;
@@ -2145,7 +2145,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
ret = 0;
out:
- gf_msg_debug ("", 0, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -2382,7 +2382,7 @@ glusterd_snap_use_rsp_dict (dict_t *dst, dict_t *src)
int32_t snap_command = 0;
if (!dst || !src) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_EMPTY, "Source or Destination "
"dict is empty.");
goto out;
@@ -2390,7 +2390,7 @@ glusterd_snap_use_rsp_dict (dict_t *dst, dict_t *src)
ret = dict_get_int32 (dst, "type", &snap_command);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED, "unable to get the type of "
"the snapshot command");
goto out;
@@ -2402,7 +2402,7 @@ glusterd_snap_use_rsp_dict (dict_t *dst, dict_t *src)
case GF_SNAP_OPTION_TYPE_CLONE:
ret = glusterd_snap_create_use_rsp_dict (dst, src);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_RSP_DICT_USE_FAIL,
"Unable to use rsp dict");
goto out;
@@ -2411,7 +2411,7 @@ glusterd_snap_use_rsp_dict (dict_t *dst, dict_t *src)
case GF_SNAP_OPTION_TYPE_CONFIG:
ret = glusterd_snap_config_use_rsp_dict (dst, src);
if (ret) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_RSP_DICT_USE_FAIL,
"Unable to use rsp dict");
goto out;
@@ -2426,7 +2426,7 @@ glusterd_snap_use_rsp_dict (dict_t *dst, dict_t *src)
ret = 0;
out:
- gf_msg_debug ("", 0, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index a4ee2c15006..8da7eea225f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -2257,7 +2257,8 @@ glusterd_snapshot_clone_prevalidate (dict_t *dict, char **op_errstr,
out:
if (ret && err_str[0] != '\0') {
- gf_log (this->name, loglevel, "%s", err_str);
+ gf_msg (this->name, loglevel, 0,
+ GD_MSG_SNAP_CLONE_PREVAL_FAILED, "%s", err_str);
*op_errstr = gf_strdup (err_str);
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index d865f5db0ce..12684da1cc3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -2031,7 +2031,8 @@ glusterd_restore_op_version (xlator_t *this)
goto out;
}
conf->op_version = op_version;
- gf_log ("glusterd", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_OP_VERS_INFO,
"retrieved op-version: %d", conf->op_version);
goto out;
}
@@ -2051,11 +2052,15 @@ glusterd_restore_op_version (xlator_t *this)
*/
ret = glusterd_retrieve_uuid();
if (ret) {
- gf_log (this->name, GF_LOG_INFO, "Detected new install. Setting"
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_OP_VERS_SET_INFO,
+ "Detected new install. Setting"
" op-version to maximum : %d", GD_OP_VERSION_MAX);
conf->op_version = GD_OP_VERSION_MAX;
} else {
- gf_log (this->name, GF_LOG_INFO, "Upgrade detected. Setting"
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_OP_VERS_SET_INFO,
+ "Upgrade detected. Setting"
" op-version to minimum : %d", GD_OP_VERSION_MIN);
conf->op_version = GD_OP_VERSION_MIN;
}
@@ -2813,7 +2818,8 @@ glusterd_store_retrieve_volume (char *volname, glusterd_snap_t *snap)
/* Initialize the snapd service */
ret = glusterd_snapdsvc_init (volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to initialize snapd "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAPD_INIT_FAIL, "Failed to initialize snapd "
"service for volume %s", volinfo->volname);
goto out;
}
@@ -3028,7 +3034,8 @@ glusterd_store_retrieve_volumes (xlator_t *this, glusterd_snap_t *snap)
ret = glusterd_store_retrieve_node_state (volinfo);
if (ret) {
/* Backward compatibility */
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_NEW_NODE_STATE_CREATION,
"Creating a new node_state "
"for volume: %s.", entry->d_name);
glusterd_store_create_nodestate_sh_on_absence (volinfo);
@@ -3132,7 +3139,8 @@ glusterd_mount_brick_paths (char *brick_mount_path,
entry = glusterd_get_mnt_entry_info (brick_mount_path, buff,
sizeof (buff), &save_entry);
if (entry) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_ALREADY_MOUNTED,
"brick_mount_path (%s) already mounted.",
brick_mount_path);
ret = 0;
@@ -4460,7 +4468,9 @@ glusterd_quota_conf_write_header (int fd)
out:
if (ret < 0)
- gf_log_callingfn ("quota", GF_LOG_ERROR, "failed to write "
+ gf_msg_callingfn ("quota", GF_LOG_ERROR, 0,
+ GD_MSG_QUOTA_CONF_WRITE_FAIL,
+ "failed to write "
"header to a quota conf");
return ret;
@@ -4498,7 +4508,9 @@ glusterd_quota_conf_write_gfid (int fd, void *buf, char type)
out:
if (ret < 0)
- gf_log_callingfn ("quota", GF_LOG_ERROR, "failed to write "
+ gf_msg_callingfn ("quota", GF_LOG_ERROR, 0,
+ GD_MSG_QUOTA_CONF_WRITE_FAIL,
+ "failed to write "
"gfid %s to a quota conf", uuid_utoa (buf));
return ret;
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index 37daa9d1e8f..9d7b91336ed 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -569,7 +569,9 @@ _gd_syncop_mgmt_lock_cbk (struct rpc_req *req, struct iovec *iov,
peerinfo->locked = _gf_true;
} else {
rsp.op_ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Could not find peer with "
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_PEER_NOT_FOUND,
+ "Could not find peer with "
"ID %s", uuid_utoa (*peerid));
}
rcu_read_unlock ();
@@ -662,7 +664,8 @@ _gd_syncop_mgmt_unlock_cbk (struct rpc_req *req, struct iovec *iov,
peerinfo->locked = _gf_false;
} else {
rsp.op_ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Could not find peer with "
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_PEER_NOT_FOUND, "Could not find peer with "
"ID %s", uuid_utoa (*peerid));
}
rcu_read_unlock ();
@@ -1839,7 +1842,8 @@ global:
ret = glusterd_mgmt_v3_lock (global, MY_UUID, &op_errno,
"global");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_LOCK_GET_FAIL,
"Unable to acquire lock for %s", global);
gf_asprintf (&op_errstr,
"Another transaction is in progress "
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 4d86cac79a8..0c0c0420ef5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1275,7 +1275,7 @@ glusterd_volume_brickinfo_get_by_brick (char *brick,
brickinfo);
(void) glusterd_brickinfo_delete (tmp_brickinfo);
out:
- gf_msg_debug ("", 0, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -1363,7 +1363,9 @@ glusterd_service_stop (const char *service, char *pidfile, int sig,
GF_ASSERT (this);
if (!gf_is_service_running (pidfile, &pid)) {
ret = 0;
- gf_log (this->name, GF_LOG_INFO, "%s already stopped", service);
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_ALREADY_STOPPED,
+ "%s already stopped", service);
goto out;
}
gf_msg_debug (this->name, 0, "Stopping gluster %s running in pid: "
@@ -1486,7 +1488,7 @@ glusterd_brick_connect (glusterd_volinfo_t *volinfo,
}
out:
- gf_msg_debug ("", 0, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -1540,7 +1542,8 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
GF_ASSERT (priv);
if (brickinfo->snap_status == -1) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_SNAPSHOT_PENDING,
"Snapshot is pending on %s:%s. "
"Hence not starting the brick",
brickinfo->hostname,
@@ -1654,7 +1657,7 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
if (volinfo->memory_accounting)
runner_add_arg (&runner, "--mem-accounting");
- runner_log (&runner, "", GF_LOG_DEBUG, "Starting GlusterFS");
+ runner_log (&runner, "", 0, "Starting GlusterFS");
if (wait) {
synclock_unlock (&priv->big_lock);
ret = runner_run (&runner);
@@ -1715,7 +1718,8 @@ glusterd_brick_disconnect (glusterd_brickinfo_t *brickinfo)
GF_ASSERT (brickinfo);
if (!brickinfo) {
- gf_log_callingfn ("glusterd", GF_LOG_WARNING, "!brickinfo");
+ gf_msg_callingfn ("glusterd", GF_LOG_WARNING, EINVAL,
+ GD_MSG_BRICK_NOT_FOUND, "!brickinfo");
return -1;
}
@@ -2739,7 +2743,7 @@ out:
if (msg[0])
gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_IMPORT_PRDICT_DICT, "%s", msg);
- gf_msg_debug ("", 0, "Returning with %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning with %d", ret);
return ret;
}
@@ -2818,7 +2822,7 @@ out:
if (msg[0])
gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_VOL_OPTS_IMPORT_FAIL, "%s", msg);
- gf_msg_debug ("", 0, "Returning with %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning with %d", ret);
return ret;
}
@@ -2906,7 +2910,7 @@ out:
if (msg[0])
gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_BRICK_IMPORT_FAIL, "%s", msg);
- gf_msg_debug ("", 0, "Returning with %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning with %d", ret);
return ret;
}
@@ -2946,7 +2950,7 @@ glusterd_import_bricks (dict_t *peer_data, int32_t vol_count,
}
ret = 0;
out:
- gf_msg_debug ("", 0, "Returning with %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning with %d", ret);
return ret;
}
@@ -3260,7 +3264,7 @@ glusterd_import_volinfo (dict_t *peer_data, int count,
ret = dict_get_int32 (peer_data, key,
&new_volinfo->tier_info.hot_brick_count);
if (ret)
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"peer is possibly old version");
/* not having a 'hot_type' key is not a error
@@ -3270,7 +3274,7 @@ glusterd_import_volinfo (dict_t *peer_data, int count,
ret = dict_get_int32 (peer_data, key,
&new_volinfo->tier_info.hot_type);
if (ret)
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"peer is possibly old version");
/* not having a 'hot_replica_count' key is not a error
@@ -3280,7 +3284,7 @@ glusterd_import_volinfo (dict_t *peer_data, int count,
ret = dict_get_int32 (peer_data, key,
&new_volinfo->tier_info.hot_replica_count);
if (ret)
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"peer is possibly old version");
/* not having a 'cold_brick_count' key is not a error
@@ -3290,7 +3294,7 @@ glusterd_import_volinfo (dict_t *peer_data, int count,
ret = dict_get_int32 (peer_data, key,
&new_volinfo->tier_info.cold_brick_count);
if (ret)
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"peer is possibly old version");
/* not having a 'cold_type' key is not a error
@@ -3300,7 +3304,7 @@ glusterd_import_volinfo (dict_t *peer_data, int count,
ret = dict_get_int32 (peer_data, key,
&new_volinfo->tier_info.cold_type);
if (ret)
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"peer is possibly old version");
/* not having a 'cold_replica_count' key is not a error
@@ -3310,7 +3314,7 @@ glusterd_import_volinfo (dict_t *peer_data, int count,
ret = dict_get_int32 (peer_data, key,
&new_volinfo->tier_info.cold_replica_count);
if (ret)
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"peer is possibly old version");
/* not having a 'cold_disperse_count' key is not a error
@@ -3320,7 +3324,7 @@ glusterd_import_volinfo (dict_t *peer_data, int count,
ret = dict_get_int32 (peer_data, key,
&new_volinfo->tier_info.cold_disperse_count);
if (ret)
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"peer is possibly old version");
/* not having a 'cold_redundancy_count' key is not a error
@@ -3331,7 +3335,7 @@ glusterd_import_volinfo (dict_t *peer_data, int count,
ret = dict_get_int32 (peer_data, key,
&new_volinfo->tier_info.cold_redundancy_count);
if (ret)
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"peer is possibly old version");
/* not having a 'cold_dist_count' key is not a error
@@ -3341,7 +3345,7 @@ glusterd_import_volinfo (dict_t *peer_data, int count,
ret = dict_get_int32 (peer_data, key,
&new_volinfo->tier_info.cold_dist_leaf_count);
if (ret)
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"peer is possibly old version");
new_volinfo->subvol_count = new_volinfo->brick_count/
@@ -3497,7 +3501,7 @@ out:
if (msg[0])
gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_VOLINFO_IMPORT_FAIL, "%s", msg);
- gf_msg_debug ("", 0, "Returning with %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning with %d", ret);
return ret;
}
@@ -3604,7 +3608,7 @@ glusterd_volinfo_stop_stale_bricks (glusterd_volinfo_t *new_volinfo,
}
ret = 0;
out:
- gf_msg_debug ("", 0, "Returning with %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning with %d", ret);
return ret;
}
@@ -3784,7 +3788,8 @@ glusterd_import_friend_volume (dict_t *peer_data, size_t count)
ret = glusterd_snapdsvc_init (new_volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to initialize "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAPD_INIT_FAIL, "Failed to initialize "
"snapdsvc for volume %s", new_volinfo->volname);
goto out;
}
@@ -3799,7 +3804,8 @@ glusterd_import_friend_volume (dict_t *peer_data, size_t count)
ret = glusterd_store_volinfo (new_volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to store "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_STORE_FAIL, "Failed to store "
"volinfo for volume %s", new_volinfo->volname);
goto out;
}
@@ -3817,7 +3823,7 @@ glusterd_import_friend_volume (dict_t *peer_data, size_t count)
glusterd_compare_volume_name);
out:
- gf_msg_debug ("", 0, "Returning with ret: %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning with ret: %d", ret);
return ret;
}
@@ -3842,7 +3848,7 @@ glusterd_import_friend_volumes (dict_t *peer_data)
}
out:
- gf_msg_debug ("", 0, "Returning with %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning with %d", ret);
return ret;
}
@@ -4104,42 +4110,54 @@ void
glusterd_nfs_pmap_deregister ()
{
if (pmap_unset (MOUNT_PROGRAM, MOUNTV3_VERSION))
- gf_log ("", GF_LOG_INFO, "De-registered MOUNTV3 successfully");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_DEREGISTER_SUCCESS,
+ "De-registered MOUNTV3 successfully");
else
gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_PMAP_UNSET_FAIL,
"De-register MOUNTV3 is unsuccessful");
if (pmap_unset (MOUNT_PROGRAM, MOUNTV1_VERSION))
- gf_log ("", GF_LOG_INFO, "De-registered MOUNTV1 successfully");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_DEREGISTER_SUCCESS,
+ "De-registered MOUNTV1 successfully");
else
gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_PMAP_UNSET_FAIL,
"De-register MOUNTV1 is unsuccessful");
if (pmap_unset (NFS_PROGRAM, NFSV3_VERSION))
- gf_log ("", GF_LOG_INFO, "De-registered NFSV3 successfully");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_DEREGISTER_SUCCESS,
+ "De-registered NFSV3 successfully");
else
gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_PMAP_UNSET_FAIL,
"De-register NFSV3 is unsuccessful");
if (pmap_unset (NLM_PROGRAM, NLMV4_VERSION))
- gf_log ("", GF_LOG_INFO, "De-registered NLM v4 successfully");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_DEREGISTER_SUCCESS,
+ "De-registered NLM v4 successfully");
else
gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_PMAP_UNSET_FAIL,
"De-registration of NLM v4 failed");
if (pmap_unset (NLM_PROGRAM, NLMV1_VERSION))
- gf_log ("", GF_LOG_INFO, "De-registered NLM v1 successfully");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_DEREGISTER_SUCCESS,
+ "De-registered NLM v1 successfully");
else
gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_PMAP_UNSET_FAIL,
"De-registration of NLM v1 failed");
if (pmap_unset (ACL_PROGRAM, ACLV3_VERSION))
- gf_log ("", GF_LOG_INFO, "De-registered ACL v3 successfully");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_DEREGISTER_SUCCESS,
+ "De-registered ACL v3 successfully");
else
gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_PMAP_UNSET_FAIL,
@@ -4364,7 +4382,7 @@ glusterd_volume_count_get (void)
}
- gf_msg_debug ("", 0, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -4615,7 +4633,8 @@ _local_gsyncd_start (dict_t *this, char *key, data_t *value, void *data)
* not started, do not restart the geo-rep session */
if ((!strcmp (buf, "Created")) ||
(!strcmp (buf, "Stopped"))) {
- gf_log (this1->name, GF_LOG_INFO,
+ gf_msg (this1->name, GF_LOG_INFO, 0,
+ GD_MSG_GEO_REP_START_FAILED,
"Geo-Rep Session was not started between "
"%s and %s::%s. Not Restarting", volinfo->volname,
slave_url, slave_vol);
@@ -4623,7 +4642,8 @@ _local_gsyncd_start (dict_t *this, char *key, data_t *value, void *data)
} else if (strstr(buf, "Paused")) {
is_paused = _gf_true;
} else if ((!strcmp (buf, "Config Corrupted"))) {
- gf_log (this1->name, GF_LOG_INFO,
+ gf_msg (this1->name, GF_LOG_INFO, 0,
+ GD_MSG_RECOVERING_CORRUPT_CONF,
"Recovering from a corrupted config. "
"Not Restarting. Use start (force) to "
"start the session between %s and %s::%s.",
@@ -5385,7 +5405,7 @@ glusterd_all_volume_cond_check (glusterd_condition_func func, int status,
}
ret = 0;
out:
- gf_msg_debug ("", 0, "returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "returning %d", ret);
return ret;
}
@@ -5549,7 +5569,7 @@ glusterd_rb_check_bricks (glusterd_volinfo_t *volinfo,
if (strcmp (rb->src_brick->hostname, src->hostname) ||
strcmp (rb->src_brick->path, src->path)) {
- gf_msg("", GF_LOG_ERROR, 0,
+ gf_msg("glusterd", GF_LOG_ERROR, 0,
GD_MSG_RB_SRC_BRICKS_MISMATCH,
"Replace brick src bricks differ");
return -1;
@@ -5776,7 +5796,7 @@ glusterd_sm_tr_log_transition_add_to_dict (dict_t *dict,
goto out;
out:
- gf_msg_debug ("", 0, "returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "returning %d", ret);
return ret;
}
@@ -5817,7 +5837,7 @@ glusterd_sm_tr_log_add_to_dict (dict_t *dict,
ret = dict_set_int32 (dict, key, log->count);
out:
- gf_msg_debug ("", 0, "returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "returning %d", ret);
return ret;
}
@@ -5848,7 +5868,7 @@ glusterd_sm_tr_log_init (glusterd_sm_tr_log_t *log,
ret = 0;
out:
- gf_msg_debug ("", 0, "returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "returning %d", ret);
return ret;
}
@@ -6009,7 +6029,7 @@ glusterd_get_local_brickpaths (glusterd_volinfo_t *volinfo, char **pathlist)
path_tokens = GF_CALLOC (sizeof(char*), volinfo->brick_count,
gf_gld_mt_charptr);
if (!path_tokens) {
- gf_msg_debug ("", 0, "Could not allocate memory.");
+ gf_msg_debug ("glusterd", 0, "Could not allocate memory.");
ret = -1;
goto out;
}
@@ -6026,7 +6046,7 @@ glusterd_get_local_brickpaths (glusterd_volinfo_t *volinfo, char **pathlist)
path[sizeof(path)-1] = '\0';
path_tokens[count] = gf_strdup (path);
if (!path_tokens[count]) {
- gf_msg_debug ("", 0,
+ gf_msg_debug ("glusterd", 0,
"Could not allocate memory.");
ret = -1;
goto out;
@@ -6038,7 +6058,7 @@ glusterd_get_local_brickpaths (glusterd_volinfo_t *volinfo, char **pathlist)
tmp_path_list = GF_CALLOC (sizeof(char), total_len + 1,
gf_gld_mt_char);
if (!tmp_path_list) {
- gf_msg_debug ("", 0, "Could not allocate memory.");
+ gf_msg_debug ("glusterd", 0, "Could not allocate memory.");
ret = -1;
goto out;
}
@@ -6061,12 +6081,12 @@ out:
path_tokens = NULL;
if (ret == 0) {
- gf_msg_debug ("", 0, "No Local Bricks Present.");
+ gf_msg_debug ("glusterd", 0, "No Local Bricks Present.");
GF_FREE (tmp_path_list);
tmp_path_list = NULL;
}
- gf_msg_debug ("", 0, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -6094,7 +6114,7 @@ glusterd_start_gsync (glusterd_volinfo_t *master_vol, char *slave,
if (!path_list) {
ret = 0;
- gf_msg_debug ("", 0, "No Bricks in this node."
+ gf_msg_debug ("glusterd", 0, "No Bricks in this node."
" Not starting gsyncd.");
goto out;
}
@@ -6157,7 +6177,7 @@ out:
"the " GEOREP " session");
}
- gf_msg_debug ("", 0, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -6311,7 +6331,9 @@ glusterd_set_dump_options (char *dumpoptions_path, char *options,
goto out;
}
dup_options = gf_strdup (options);
- gf_log ("", GF_LOG_INFO, "Received following statedump options: %s",
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_STATEDUMP_OPTS_RCVD,
+ "Received following statedump options: %s",
dup_options);
option = strtok_r (dup_options, " ", &tmpptr);
while (option) {
@@ -6402,7 +6424,9 @@ glusterd_brick_statedump (glusterd_volinfo_t *volinfo,
goto out;
}
- gf_log ("", GF_LOG_INFO, "Performing statedump on brick with pid %d",
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_STATEDUMP_INFO,
+ "Performing statedump on brick with pid %d",
pid);
kill (pid, SIGUSR1);
@@ -6480,7 +6504,9 @@ glusterd_nfs_statedump (char *options, int option_cnt, char **op_errstr)
goto out;
}
- gf_log ("", GF_LOG_INFO, "Performing statedump on nfs server with "
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_STATEDUMP_INFO,
+ "Performing statedump on nfs server with "
"pid %d", pid);
kill (pid, SIGUSR1);
@@ -6559,7 +6585,9 @@ glusterd_quotad_statedump (char *options, int option_cnt, char **op_errstr)
goto out;
}
- gf_log (this->name, GF_LOG_INFO, "Performing statedump on quotad with "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_STATEDUMP_INFO,
+ "Performing statedump on quotad with "
"pid %d", pid);
kill (pid, SIGUSR1);
@@ -6625,7 +6653,8 @@ glusterd_friend_remove_cleanup_vols (uuid_t uuid)
cds_list_for_each_entry_safe (volinfo, tmp_volinfo, &priv->volumes,
vol_list) {
if (glusterd_friend_contains_vol_bricks (volinfo, uuid) == 2) {
- gf_log (THIS->name, GF_LOG_INFO,
+ gf_msg (THIS->name, GF_LOG_INFO, 0,
+ GD_MSG_STALE_VOL_DELETE_INFO,
"Deleting stale volume %s", volinfo->volname);
ret = glusterd_delete_volume (volinfo);
if (ret) {
@@ -6913,12 +6942,12 @@ glusterd_defrag_volume_status_update (glusterd_volinfo_t *volinfo,
ret = dict_get_uint64 (rsp_dict, "promoted", &promoted);
if (ret)
- gf_log (this->name, GF_LOG_TRACE,
+ gf_msg_trace (this->name, 0,
"failed to get promoted count");
ret = dict_get_uint64 (rsp_dict, "demoted", &demoted);
if (ret)
- gf_log (this->name, GF_LOG_TRACE,
+ gf_msg_trace (this->name, 0,
"failed to get demoted count");
ret = dict_get_double (rsp_dict, "run-time", &run_time);
@@ -7217,7 +7246,7 @@ glusterd_append_status_dicts (dict_t *dst, dict_t *src)
ret = dict_get_int32 (src, "gsync-count", &src_count);
if (ret || !src_count) {
- gf_msg_debug ("", 0, "Source brick empty");
+ gf_msg_debug ("glusterd", 0, "Source brick empty");
ret = 0;
goto out;
}
@@ -7251,7 +7280,7 @@ glusterd_append_status_dicts (dict_t *dst, dict_t *src)
ret = dict_set_int32 (dst, "gsync-count", dst_count+src_count);
out:
- gf_msg_debug ("", 0, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -7355,7 +7384,7 @@ glusterd_gsync_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict, char *op_errstr)
ret = 0;
out:
- gf_msg_debug ("", 0, "Returning %d ", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d ", ret);
return ret;
}
@@ -7387,13 +7416,13 @@ glusterd_rb_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
if (rsp_dict) {
ret = dict_get_int32 (rsp_dict, "src-brick-port", &src_port);
if (ret == 0) {
- gf_msg_debug ("", 0,
+ gf_msg_debug ("glusterd", 0,
"src-brick-port=%d found", src_port);
}
ret = dict_get_int32 (rsp_dict, "dst-brick-port", &dst_port);
if (ret == 0) {
- gf_msg_debug ("", 0,
+ gf_msg_debug ("glusterd", 0,
"dst-brick-port=%d found", dst_port);
}
@@ -7411,7 +7440,7 @@ glusterd_rb_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
ret = dict_set_int32 (ctx, "src-brick-port",
src_port);
if (ret) {
- gf_msg_debug ("", 0,
+ gf_msg_debug ("glusterd", 0,
"Could not set src-brick");
goto out;
}
@@ -7421,7 +7450,7 @@ glusterd_rb_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
ret = dict_set_int32 (ctx, "dst-brick-port",
dst_port);
if (ret) {
- gf_msg_debug ("", 0,
+ gf_msg_debug ("glusterd", 0,
"Could not set dst-brick");
goto out;
}
@@ -7865,28 +7894,32 @@ glusterd_volume_status_copy_to_op_ctx_dict (dict_t *aggr, dict_t *rsp_dict)
ret = dict_get_int32 (rsp_dict, "hot_brick_count", &hot_brick_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 get hot brick count from rsp_dict");
goto out;
}
ret = dict_set_int32 (ctx_dict, "hot_brick_count", hot_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 update hot_brick_count");
goto out;
}
ret = dict_get_int32 (rsp_dict, "type", &type);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
"Failed to get type from rsp_dict");
goto out;
}
ret = dict_set_int32 (ctx_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 update type");
goto out;
}
@@ -8098,7 +8131,7 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
snprintf (key, 256, "demoted-%d", current_index);
ret = dict_set_uint64 (ctx_dict, key, value);
if (ret) {
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"failed to set demoted count");
}
}
@@ -8110,7 +8143,7 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
snprintf (key, 256, "promoted-%d", current_index);
ret = dict_set_uint64 (ctx_dict, key, value);
if (ret) {
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_msg_debug (THIS->name, 0,
"failed to set promoted count");
}
}
@@ -8144,7 +8177,7 @@ glusterd_sys_exec_output_rsp_dict (dict_t *dst, dict_t *src)
ret = dict_get_int32 (src, "output_count", &src_output_count);
if (ret) {
- gf_msg_debug ("", 0, "No output from source");
+ gf_msg_debug ("glusterd", 0, "No output from source");
ret = 0;
goto out;
}
@@ -8178,7 +8211,7 @@ glusterd_sys_exec_output_rsp_dict (dict_t *dst, dict_t *src)
ret = dict_set_int32 (dst, "output_count",
dst_output_count+src_output_count);
out:
- gf_msg_debug ("", 0, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -8759,14 +8792,16 @@ glusterd_defrag_volume_node_rsp (dict_t *req_dict, dict_t *rsp_dict,
snprintf (key, 256, "promoted-%d", i);
ret = dict_set_uint64 (op_ctx, key, volinfo->tier_info.promoted);
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 lookedup file count");
memset (key, 0 , 256);
snprintf (key, 256, "demoted-%d", i);
ret = dict_set_uint64 (op_ctx, key, volinfo->tier_info.demoted);
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 lookedup file count");
out:
@@ -8805,7 +8840,7 @@ glusterd_handle_node_rsp (dict_t *req_dict, void *pending_entry,
break;
}
- gf_msg_debug ("", 0, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -8899,7 +8934,8 @@ glusterd_generate_and_set_task_id (dict_t *dict, char *key)
key);
goto out;
}
- gf_log (this->name, GF_LOG_INFO, "Generated task-id %s for key %s",
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_TASK_ID_INFO, "Generated task-id %s for key %s",
uuid_str, key);
out:
@@ -9486,7 +9522,8 @@ glusterd_enable_default_options (glusterd_volinfo_t *volinfo, char *option)
ret = dict_set_dynstr_with_alloc (volinfo->dict,
"performance.readdir-ahead", "on");
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 option "
"'performance.readdir-ahead' on volume "
"%s", volinfo->volname);
@@ -9959,7 +9996,7 @@ glusterd_disallow_op_for_tier (glusterd_volinfo_t *volinfo, glusterd_op_t op,
case GD_OP_ADD_BRICK:
case GD_OP_REPLACE_BRICK:
ret = -1;
- gf_log (this->name, GF_LOG_DEBUG, "Operation not "
+ gf_msg_debug (this->name, 0, "Operation not "
"permitted on tiered volume %s",
volinfo->volname);
break;
@@ -9973,7 +10010,7 @@ glusterd_disallow_op_for_tier (glusterd_volinfo_t *volinfo, glusterd_op_t op,
ret = 0;
break;
default:
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Rebalance Operation not permitted"
" on tiered volume %s",
volinfo->volname);
@@ -9990,7 +10027,7 @@ glusterd_disallow_op_for_tier (glusterd_volinfo_t *volinfo, glusterd_op_t op,
ret = 0;
break;
default:
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Remove brick operation not "
"permitted on tiered volume %s",
volinfo->volname);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index a79e1294dba..09671a83126 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -88,7 +88,9 @@ xlator_instantiate_va (const char *type, const char *format, va_list arg)
return xl;
error:
- gf_log ("", GF_LOG_ERROR, "creating xlator of type %s failed",
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_XLATOR_CREATE_FAIL,
+ "creating xlator of type %s failed",
type);
GF_FREE (volname);
if (xl)
@@ -119,7 +121,8 @@ volgen_xlator_link (xlator_t *pxl, xlator_t *cxl)
ret = glusterfs_xlator_link (pxl, cxl);
if (ret == -1) {
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY,
"Out of memory, cannot link xlators %s <- %s",
pxl->name, cxl->name);
}
@@ -136,7 +139,9 @@ volgen_graph_link (volgen_graph_t *graph, xlator_t *xl)
if (graph->graph.first)
ret = volgen_xlator_link (xl, graph->graph.first);
if (ret == -1) {
- gf_log ("", GF_LOG_ERROR, "failed to add graph entry %s",
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_GRAPH_ENTRY_ADD_FAIL,
+ "failed to add graph entry %s",
xl->name);
return -1;
@@ -211,7 +216,8 @@ xlator_set_option (xlator_t *xl, char *key, char *value)
dval = gf_strdup (value);
if (!dval) {
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_NO_MEMORY,
"failed to set xlator opt: %s[%s] = %s",
xl->name, key, value);
@@ -582,7 +588,8 @@ volgen_dict_get (dict_t *dict, char *key, char **value)
ret = volgen_graph_set_options_generic (NULL, dict, &vme,
&optget_option_handler);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Out of memory");
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Out of memory");
return -1;
}
@@ -643,7 +650,9 @@ glusterd_volinfo_get_boolean (glusterd_volinfo_t *volinfo, char *key)
if (val)
ret = gf_string2boolean (val, &enabled);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "value for %s option is not valid", key);
+ gf_msg ("glusterd", GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY,
+ "value for %s option is not valid", key);
return -1;
}
@@ -750,7 +759,8 @@ glusterd_check_option_exists (char *key, char **completion)
if (completion) {
ret = option_complete (key, completion);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY,
"Out of memory");
return -1;
}
@@ -777,7 +787,8 @@ glusterd_check_option_exists (char *key, char **completion)
trie:
ret = volopt_trie (key, completion);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_ERROR_ENCOUNTERED,
"Some error occurred during keyword hinting");
}
@@ -794,7 +805,8 @@ glusterd_volopt_validate (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
xlator_t *this = THIS;
if (!dict || !key || !value) {
- gf_log_callingfn (this->name, GF_LOG_WARNING, "Invalid "
+ gf_msg_callingfn (this->name, GF_LOG_WARNING, EINVAL,
+ GD_MSG_INVALID_ENTRY, "Invalid "
"Arguments (dict=%p, key=%s, value=%s)", dict,
key, value);
return -1;
@@ -829,7 +841,8 @@ glusterd_get_trans_type_rb (gf_transport_type ttype)
gf_asprintf (&trans_type, "tcp");
break;
default:
- gf_log (THIS->name, GF_LOG_ERROR, "Unknown "
+ gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "Unknown "
"transport type");
}
@@ -849,7 +862,7 @@ _xl_link_children (xlator_t *parent, xlator_t *children, size_t child_count)
for (trav = children; --seek; trav = trav->next);
for (; child_count--; trav = trav->prev) {
ret = volgen_xlator_link (parent, trav);
- gf_log (THIS->name, GF_LOG_DEBUG, "%s:%s", parent->name,
+ gf_msg_debug (THIS->name, 0, "%s:%s", parent->name,
trav->name);
if (ret)
goto out;
@@ -928,8 +941,10 @@ volgen_apply_filters (char *orig_volfile)
goto free_fp;
}
if (runcmd(filterpath,orig_volfile,NULL)) {
- gf_log("",GF_LOG_ERROR,"failed to run filter %.*s",
- (int)sizeof(entry.d_name), entry.d_name);
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_FILTER_RUN_FAILED,
+ "failed to run filter %.*s",
+ (int)sizeof(entry.d_name), entry.d_name);
}
free_fp:
GF_FREE(filterpath);
@@ -956,8 +971,8 @@ volgen_write_volfile (volgen_graph_t *graph, char *filename)
fd = creat (ftmp, S_IRUSR | S_IWUSR);
if (fd < 0) {
- gf_log (this->name, GF_LOG_ERROR, "%s",
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_FILE_OP_FAILED, "file creation failed");
goto error;
}
@@ -971,8 +986,9 @@ volgen_write_volfile (volgen_graph_t *graph, char *filename)
goto error;
if (fclose (f) != 0) {
- gf_log (THIS->name, GF_LOG_ERROR, "fclose on the file %s "
- "failed (%s)", ftmp, strerror (errno));
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ GD_MSG_FILE_OP_FAILED, "fclose on the file %s "
+ "failed", ftmp);
/*
* Even though fclose has failed here, we have to set f to NULL.
* Otherwise when the code path goes to error, there again we
@@ -1000,7 +1016,8 @@ volgen_write_volfile (volgen_graph_t *graph, char *filename)
if (f)
fclose (f);
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL,
"failed to create volfile %s", filename);
return -1;
@@ -1098,7 +1115,8 @@ get_vol_nfs_transport_type (glusterd_volinfo_t *volinfo, char *tt)
{
if (volinfo->transport_type == GF_TRANSPORT_BOTH_TCP_RDMA) {
strcpy (tt, "tcp");
- gf_log ("glusterd", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_DEFAULT_OPT_INFO,
"The default transport type for tcp,rdma volume "
"is tcp if option is not defined by the user ");
} else
@@ -1205,7 +1223,9 @@ server_check_marker_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
ret = glusterd_volinfo_get_boolean (volinfo, VKEY_MARKER_XTIME);
if (ret < 0) {
- gf_log ("", GF_LOG_WARNING, "failed to get the marker status");
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_MARKER_STATUS_GET_FAIL,
+ "failed to get the marker status");
ret = -1;
goto out;
}
@@ -1215,7 +1235,9 @@ server_check_marker_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
glusterd_check_geo_rep_configured (volinfo, &enabled);
if (enabled) {
- gf_log ("", GF_LOG_WARNING, GEOREP" sessions active"
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_MARKER_DISABLE_FAIL,
+ GEOREP" sessions active"
"for the volume %s, cannot disable marker "
,volinfo->volname);
set_graph_errstr (graph,
@@ -1228,7 +1250,7 @@ server_check_marker_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
ret = 0;
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -1352,8 +1374,9 @@ volgen_graph_set_xl_options (volgen_graph_t *graph, dict_t *dict)
for (trav = first_of (graph); trav; trav = trav->next) {
if (fnmatch(xlator_match, trav->type, FNM_NOESCAPE) == 0) {
- gf_log ("glusterd", GF_LOG_DEBUG, "Setting log level for xlator: %s",
- trav->type);
+ gf_msg_debug ("glusterd", 0,
+ "Setting log level for xlator: %s",
+ trav->type);
ret = xlator_set_option (trav, "log-level", loglevel);
if (ret)
break;
@@ -1884,7 +1907,8 @@ brick_graph_add_ro (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (dict_get_str_boolean (set_dict, "features.read-only", 0) &&
dict_get_str_boolean (set_dict, "features.worm", 0)) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
"read-only and worm cannot be set together");
ret = -1;
goto out;
@@ -1915,7 +1939,8 @@ brick_graph_add_worm (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (dict_get_str_boolean (set_dict, "features.read-only", 0) &&
dict_get_str_boolean (set_dict, "features.worm", 0)) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_INCOMPATIBLE_VALUE,
"read-only and worm cannot be set together");
ret = -1;
goto out;
@@ -1993,7 +2018,8 @@ brick_graph_add_upcall (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
xl = volgen_graph_add (graph, "features/upcall", volinfo->volname);
if (!xl) {
- gf_log ("glusterd", GF_LOG_WARNING,
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_GRAPH_FEATURE_ADD_FAIL,
"failed to add features/upcall to graph");
goto out;
}
@@ -2045,7 +2071,8 @@ brick_graph_add_server (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (dict_get_str (set_dict, SSL_CERT_DEPTH_OPT, &value) == 0) {
ret = xlator_set_option (xl, "ssl-cert-depth", value);
if (ret) {
- gf_log ("glusterd", GF_LOG_WARNING,
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_XLATOR_SET_OPT_FAIL,
"failed to set ssl-cert-depth");
return -1;
}
@@ -2054,7 +2081,8 @@ brick_graph_add_server (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (dict_get_str (set_dict, SSL_CIPHER_LIST_OPT, &value) == 0) {
ret = xlator_set_option (xl, "ssl-cipher-list", value);
if (ret) {
- gf_log ("glusterd", GF_LOG_WARNING,
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_XLATOR_SET_OPT_FAIL,
"failed to set ssl-cipher-list");
return -1;
}
@@ -2137,7 +2165,8 @@ brick_graph_add_pump (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (dict_get_str (set_dict, SSL_CERT_DEPTH_OPT, &value) == 0) {
ret = xlator_set_option (rbxl, "ssl-cert-depth", value);
if (ret) {
- gf_log ("glusterd", GF_LOG_WARNING,
+ gf_msg ("glusterd", GF_LOG_WARNING, errno,
+ GD_MSG_DICT_GET_FAILED,
"failed to set ssl-cert-depth");
return -1;
}
@@ -2147,7 +2176,8 @@ brick_graph_add_pump (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
ret = xlator_set_option (rbxl, "ssl-cipher-list",
value);
if (ret) {
- gf_log ("glusterd", GF_LOG_WARNING,
+ gf_msg ("glusterd", GF_LOG_WARNING, errno,
+ GD_MSG_DICT_GET_FAILED,
"failed to set ssl-cipher-list");
return -1;
}
@@ -2329,7 +2359,8 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
ret = server_graph_table[i].builder (graph, volinfo, set_dict,
param);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR, "Builing graph "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_BUILD_GRAPH_FAILED, "Builing graph "
"failed for server graph table entry: %d", i);
goto out;
}
@@ -2350,7 +2381,8 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (!ret) {
ret = dict_get_str (set_dict, "loglevel", &loglevel);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR, "could not get both"
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "could not get both"
" translator name and loglevel for log level request");
goto out;
}
@@ -2436,21 +2468,23 @@ end_sethelp_xml_doc (xmlTextWriterPtr writer)
ret = xmlTextWriterEndElement(writer);
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR, "Could not end an "
- "xmlElemetnt");
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_XML_TEXT_WRITE_FAIL, "Could not end an "
+ "xmlElement");
ret = -1;
goto out;
}
ret = xmlTextWriterEndDocument (writer);
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR, "Could not end an "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_XML_TEXT_WRITE_FAIL, "Could not end an "
"xmlDocument");
ret = -1;
goto out;
}
ret = 0;
out:
- gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -2462,7 +2496,8 @@ init_sethelp_xml_doc (xmlTextWriterPtr *writer, xmlBufferPtr *buf)
*buf = xmlBufferCreateSize (8192);
if (buf == NULL) {
- gf_log ("glusterd", GF_LOG_ERROR, "Error creating the xml "
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Error creating the xml "
"buffer");
ret = -1;
goto out;
@@ -2472,7 +2507,8 @@ init_sethelp_xml_doc (xmlTextWriterPtr *writer, xmlBufferPtr *buf)
*writer = xmlNewTextWriterMemory(*buf, 0);
if (writer == NULL) {
- gf_log ("glusterd", GF_LOG_ERROR, " Error creating the xml "
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, " Error creating the xml "
"writer");
ret = -1;
goto out;
@@ -2480,15 +2516,17 @@ init_sethelp_xml_doc (xmlTextWriterPtr *writer, xmlBufferPtr *buf)
ret = xmlTextWriterStartDocument(*writer, "1.0", "UTF-8", "yes");
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR, "Error While starting the "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_XML_DOC_START_FAIL, "Error While starting the "
"xmlDoc");
goto out;
}
ret = xmlTextWriterStartElement(*writer, (xmlChar *)"options");
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR, "Could not create an "
- "xmlElemetnt");
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_XML_ELE_CREATE_FAIL, "Could not create an "
+ "xmlElement");
ret = -1;
goto out;
}
@@ -2497,7 +2535,7 @@ init_sethelp_xml_doc (xmlTextWriterPtr *writer, xmlBufferPtr *buf)
ret = 0;
out:
- gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -2513,7 +2551,8 @@ xml_add_volset_element (xmlTextWriterPtr writer, const char *name,
ret = xmlTextWriterStartElement(writer, (xmlChar *) "option");
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR, "Could not create an "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_XML_ELE_CREATE_FAIL, "Could not create an "
"xmlElemetnt");
ret = -1;
goto out;
@@ -2522,7 +2561,8 @@ xml_add_volset_element (xmlTextWriterPtr writer, const char *name,
ret = xmlTextWriterWriteFormatElement(writer, (xmlChar*)"defaultValue",
"%s", def_val);
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR, "Could not create an "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_XML_ELE_CREATE_FAIL, "Could not create an "
"xmlElemetnt");
ret = -1;
goto out;
@@ -2531,7 +2571,8 @@ xml_add_volset_element (xmlTextWriterPtr writer, const char *name,
ret = xmlTextWriterWriteFormatElement(writer, (xmlChar *)"description",
"%s", dscrpt );
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR, "Could not create an "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_XML_ELE_CREATE_FAIL, "Could not create an "
"xmlElemetnt");
ret = -1;
goto out;
@@ -2540,7 +2581,8 @@ xml_add_volset_element (xmlTextWriterPtr writer, const char *name,
ret = xmlTextWriterWriteFormatElement(writer, (xmlChar *) "name", "%s",
name);
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR, "Could not create an "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_XML_ELE_CREATE_FAIL, "Could not create an "
"xmlElemetnt");
ret = -1;
goto out;
@@ -2548,7 +2590,8 @@ xml_add_volset_element (xmlTextWriterPtr writer, const char *name,
ret = xmlTextWriterEndElement(writer);
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR, "Could not end an "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_XML_ELE_CREATE_FAIL, "Could not end an "
"xmlElemetnt");
ret = -1;
goto out;
@@ -2556,7 +2599,7 @@ xml_add_volset_element (xmlTextWriterPtr writer, const char *name,
ret = 0;
out:
- gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -2599,10 +2642,11 @@ _get_xlator_opt_key_from_vme ( struct volopt_map_entry *vme, char **key)
}
}
if (ret)
- gf_log ("glusterd", GF_LOG_ERROR, "Wrong entry found in "
+ gf_msg ("glusterd", GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "Wrong entry found in "
"glusterd_volopt_map entry %s", vme->key);
else
- gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -2699,7 +2743,8 @@ volgen_graph_build_client (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (dict_get_str (set_dict, SSL_CERT_DEPTH_OPT, &value) == 0) {
ret = xlator_set_option (xl, "ssl-cert-depth", value);
if (ret) {
- gf_log ("glusterd", GF_LOG_WARNING,
+ gf_msg ("glusterd", GF_LOG_WARNING, errno,
+ GD_MSG_DICT_GET_FAILED,
"failed to set ssl-cert-depth");
goto err;
}
@@ -2708,7 +2753,8 @@ volgen_graph_build_client (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (dict_get_str (set_dict, SSL_CIPHER_LIST_OPT, &value) == 0) {
ret = xlator_set_option (xl, "ssl-cipher-list", value);
if (ret) {
- gf_log ("glusterd", GF_LOG_WARNING,
+ gf_msg ("glusterd", GF_LOG_WARNING, errno,
+ GD_MSG_DICT_GET_FAILED,
"failed to set ssl-cipher-list");
goto err;
}
@@ -2733,7 +2779,8 @@ volgen_graph_build_clients (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
volname = volinfo->volname;
if (volinfo->brick_count == 0) {
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_VOLUME_INCONSISTENCY,
"volume inconsistency: brick count is 0");
goto out;
}
@@ -2741,7 +2788,8 @@ volgen_graph_build_clients (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if ((volinfo->type != GF_CLUSTER_TYPE_TIER) &&
(volinfo->dist_leaf_count < volinfo->brick_count) &&
((volinfo->brick_count % volinfo->dist_leaf_count) != 0)) {
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_VOLUME_INCONSISTENCY,
"volume inconsistency: "
"total number of bricks (%d) is not divisible with "
"number of bricks per cluster (%d) in a multi-cluster "
@@ -2770,7 +2818,8 @@ volgen_graph_build_clients (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
}
if (i != volinfo->brick_count) {
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_VOLUME_INCONSISTENCY,
"volume inconsistency: actual number of bricks (%d) "
"differs from brick count (%d)", i,
volinfo->brick_count);
@@ -2913,14 +2962,16 @@ volgen_graph_build_snapview_client (volgen_graph_t *graph,
**/
ret = volgen_xlator_link (graph->graph.first, prev_top);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "failed to link the "
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_XLATOR_LINK_FAIL, "failed to link the "
"snapview-client to distribute");
goto out;
}
ret = volgen_xlator_link (graph->graph.first, prot_clnt);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "failed to link the "
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_XLATOR_LINK_FAIL, "failed to link the "
"snapview-client to snapview-server");
goto out;
}
@@ -2941,14 +2992,18 @@ _xl_is_client_decommissioned (xlator_t *xl, glusterd_volinfo_t *volinfo)
ret = xlator_get_option (xl, "remote-host", &hostname);
if (ret) {
GF_ASSERT (0);
- gf_log ("glusterd", GF_LOG_ERROR, "Failed to get remote-host "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_REMOTE_HOST_GET_FAIL,
+ "Failed to get remote-host "
"from client %s", xl->name);
goto out;
}
ret = xlator_get_option (xl, "remote-subvolume", &path);
if (ret) {
GF_ASSERT (0);
- gf_log ("glusterd", GF_LOG_ERROR, "Failed to get remote-host "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_REMOTE_HOST_GET_FAIL,
+ "Failed to get remote-host "
"from client %s", xl->name);
goto out;
}
@@ -3038,7 +3093,8 @@ volgen_graph_build_dht_cluster (volgen_graph_t *graph,
/* NUFA and Switch section */
if (dict_get_str_boolean (volinfo->dict, "cluster.nufa", 0) &&
dict_get_str_boolean (volinfo->dict, "cluster.switch", 0)) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
"nufa and switch cannot be set together");
ret = -1;
goto out;
@@ -3235,7 +3291,9 @@ volume_volgen_graph_build_clusters (volgen_graph_t *graph,
break;
default:
- gf_log ("", GF_LOG_ERROR, "volume inconsistency: "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_VOLUME_INCONSISTENCY,
+ "volume inconsistency: "
"unrecognized clustering type");
goto out;
}
@@ -3290,38 +3348,50 @@ graph_set_generic_options (xlator_t *this, volgen_graph_t *graph,
&loglevel_option_handler);
if (ret)
- gf_log (this->name, GF_LOG_WARNING, "changing %s log level"
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_GRAPH_SET_OPT_FAIL,
+ "changing %s log level"
" failed", identifier);
ret = volgen_graph_set_options_generic (graph, set_dict, "client",
&sys_loglevel_option_handler);
if (ret)
- gf_log (this->name, GF_LOG_WARNING, "changing %s syslog "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_GRAPH_SET_OPT_FAIL,
+ "changing %s syslog "
"level failed", identifier);
ret = volgen_graph_set_options_generic (graph, set_dict, "client",
&logger_option_handler);
if (ret)
- gf_log (this->name, GF_LOG_WARNING, "changing %s logger"
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_GRAPH_SET_OPT_FAIL,
+ "changing %s logger"
" failed", identifier);
ret = volgen_graph_set_options_generic (graph, set_dict, "client",
&log_format_option_handler);
if (ret)
- gf_log (this->name, GF_LOG_WARNING, "changing %s log format"
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_GRAPH_SET_OPT_FAIL,
+ "changing %s log format"
" failed", identifier);
ret = volgen_graph_set_options_generic (graph, set_dict, "client",
&log_buf_size_option_handler);
if (ret)
- gf_log (this->name, GF_LOG_WARNING, "Failed to change "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_GRAPH_SET_OPT_FAIL,
+ "Failed to change "
"log-buf-size option");
ret = volgen_graph_set_options_generic (graph, set_dict, "client",
&log_flush_timeout_option_handler);
if (ret)
- gf_log (this->name, GF_LOG_WARNING, "Failed to change "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_GRAPH_SET_OPT_FAIL,
+ "Failed to change "
"log-flush-timeout option");
return 0;
}
@@ -3496,7 +3566,9 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (volinfo->is_snap_volume) {
xl = volgen_graph_add (graph, "features/read-only", volname);
if (!xl) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to add "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_GRAPH_FEATURE_ADD_FAIL,
+ "Failed to add "
"read-only feature to the graph of %s "
"snapshot with %s origin volume",
volname, volinfo->parent_volname);
@@ -3574,7 +3646,8 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
ob = _gf_false;
ret = gf_string2boolean (tmp, &ob);
if (!ret && ob) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_ROOT_SQUASH_ENABLED,
"root-squash is enabled. Please turn it"
" off to change read-after-open "
"option");
@@ -3643,7 +3716,9 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
ret = 0;
}
if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "setting "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_ROOT_SQUASH_FAILED,
+ "setting "
"open behind option as part of root "
"squash failed");
goto out;
@@ -3655,8 +3730,9 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
ret = dict_set_str (set_dict, "client.send-gids",
ret ? "false" : "true");
if (ret)
- gf_log (THIS->name, GF_LOG_WARNING, "changing client"
- " protocol option failed");
+ gf_msg (THIS->name, GF_LOG_WARNING, errno,
+ GD_MSG_DICT_SET_FAILED, "changing client"
+ " protocol option failed");
}
ret = client_graph_set_perf_options(graph, volinfo, set_dict);
@@ -3686,7 +3762,8 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
ret = dict_get_str_boolean (set_dict, "ganesha.enable", _gf_false);
if (ret == -1) {
- gf_log (this->name, GF_LOG_WARNING, "setting ganesha.enable"
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ GD_MSG_DICT_GET_FAILED, "setting ganesha.enable"
"option failed.");
goto out;
}
@@ -3695,8 +3772,10 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
xl = volgen_graph_add (graph, "features/ganesha", volname);
if (!xl) {
- gf_log (this->name, GF_LOG_ERROR, "failed to add"
- "add features/ganesha to graph");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_GRAPH_FEATURE_ADD_FAIL,
+ "failed to add"
+ "add features/ganesha to graph");
ret = -1;
goto out;
}
@@ -4243,7 +4322,9 @@ build_nfs_graph (volgen_graph_t *graph, dict_t *mod_dict)
set_dict = dict_new ();
if (!set_dict) {
- gf_log ("", GF_LOG_ERROR, "Out of memory");
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY,
+ "Out of memory");
return -1;
}
@@ -4274,7 +4355,8 @@ build_nfs_graph (volgen_graph_t *graph, dict_t *mod_dict)
ret = gf_asprintf (&skey, "rpc-auth.addr.%s.allow",
voliter->volname);
if (ret == -1) {
- gf_log ("", GF_LOG_ERROR, "Out of memory");
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Out of memory");
goto out;
}
ret = xlator_set_option (nfsxl, skey, "*");
@@ -4285,7 +4367,8 @@ build_nfs_graph (volgen_graph_t *graph, dict_t *mod_dict)
ret = gf_asprintf (&skey, "nfs3.%s.volume-id",
voliter->volname);
if (ret == -1) {
- gf_log ("", GF_LOG_ERROR, "Out of memory");
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_NO_MEMORY, "Out of memory");
goto out;
}
ret = xlator_set_option (nfsxl, skey, uuid_utoa (voliter->volume_id));
@@ -4373,12 +4456,13 @@ build_nfs_graph (volgen_graph_t *graph, dict_t *mod_dict)
}
if (ret)
- gf_log ("glusterd", GF_LOG_WARNING, "Could not set "
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_GRAPH_SET_OPT_FAIL, "Could not set "
"vol-options for the volume %s", voliter->volname);
}
out:
- gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
dict_destroy (set_dict);
return ret;
@@ -4424,14 +4508,18 @@ glusterd_is_valid_volfpath (char *volname, char *brick)
ret = glusterd_brickinfo_new_from_brick (brick, &brickinfo);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "Failed to create brickinfo"
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_BRICKINFO_CREATE_FAIL,
+ "Failed to create brickinfo"
" for brick %s", brick );
ret = 0;
goto out;
}
ret = glusterd_volinfo_new (&volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "Failed to create volinfo");
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_VOLINFO_STORE_FAIL,
+ "Failed to create volinfo");
ret = 0;
goto out;
}
@@ -4519,7 +4607,8 @@ build_quotad_graph (volgen_graph_t *graph, dict_t *mod_dict)
ret = gf_asprintf(&skey, "%s.volume-id", voliter->volname);
if (ret == -1) {
- gf_log("", GF_LOG_ERROR, "Out of memory");
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Out of memory");
goto out;
}
ret = xlator_set_option(quotad_xl, skey, voliter->volname);
@@ -4624,13 +4713,15 @@ generate_brick_volfiles (glusterd_volinfo_t *volinfo)
if (ret) {
ret = open (tstamp_file, O_WRONLY|O_CREAT|O_EXCL, 0600);
if (ret == -1 && errno == EEXIST) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"timestamp file exist");
ret = -2;
}
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR, "failed to create "
- "%s (%s)", tstamp_file, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_FILE_OP_FAILED,
+ "failed to create "
+ "%s", tstamp_file);
return -1;
}
if (ret >= 0) {
@@ -4646,7 +4737,8 @@ generate_brick_volfiles (glusterd_volinfo_t *volinfo)
ret = gf_set_timestamp (parent_tstamp_file,
tstamp_file);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_TSTAMP_SET_FAIL,
"Unable to set atime and mtime"
" of %s as of %s", tstamp_file,
parent_tstamp_file);
@@ -4659,14 +4751,16 @@ generate_brick_volfiles (glusterd_volinfo_t *volinfo)
if (ret == -1 && errno == ENOENT)
ret = 0;
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR, "failed to unlink "
- "%s (%s)", tstamp_file, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_FILE_OP_FAILED,
+ "failed to unlink "
+ "%s", tstamp_file);
return -1;
}
}
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Found a brick - %s:%s", brickinfo->hostname,
brickinfo->path);
@@ -4679,7 +4773,7 @@ generate_brick_volfiles (glusterd_volinfo_t *volinfo)
ret = 0;
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -4755,7 +4849,8 @@ generate_client_volfiles (glusterd_volinfo_t *volinfo,
type);
}
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY,
"Received invalid transport-type");
goto out;
}
@@ -4770,7 +4865,8 @@ generate_client_volfiles (glusterd_volinfo_t *volinfo,
/* Generate volfile for rebalance process */
ret = dict_set_int32 (dict, "rebalance-volfile-creation", _gf_true);
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 rebalance-volfile-creation");
goto out;
}
@@ -4781,7 +4877,8 @@ generate_client_volfiles (glusterd_volinfo_t *volinfo,
filepath,
dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL,
"Failed to create rebalance volfile for %s",
volinfo->volname);
goto out;
@@ -4791,7 +4888,7 @@ out:
if (dict)
dict_unref (dict);
- gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -4817,7 +4914,8 @@ glusterd_snapdsvc_generate_volfile (volgen_graph_t *graph,
if (!ret) {
ret = dict_get_str (set_dict, "loglevel", &loglevel);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR, "could not get both"
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "could not get both"
" translator name and loglevel for log level "
"request");
return -1;
@@ -4854,7 +4952,8 @@ glusterd_snapdsvc_generate_volfile (volgen_graph_t *graph,
if (dict_get_str (set_dict, SSL_CERT_DEPTH_OPT, &value) == 0) {
ret = xlator_set_option (xl, "ssl-cert-depth", value);
if (ret) {
- gf_log ("glusterd", GF_LOG_WARNING,
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_XLATOR_SET_OPT_FAIL,
"failed to set ssl-cert-depth");
return -1;
}
@@ -4863,7 +4962,8 @@ glusterd_snapdsvc_generate_volfile (volgen_graph_t *graph,
if (dict_get_str (set_dict, SSL_CIPHER_LIST_OPT, &value) == 0) {
ret = xlator_set_option (xl, "ssl-cipher-list", value);
if (ret) {
- gf_log ("glusterd", GF_LOG_WARNING,
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_XLATOR_SET_OPT_FAIL,
"failed to set ssl-cipher-list");
return -1;
}
@@ -5265,21 +5365,24 @@ glusterd_create_volfiles (glusterd_volinfo_t *volinfo)
ret = generate_brick_volfiles (volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL,
"Could not generate volfiles for bricks");
goto out;
}
ret = generate_client_volfiles (volinfo, GF_CLIENT_TRUSTED);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL,
"Could not generate trusted client volfiles");
goto out;
}
ret = generate_client_volfiles (volinfo, GF_CLIENT_OTHER);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL,
"Could not generate client volfiles");
out:
@@ -5334,8 +5437,10 @@ glusterd_delete_volfile (glusterd_volinfo_t *volinfo,
get_brick_filepath (filename, volinfo, brickinfo);
ret = unlink (filename);
if (ret)
- gf_log ("glusterd", GF_LOG_ERROR, "failed to delete file: %s, "
- "reason: %s", filename, strerror (errno));
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_FILE_OP_FAILED,
+ "failed to delete file: %s",
+ filename);
return ret;
}
@@ -5362,7 +5467,7 @@ validate_shdopts (glusterd_volinfo_t *volinfo,
volgen_graph_free (&graph);
- gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
out:
dict_del (val_dict, "graph-check");
return ret;
@@ -5391,7 +5496,8 @@ validate_nfsopts (glusterd_volinfo_t *volinfo,
snprintf (err_str, sizeof (err_str), "Changing nfs "
"transport type is allowed only for volumes "
"of transport type tcp,rdma");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_UNSUPPORTED, "%s", err_str);
*op_errstr = gf_strdup (err_str);
ret = -1;
goto out;
@@ -5407,7 +5513,8 @@ validate_nfsopts (glusterd_volinfo_t *volinfo,
ret = dict_set_str (val_dict, "volume-name", volinfo->volname);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set volume name");
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to set volume name");
goto out;
}
@@ -5420,7 +5527,7 @@ validate_nfsopts (glusterd_volinfo_t *volinfo,
out:
if (dict_get (val_dict, "volume-name"))
dict_del (val_dict, "volume-name");
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -5443,7 +5550,7 @@ validate_clientopts (glusterd_volinfo_t *volinfo,
volgen_graph_free (&graph);
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -5466,7 +5573,7 @@ validate_brickopts (glusterd_volinfo_t *volinfo,
volgen_graph_free (&graph);
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -5479,7 +5586,7 @@ glusterd_validate_brickreconf (glusterd_volinfo_t *volinfo,
int ret = -1;
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
- gf_log ("", GF_LOG_DEBUG,
+ gf_msg_debug ("glusterd", 0,
"Validating %s", brickinfo->hostname);
ret = validate_brickopts (volinfo, brickinfo, val_dict,
@@ -5522,32 +5629,32 @@ glusterd_validate_globalopts (glusterd_volinfo_t *volinfo,
ret = glusterd_validate_brickreconf (volinfo, val_dict, op_errstr);
if (ret) {
- gf_log ("", GF_LOG_DEBUG,
+ gf_msg_debug ("glusterd", 0,
"Could not Validate bricks");
goto out;
}
ret = validate_clientopts (volinfo, val_dict, op_errstr);
if (ret) {
- gf_log ("", GF_LOG_DEBUG,
+ gf_msg_debug ("glusterd", 0,
"Could not Validate client");
goto out;
}
ret = validate_nfsopts (volinfo, val_dict, op_errstr);
if (ret) {
- gf_log ("", GF_LOG_DEBUG, "Could not Validate nfs");
+ gf_msg_debug ("glusterd", 0, "Could not Validate nfs");
goto out;
}
ret = validate_shdopts (volinfo, val_dict, op_errstr);
if (ret) {
- gf_log ("", GF_LOG_DEBUG, "Could not Validate self-heald");
+ gf_msg_debug ("glusterd", 0, "Could not Validate self-heald");
goto out;
}
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -5579,34 +5686,34 @@ glusterd_validate_reconfopts (glusterd_volinfo_t *volinfo, dict_t *val_dict,
ret = glusterd_validate_brickreconf (volinfo, val_dict, op_errstr);
if (ret) {
- gf_log ("", GF_LOG_DEBUG,
+ gf_msg_debug ("glusterd", 0,
"Could not Validate bricks");
goto out;
}
ret = validate_clientopts (volinfo, val_dict, op_errstr);
if (ret) {
- gf_log ("", GF_LOG_DEBUG,
+ gf_msg_debug ("glusterd", 0,
"Could not Validate client");
goto out;
}
ret = validate_nfsopts (volinfo, val_dict, op_errstr);
if (ret) {
- gf_log ("", GF_LOG_DEBUG, "Could not Validate nfs");
+ gf_msg_debug ("glusterd", 0, "Could not Validate nfs");
goto out;
}
ret = validate_shdopts (volinfo, val_dict, op_errstr);
if (ret) {
- gf_log ("", GF_LOG_DEBUG, "Could not Validate self-heald");
+ gf_msg_debug ("glusterd", 0, "Could not Validate self-heald");
goto out;
}
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("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 a7cebfe4763..a1aa9595b5e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -167,7 +167,8 @@ glusterd_check_brick_order(dict_t *dict, char *err_str)
" not retrieve disperse count");
goto out;
}
- gf_log (this->name, GF_LOG_INFO, "Disperse cluster type"
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_DISPERSE_CLUSTER_FOUND, "Disperse cluster type"
" found. Checking brick order.");
}
@@ -782,7 +783,8 @@ __glusterd_handle_cli_heal_volume (rpcsvc_request_t *req)
goto out;
}
- gf_log (this->name, GF_LOG_INFO, "Received heal vol req "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_HEAL_VOL_REQ_RCVD, "Received heal vol req "
"for volume %s", volname);
ret = glusterd_volinfo_find (volname, &volinfo);
@@ -917,7 +919,8 @@ __glusterd_handle_cli_statedump_volume (rpcsvc_request_t *req)
goto out;
}
- gf_log (this->name, GF_LOG_INFO, "Received statedump request for "
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_STATEDUMP_VOL_REQ_RCVD, "Received statedump request for "
"volume %s with options %s", volname, options);
ret = glusterd_op_begin_synctask (req, GD_OP_STATEDUMP_VOLUME, dict);
@@ -1018,7 +1021,9 @@ next:
continue;
if (!strcmp (prop.value.string, "thin-pool")) {
brick->caps |= CAPS_THIN;
- gf_log (THIS->name, GF_LOG_INFO, "Thin Pool "
+ gf_msg (THIS->name, GF_LOG_INFO, 0,
+ GD_MSG_THINPOOLS_FOR_THINLVS,
+ "Thin Pool "
"\"%s\" will be used for thin LVs",
lvm_lv_get_name (lv_list->lv));
break;
@@ -1259,7 +1264,8 @@ out:
glusterd_brickinfo_delete (brick_info);
if (msg[0] != '\0') {
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_STAGE_CREATE_VOL_FAIL, "%s", msg);
*op_errstr = gf_strdup (msg);
}
gf_msg_debug (this->name, 0, "Returning %d", ret);
@@ -1507,7 +1513,8 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr,
ret = 0;
out:
if (ret && (msg[0] != '\0')) {
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_STAGE_START_VOL_FAIL, "%s", msg);
*op_errstr = gf_strdup (msg);
}
return ret;
@@ -1578,7 +1585,8 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr)
if (ret) {
ret = ganesha_manage_export(dict, "off", op_errstr);
if (ret) {
- gf_log (THIS->name, GF_LOG_WARNING, "Could not "
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ GD_MSG_NFS_GNS_UNEXPRT_VOL_FAIL, "Could not "
"unexport volume via NFS-Ganesha");
ret = 0;
}
@@ -1662,7 +1670,8 @@ glusterd_op_stage_delete_volume (dict_t *dict, char **op_errstr)
out:
if (msg[0] != '\0') {
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_STAGE_DELETE_VOL_FAIL, "%s", msg);
*op_errstr = gf_strdup (msg);
}
gf_msg_debug (this->name, 0, "Returning %d", ret);
@@ -1747,7 +1756,8 @@ glusterd_handle_heal_cmd (xlator_t *this, glusterd_volinfo_t *volinfo,
}
out:
if (ret)
- gf_log (this->name, GF_LOG_WARNING, "%s", *op_errstr);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_HANDLE_HEAL_CMD_FAIL, "%s", *op_errstr);
return ret;
}
@@ -2904,7 +2914,9 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
if (ret)
ret = 0;
- gf_log (THIS->name, GF_LOG_INFO, "Received clear-locks request for "
+ gf_msg (THIS->name, GF_LOG_INFO, 0,
+ GD_MSG_CLRCLK_VOL_REQ_RCVD,
+ "Received clear-locks request for "
"volume %s with kind %s type %s and options %s", volname,
kind, type, opts);
@@ -2961,7 +2973,8 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = glusterd_clearlocks_send_cmd (volinfo, cmd_str, path, result,
msg, sizeof (msg), mntpt);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_CLRCLK_SND_CMD_FAIL, "%s", msg);
goto umount;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 3b3dd347c96..7fa070c7d7d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -32,7 +32,8 @@ validate_tier (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
snprintf (errstr, sizeof (errstr), "Volume %s is not a tier "
"volume. Option %s is only valid for tier volume.",
volinfo->volname, key);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INCOMPATIBLE_VALUE, "%s", errstr);
*op_errstr = gf_strdup (errstr);
ret = -1;
goto out;
@@ -49,7 +50,8 @@ validate_tier (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
snprintf (errstr, sizeof (errstr), "%s is not a compatible "
"value. %s expects an integer value.",
value, key);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INCOMPATIBLE_VALUE, "%s", errstr);
*op_errstr = gf_strdup (errstr);
ret = -1;
goto out;
@@ -62,7 +64,8 @@ validate_tier (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
"compatible value. %s expects a positive "
"integer value.",
value, key);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INCOMPATIBLE_VALUE, "%s", errstr);
*op_errstr = gf_strdup (errstr);
ret = -1;
goto out;
@@ -73,7 +76,8 @@ validate_tier (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
"compatible value. %s expects a non-negative"
" integer value.",
value, key);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INCOMPATIBLE_VALUE, "%s", errstr);
*op_errstr = gf_strdup (errstr);
ret = -1;
goto out;
@@ -81,7 +85,7 @@ validate_tier (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
}
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -164,11 +168,12 @@ validate_defrag_throttle_option (glusterd_volinfo_t *volinfo, dict_t *dict,
ret = -1;
snprintf (errstr, sizeof (errstr), "%s should be "
"{lazy|normal|aggressive}", key);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s", errstr);
*op_errstr = gf_strdup (errstr);
}
- 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.c b/xlators/mgmt/glusterd/src/glusterd.c
index 57592c87342..42037056263 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -152,7 +152,8 @@ glusterd_uuid_init ()
ret = glusterd_retrieve_uuid ();
if (ret == 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_RETRIEVED_UUID,
"retrieved UUID: %s", uuid_utoa (priv->uuid));
return 0;
}
@@ -183,7 +184,8 @@ glusterd_uuid_generate_save ()
gf_uuid_generate (priv->uuid);
- gf_log (this->name, GF_LOG_INFO, "generated UUID: %s",
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_GENERATED_UUID, "generated UUID: %s",
uuid_utoa (priv->uuid));
ret = glusterd_store_global_info (this);
@@ -395,7 +397,7 @@ glusterd_rpcsvc_options_build (dict_t *options)
goto out;
}
- gf_msg_debug ("", 0, "listen-backlog value: %d", backlog);
+ gf_msg_debug ("glusterd", 0, "listen-backlog value: %d", backlog);
out:
return ret;
@@ -478,7 +480,7 @@ group_write_allow (char *path, gid_t gid)
out:
if (ret == -1)
- gf_msg ("", GF_LOG_CRITICAL, errno,
+ gf_msg ("glusterd", GF_LOG_CRITICAL, errno,
GD_MSG_WRITE_ACCESS_GRANT_FAIL,
"failed to set up write access to %s for group %d (%s)",
path, gid, strerror (errno));
@@ -590,7 +592,7 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
}
out:
- gf_msg_debug ("", 0, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -842,7 +844,7 @@ check_prepare_mountbroker_root (char *mountbroker_root)
ret = fstat (dfd, &st);
}
if (ret == -1 || !S_ISDIR (st.st_mode)) {
- gf_msg ("", GF_LOG_ERROR, errno,
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
GD_MSG_DIR_OP_FAILED,
"cannot access mountbroker-root directory %s",
mountbroker_root);
@@ -851,7 +853,7 @@ check_prepare_mountbroker_root (char *mountbroker_root)
}
if (st.st_uid != 0 ||
(st.st_mode & (S_IWGRP|S_IWOTH))) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DIR_PERM_LIBERAL,
"permissions on mountbroker-root directory %s are "
"too liberal", mountbroker_root);
@@ -859,7 +861,7 @@ check_prepare_mountbroker_root (char *mountbroker_root)
goto out;
}
if (!(st.st_mode & (S_IXGRP|S_IXOTH))) {
- gf_msg ("", GF_LOG_WARNING, 0,
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
GD_MSG_DIR_PERM_STRICT,
"permissions on mountbroker-root directory %s are "
"probably too strict", mountbroker_root);
@@ -874,7 +876,7 @@ check_prepare_mountbroker_root (char *mountbroker_root)
ret = fstat (dfd2, &st2);
}
if (ret == -1) {
- gf_msg ("", GF_LOG_ERROR, errno,
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
GD_MSG_DIR_OP_FAILED,
"error while checking mountbroker-root ancestors "
"%d (%s)", errno, strerror (errno));
@@ -887,7 +889,7 @@ check_prepare_mountbroker_root (char *mountbroker_root)
if (st2.st_uid != 0 ||
((st2.st_mode & (S_IWGRP|S_IWOTH)) &&
!(st2.st_mode & S_ISVTX))) {
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DIR_PERM_LIBERAL,
"permissions on ancestors of mountbroker-root "
"directory are too liberal");
@@ -895,7 +897,7 @@ check_prepare_mountbroker_root (char *mountbroker_root)
goto out;
}
if (!(st.st_mode & (S_IXGRP|S_IXOTH))) {
- gf_msg ("", GF_LOG_WARNING, 0,
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
GD_MSG_DIR_PERM_STRICT,
"permissions on ancestors of mountbroker-root "
"directory are probably too strict");
@@ -912,7 +914,7 @@ check_prepare_mountbroker_root (char *mountbroker_root)
if (ret != -1)
ret = sys_fstatat (dfd0, MB_HIVE, &st, AT_SYMLINK_NOFOLLOW);
if (ret == -1 || st.st_mode != (S_IFDIR|0711)) {
- gf_msg ("", GF_LOG_ERROR, errno,
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
GD_MSG_CREATE_DIR_FAILED,
"failed to set up mountbroker-root directory %s",
mountbroker_root);
@@ -1004,7 +1006,7 @@ _install_mount_spec (dict_t *opts, char *key, data_t *value, void *data)
return 0;
err:
- gf_msg ("", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_MOUNT_SPEC_INSTALL_FAIL,
"adding %smount spec failed: label: %s desc: %s",
georep ? GEOREP" " : "", label, pdesc);
@@ -1159,7 +1161,7 @@ glusterd_stop_listener (xlator_t *this)
conf = this->private;
GF_VALIDATE_OR_GOTO (this->name, conf, out);
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"%s function called ", __func__);
for (i = 0; i < gd_inet_programs_count; i++) {
@@ -1311,19 +1313,21 @@ glusterd_svc_init_all ()
/* Init BitD svc */
ret = glusterd_bitdsvc_init (&(priv->bitd_svc));
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to initialized BitD "
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_BITD_INIT_FAIL, "Failed to initialized BitD "
"service");
goto out;
}
- gf_log (THIS->name, GF_LOG_DEBUG, "BitD service initialized");
+ gf_msg_debug (THIS->name, 0, "BitD service initialized");
ret = glusterd_scrubsvc_init (&(priv->scrub_svc));
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to initialized scrub "
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_SCRUB_INIT_FAIL, "Failed to initialized scrub "
"service");
goto out;
}
- gf_log (THIS->name, GF_LOG_DEBUG, "scrub service initialized");
+ gf_msg_debug (THIS->name, 0, "scrub service initialized");
out:
return ret;
@@ -1365,9 +1369,10 @@ init (xlator_t *this)
gf_msg (this->name, GF_LOG_ERROR, errno,
GD_MSG_SETXATTR_FAIL,
"Failed to set 'ulimit -n "
- " 65536': %s", strerror(errno));
+ " 65536'");
} else {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_FILE_DESC_LIMIT_SET,
"Maximum allowed open file descriptors "
"set to 65536");
}
@@ -1416,12 +1421,14 @@ init (xlator_t *this)
}
setenv ("GLUSTERD_WORKDIR", workdir, 1);
- gf_log (this->name, GF_LOG_INFO, "Using %s as working directory",
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_CURR_WORK_DIR_INFO, "Using %s as working directory",
workdir);
ret = glusterd_find_correct_var_run_dir (this, var_run_dir);
if (ret) {
- gf_log (this->name, GF_LOG_CRITICAL, "Unable to find "
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ GD_MSG_VAR_RUN_DIR_FIND_FAIL, "Unable to find "
"the correct var run dir");
exit (1);
}
@@ -1441,7 +1448,8 @@ init (xlator_t *this)
ret = glusterd_init_var_run_dirs (this, var_run_dir,
GLUSTER_SHARED_STORAGE_BRICK_DIR);
if (ret) {
- gf_log (this->name, GF_LOG_CRITICAL, "Unable to create "
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ GD_MSG_VAR_RUN_DIR_INIT_FAIL, "Unable to create "
"shared storage brick");
exit (1);
}
@@ -1519,18 +1527,20 @@ init (xlator_t *this)
snprintf (storedir, PATH_MAX, "%s/bitd", workdir);
ret = mkdir (storedir, 0777);
if ((-1 == ret) && (errno != EEXIST)) {
- gf_log (this->name, GF_LOG_CRITICAL,
- "Unable to create bitrot directory %s"
- " ,errno = %d", storedir, errno);
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
+ "Unable to create bitrot directory %s",
+ storedir);
exit (1);
}
snprintf (storedir, PATH_MAX, "%s/scrub", workdir);
ret = mkdir (storedir, 0777);
if ((-1 == ret) && (errno != EEXIST)) {
- gf_log (this->name, GF_LOG_CRITICAL,
- "Unable to create scrub directory %s"
- " ,errno = %d", storedir, errno);
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
+ "Unable to create scrub directory %s",
+ storedir);
exit (1);
}