summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd.c
diff options
context:
space:
mode:
authorNandaja Varma <nandaja.varma@gmail.com>2015-03-13 16:55:17 +0530
committerAtin Mukherjee <amukherj@redhat.com>2015-06-15 22:28:58 -0700
commit25f28a9c23b1adf665a982c2f5157bf13361521b (patch)
tree7318a5ec7d805169d46ab58c3c4947190751a0cc /xlators/mgmt/glusterd/src/glusterd.c
parent60b6e5d2c3442ea0f7f85374d6613cd0dd76604c (diff)
rebalance,store,glusterd/glusterd: porting to new logging framework
Change-Id: I231b79e3414e60fe67cde577dd585cce83c8bfad BUG: 1194640 Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com> Reviewed-on: http://review.gluster.org/9877 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Sachin Pandit <spandit@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c208
1 files changed, 136 insertions, 72 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index c71b79882fb..9b86f9bdb94 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -41,6 +41,7 @@
#include "glusterd-scrub-svc.h"
#include "glusterd-quotad-svc.h"
#include "glusterd-snapd-svc.h"
+#include "glusterd-messages.h"
#include "common-utils.h"
#include "glusterd-geo-rep.h"
#include "run.h"
@@ -155,7 +156,8 @@ glusterd_uuid_init ()
ret = glusterd_uuid_generate_save ();
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_UUID_GEN_STORE_FAIL,
"Unable to generate and save new UUID");
return ret;
}
@@ -183,7 +185,8 @@ glusterd_uuid_generate_save ()
ret = glusterd_store_global_info (this);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_UUID_STORE_FAIL,
"Unable to store the generated uuid %s",
uuid_utoa (priv->uuid));
@@ -215,7 +218,8 @@ glusterd_options_init (xlator_t *this)
ret = glusterd_store_options (this, priv->opts);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to store version");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VERS_STORE_FAIL, "Unable to store version");
return ret;
}
out:
@@ -294,7 +298,8 @@ mem_acct_init (xlator_t *this)
ret = xlator_mem_acct_init (this, gf_gld_mt_end + 1);
if (ret != 0) {
- gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Memory accounting init"
" failed");
return ret;
}
@@ -311,7 +316,8 @@ glusterd_rpcsvc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
glusterd_conf_t *priv = NULL;
if (!xl || !data) {
- gf_log ("glusterd", GF_LOG_WARNING,
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_NO_INIT,
"Calling rpc_notify without initializing");
goto out;
}
@@ -356,7 +362,7 @@ glusterd_program_register (xlator_t *this, rpcsvc_t *svc,
ret = rpcsvc_program_register (svc, prog);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"cannot register program (name: %s, prognum:%d, "
"progver:%d)", prog->progname, prog->prognum,
prog->progver);
@@ -385,7 +391,7 @@ glusterd_rpcsvc_options_build (dict_t *options)
goto out;
}
- gf_log ("", GF_LOG_DEBUG, "listen-backlog value: %d", backlog);
+ gf_msg_debug ("", 0, "listen-backlog value: %d", backlog);
out:
return ret;
@@ -406,12 +412,14 @@ glusterd_check_gsync_present (int *valid_state)
ret = runner_start (&runner);
if (ret == -1) {
if (errno == ENOENT) {
- gf_log ("glusterd", GF_LOG_INFO, GEOREP
+ gf_msg ("glusterd", GF_LOG_INFO, errno,
+ GD_MSG_MODULE_NOT_INSTALLED, GEOREP
" module not installed in the system");
*valid_state = 0;
}
else {
- gf_log ("glusterd", GF_LOG_ERROR, GEOREP
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_MODULE_NOT_WORKING, GEOREP
" module not working as desired");
*valid_state = -1;
}
@@ -422,14 +430,16 @@ glusterd_check_gsync_present (int *valid_state)
if (ptr) {
if (!strstr (buff, "gsyncd")) {
ret = -1;
- gf_log ("glusterd", GF_LOG_ERROR, GEOREP" module not "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_MODULE_NOT_WORKING, GEOREP" module not "
"working as desired");
*valid_state = -1;
goto out;
}
} else {
ret = -1;
- gf_log ("glusterd", GF_LOG_ERROR, GEOREP" module not "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_MODULE_NOT_WORKING, GEOREP" module not "
"working as desired");
*valid_state = -1;
goto out;
@@ -440,7 +450,7 @@ glusterd_check_gsync_present (int *valid_state)
runner_end (&runner);
- gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -464,7 +474,8 @@ group_write_allow (char *path, gid_t gid)
out:
if (ret == -1)
- gf_log ("", GF_LOG_CRITICAL,
+ gf_msg ("", 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));
return ret;
@@ -482,7 +493,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
if (strlen (conf->workdir)+2 > PATH_MAX-strlen(GEOREP)) {
ret = -1;
- gf_log ("glusterd", GF_LOG_CRITICAL,
+ gf_msg ("glusterd", GF_LOG_CRITICAL, 0,
+ GD_MSG_DIRPATH_TOO_LONG,
"directory path %s/"GEOREP" is longer than PATH_MAX",
conf->workdir);
goto out;
@@ -491,7 +503,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
snprintf (georepdir, PATH_MAX, "%s/"GEOREP, conf->workdir);
ret = mkdir_p (georepdir, 0777, _gf_true);
if (-1 == ret) {
- gf_log ("glusterd", GF_LOG_CRITICAL,
+ gf_msg ("glusterd", GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create "GEOREP" directory %s",
georepdir);
goto out;
@@ -499,14 +512,16 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
if (strlen (DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP) >= PATH_MAX) {
ret = -1;
- gf_log ("glusterd", GF_LOG_CRITICAL,
+ gf_msg ("glusterd", GF_LOG_CRITICAL, 0,
+ GD_MSG_DIRPATH_TOO_LONG,
"directory path "DEFAULT_LOG_FILE_DIRECTORY"/"
GEOREP" is longer than PATH_MAX");
goto out;
}
ret = mkdir_p (DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP, 0777, _gf_true);
if (-1 == ret) {
- gf_log ("glusterd", GF_LOG_CRITICAL,
+ gf_msg ("glusterd", GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create "GEOREP" log directory");
goto out;
}
@@ -514,7 +529,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
/* Slave log file directory */
if (strlen(DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves") >= PATH_MAX) {
ret = -1;
- gf_log ("glusterd", GF_LOG_CRITICAL,
+ gf_msg ("glusterd", GF_LOG_CRITICAL, 0,
+ GD_MSG_DIRPATH_TOO_LONG,
"directory path "DEFAULT_LOG_FILE_DIRECTORY"/"
GEOREP"-slaves"" is longer than PATH_MAX");
goto out;
@@ -522,7 +538,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
ret = mkdir_p (DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves", 0777,
_gf_true);
if (-1 == ret) {
- gf_log ("glusterd", GF_LOG_CRITICAL,
+ gf_msg ("glusterd", GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create "GEOREP" slave log directory");
goto out;
}
@@ -530,7 +547,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
/* MountBroker log file directory */
if (strlen(DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr") >= PATH_MAX) {
ret = -1;
- gf_log ("glusterd", GF_LOG_CRITICAL,
+ gf_msg ("glusterd", GF_LOG_CRITICAL, 0,
+ GD_MSG_DIRPATH_TOO_LONG,
"directory path "DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP
"-slaves/mbr"" is longer than PATH_MAX");
goto out;
@@ -538,7 +556,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
ret = mkdir_p (DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr", 0777,
_gf_true);
if (-1 == ret) {
- gf_log ("glusterd", GF_LOG_CRITICAL,
+ gf_msg ("glusterd", GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create "GEOREP" mountbroker slave log directory");
goto out;
}
@@ -549,7 +568,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
else {
gr = getgrnam (greplg_s);
if (!gr) {
- gf_log ("glusterd", GF_LOG_CRITICAL,
+ gf_msg ("glusterd", GF_LOG_CRITICAL, 0,
+ GD_MSG_LOGGROUP_INVALID,
"group "GEOREP"-log-group %s does not exist", greplg_s);
ret = -1;
goto out;
@@ -566,7 +586,7 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
}
out:
- gf_log("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("", 0, "Returning %d", ret);
return ret;
}
@@ -818,7 +838,8 @@ check_prepare_mountbroker_root (char *mountbroker_root)
ret = fstat (dfd, &st);
}
if (ret == -1 || !S_ISDIR (st.st_mode)) {
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("", GF_LOG_ERROR, errno,
+ GD_MSG_DIR_OP_FAILED,
"cannot access mountbroker-root directory %s",
mountbroker_root);
ret = -1;
@@ -826,14 +847,16 @@ check_prepare_mountbroker_root (char *mountbroker_root)
}
if (st.st_uid != 0 ||
(st.st_mode & (S_IWGRP|S_IWOTH))) {
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("", GF_LOG_ERROR, 0,
+ GD_MSG_DIR_PERM_LIBERAL,
"permissions on mountbroker-root directory %s are "
"too liberal", mountbroker_root);
ret = -1;
goto out;
}
if (!(st.st_mode & (S_IXGRP|S_IXOTH))) {
- gf_log ("", GF_LOG_WARNING,
+ gf_msg ("", GF_LOG_WARNING, 0,
+ GD_MSG_DIR_PERM_STRICT,
"permissions on mountbroker-root directory %s are "
"probably too strict", mountbroker_root);
}
@@ -847,7 +870,8 @@ check_prepare_mountbroker_root (char *mountbroker_root)
ret = fstat (dfd2, &st2);
}
if (ret == -1) {
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("", GF_LOG_ERROR, errno,
+ GD_MSG_DIR_OP_FAILED,
"error while checking mountbroker-root ancestors "
"%d (%s)", errno, strerror (errno));
goto out;
@@ -859,14 +883,16 @@ 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_log ("", GF_LOG_ERROR,
+ gf_msg ("", GF_LOG_ERROR, 0,
+ GD_MSG_DIR_PERM_LIBERAL,
"permissions on ancestors of mountbroker-root "
"directory are too liberal");
ret = -1;
goto out;
}
if (!(st.st_mode & (S_IXGRP|S_IXOTH))) {
- gf_log ("", GF_LOG_WARNING,
+ gf_msg ("", GF_LOG_WARNING, 0,
+ GD_MSG_DIR_PERM_STRICT,
"permissions on ancestors of mountbroker-root "
"directory are probably too strict");
}
@@ -882,7 +908,8 @@ 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_log ("", GF_LOG_ERROR,
+ gf_msg ("", GF_LOG_ERROR, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"failed to set up mountbroker-root directory %s",
mountbroker_root);
ret = -1;
@@ -973,7 +1000,8 @@ _install_mount_spec (dict_t *opts, char *key, data_t *value, void *data)
return 0;
err:
- gf_log ("", GF_LOG_ERROR,
+ gf_msg ("", GF_LOG_ERROR, 0,
+ GD_MSG_MOUNT_SPEC_INSTALL_FAIL,
"adding %smount spec failed: label: %s desc: %s",
georep ? GEOREP" " : "", label, pdesc);
@@ -1038,14 +1066,14 @@ glusterd_init_uds_listener (xlator_t *this)
ret = rpcsvc_register_notify (rpc, glusterd_uds_rpcsvc_notify,
this);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Failed to register notify function");
goto out;
}
ret = rpcsvc_create_listeners (rpc, options, this->name);
if (ret != 1) {
- gf_log (this->name, GF_LOG_DEBUG, "Failed to create listener");
+ gf_msg_debug (this->name, 0, "Failed to create listener");
goto out;
}
ret = 0;
@@ -1067,7 +1095,9 @@ out:
dict_unref (options);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to start glusterd "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_GLUSTERD_SOCK_LISTENER_START_FAIL,
+ "Failed to start glusterd "
"unix domain socket listener.");
if (rpc) {
GF_FREE (rpc);
@@ -1161,7 +1191,8 @@ glusterd_find_correct_var_run_dir (xlator_t *this, char *var_run_dir)
*/
ret = lstat (GLUSTERD_VAR_RUN_DIR, &buf);
if (ret != 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_FILE_OP_FAILED,
"stat fails on %s, exiting. (errno = %d)",
GLUSTERD_VAR_RUN_DIR, errno);
goto out;
@@ -1196,7 +1227,8 @@ glusterd_init_var_run_dirs (xlator_t *this, char *var_run_dir,
ret = stat (abs_path, &buf);
if ((ret != 0) && (ENOENT != errno)) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_FILE_OP_FAILED,
"stat fails on %s, exiting. (errno = %d)",
abs_path, errno);
ret = -1;
@@ -1204,7 +1236,8 @@ glusterd_init_var_run_dirs (xlator_t *this, char *var_run_dir,
}
if ((!ret) && (!S_ISDIR(buf.st_mode))) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, ENOENT,
+ GD_MSG_DIR_NOT_FOUND,
"Provided snap path %s is not a directory,"
"exiting", abs_path);
ret = -1;
@@ -1216,7 +1249,8 @@ glusterd_init_var_run_dirs (xlator_t *this, char *var_run_dir,
ret = mkdir_p (abs_path, 0777, _gf_true);
if (-1 == ret) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create directory %s"
" ,errno = %d", abs_path, errno);
goto out;
@@ -1243,27 +1277,32 @@ glusterd_svc_init_all ()
/* Init SHD svc */
ret = glusterd_shdsvc_init (&(priv->shd_svc));
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to init shd service");
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_FAILED_INIT_SHDSVC,
+ "Failed to init shd service");
goto out;
}
- gf_log (THIS->name, GF_LOG_DEBUG, "shd service initialized");
+ gf_msg_debug (THIS->name, 0, "shd service initialized");
/* Init NFS svc */
ret = glusterd_nfssvc_init (&(priv->nfs_svc));
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to init nfs service");
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_FAILED_INIT_NFSSVC,
+ "Failed to init nfs service");
goto out;
}
- gf_log (THIS->name, GF_LOG_DEBUG, "nfs service initialized");
+ gf_msg_debug (THIS->name, 0, "nfs service initialized");
/* Init QuotaD svc */
ret = glusterd_quotadsvc_init (&(priv->quotad_svc));
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to init quotad "
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_FAILED_INIT_QUOTASVC, "Failed to init quotad "
"service");
goto out;
}
- gf_log (THIS->name, GF_LOG_DEBUG, "quotad service initialized");
+ gf_msg_debug (THIS->name, 0, "quotad service initialized");
/* Init BitD svc */
ret = glusterd_bitdsvc_init (&(priv->bitd_svc));
@@ -1319,7 +1358,8 @@ init (xlator_t *this)
lim.rlim_max = 65536;
if (setrlimit (RLIMIT_NOFILE, &lim) == -1) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_SETXATTR_FAIL,
"Failed to set 'ulimit -n "
" 65536': %s", strerror(errno));
} else {
@@ -1341,14 +1381,16 @@ init (xlator_t *this)
ret = stat (workdir, &buf);
if ((ret != 0) && (ENOENT != errno)) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DIR_OP_FAILED,
"stat fails on %s, exiting. (errno = %d)",
workdir, errno);
exit (1);
}
if ((!ret) && (!S_ISDIR(buf.st_mode))) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, ENOENT,
+ GD_MSG_DIR_NOT_FOUND,
"Provided working area %s is not a directory,"
"exiting", workdir);
exit (1);
@@ -1359,7 +1401,8 @@ init (xlator_t *this)
ret = mkdir_p (workdir, 0777, _gf_true);
if (-1 == ret) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create directory %s"
" ,errno = %d", workdir, errno);
exit (1);
@@ -1382,8 +1425,9 @@ init (xlator_t *this)
ret = glusterd_init_var_run_dirs (this, var_run_dir,
GLUSTERD_DEFAULT_SNAPS_BRICK_DIR);
if (ret) {
- gf_log (this->name, GF_LOG_CRITICAL, "Unable to create "
- "snap backend dir");
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ GD_MSG_CREATE_DIR_FAILED, "Unable to create "
+ "snap backend folder");
exit (1);
}
@@ -1406,7 +1450,8 @@ init (xlator_t *this)
ret = gf_cmd_log_init (cmd_log_filename);
if (ret == -1) {
- gf_log ("this->name", GF_LOG_CRITICAL,
+ gf_msg ("this->name", GF_LOG_CRITICAL, errno,
+ GD_MSG_FILE_OP_FAILED,
"Unable to create cmd log file %s", cmd_log_filename);
exit (1);
}
@@ -1416,7 +1461,8 @@ init (xlator_t *this)
ret = mkdir (storedir, 0777);
if ((-1 == ret) && (errno != EEXIST)) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create volume directory %s"
" ,errno = %d", storedir, errno);
exit (1);
@@ -1427,7 +1473,8 @@ init (xlator_t *this)
ret = mkdir (storedir, 0777);
if ((-1 == ret) && (errno != EEXIST)) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create snaps directory %s"
" ,errno = %d", storedir, errno);
exit (1);
@@ -1438,7 +1485,8 @@ init (xlator_t *this)
ret = mkdir (storedir, 0777);
if ((-1 == ret) && (errno != EEXIST)) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create peers directory %s"
" ,errno = %d", storedir, errno);
exit (1);
@@ -1447,7 +1495,8 @@ init (xlator_t *this)
snprintf (storedir, PATH_MAX, "%s/bricks", DEFAULT_LOG_FILE_DIRECTORY);
ret = mkdir (storedir, 0777);
if ((-1 == ret) && (errno != EEXIST)) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create logs directory %s"
" ,errno = %d", storedir, errno);
exit (1);
@@ -1456,7 +1505,8 @@ init (xlator_t *this)
snprintf (storedir, PATH_MAX, "%s/nfs", workdir);
ret = mkdir (storedir, 0777);
if ((-1 == ret) && (errno != EEXIST)) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create nfs directory %s"
" ,errno = %d", storedir, errno);
exit (1);
@@ -1483,7 +1533,8 @@ init (xlator_t *this)
snprintf (storedir, PATH_MAX, "%s/glustershd", workdir);
ret = mkdir (storedir, 0777);
if ((-1 == ret) && (errno != EEXIST)) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create glustershd directory %s"
" ,errno = %d", storedir, errno);
exit (1);
@@ -1492,7 +1543,8 @@ init (xlator_t *this)
snprintf (storedir, PATH_MAX, "%s/quotad", workdir);
ret = mkdir (storedir, 0777);
if ((-1 == ret) && (errno != EEXIST)) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create quotad directory %s"
" ,errno = %d", storedir, errno);
exit (1);
@@ -1501,7 +1553,8 @@ init (xlator_t *this)
snprintf (storedir, PATH_MAX, "%s/groups", workdir);
ret = mkdir (storedir, 0777);
if ((-1 == ret) && (errno != EEXIST)) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_CREATE_DIR_FAILED,
"Unable to create glustershd directory %s"
" ,errno = %d", storedir, errno);
exit (1);
@@ -1512,14 +1565,16 @@ init (xlator_t *this)
goto out;
rpc = rpcsvc_init (this, this->ctx, this->options, 64);
if (rpc == NULL) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RPC_INIT_FAIL,
"failed to init rpc");
goto out;
}
ret = rpcsvc_register_notify (rpc, glusterd_rpcsvc_notify, this);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RPCSVC_REG_NOTIFY_RETURNED,
"rpcsvc_register_notify returned %d", ret);
goto out;
}
@@ -1534,7 +1589,8 @@ init (xlator_t *this)
ret = dict_set_str (this->options,
"transport.socket.own-thread", "off");
if (ret != 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
"failed to clear own-thread");
goto out;
}
@@ -1557,14 +1613,16 @@ init (xlator_t *this)
ret = dict_get_str (this->options, "transport-type", &transport_type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get transport type");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Failed to get transport type");
ret = -1;
goto out;
}
total_transport = rpc_transport_count (transport_type);
if (total_transport <= 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RPC_TRANSPORT_COUNT_GET_FAIL,
"failed to get total number of available tranpsorts");
ret = -1;
goto out;
@@ -1572,12 +1630,14 @@ init (xlator_t *this)
ret = rpcsvc_create_listeners (rpc, this->options, this->name);
if (ret < 1) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RPC_LISTENER_CREATE_FAIL,
"creation of listener failed");
ret = -1;
goto out;
} else if (ret < total_transport) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RPC_LISTENER_CREATE_FAIL,
"creation of %d listeners failed, continuing with "
"succeeded transport", (total_transport - ret));
}
@@ -1637,20 +1697,22 @@ init (xlator_t *this)
conf->base_port = GF_IANA_PRIV_PORTS_START;
if (dict_get_uint32(this->options, "base-port", &conf->base_port) == 0) {
- gf_log (this->name, GF_LOG_INFO,
- "base-port override: %d", conf->base_port);
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_DICT_SET_FAILED,
+ "base-port override: %d", conf->base_port);
}
/* Set option to run bricks on valgrind if enabled in glusterd.vol */
conf->valgrind = _gf_false;
ret = dict_get_str (this->options, "run-with-valgrind", &valgrind_str);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"cannot get run-with-valgrind value");
}
if (valgrind_str) {
if (gf_string2boolean (valgrind_str, &(conf->valgrind))) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+ GD_MSG_INVALID_ENTRY,
"run-with-valgrind value not a boolean string");
}
}
@@ -1671,7 +1733,8 @@ init (xlator_t *this)
*/
ret = glusterd_hooks_create_hooks_directory (conf->workdir);
if (-1 == ret) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_DIR_OP_FAILED,
"Unable to create hooks directory ");
exit (1);
}
@@ -1705,7 +1768,8 @@ init (xlator_t *this)
* */
ret = glusterd_restore_op_version (this);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_VERS_RESTORE_FAIL,
"Failed to restore op_version");
goto out;
}