summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd.c
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:32:01 -0700
commit911e9228f31e89fe5df6e2282ce449b2a94c42b1 (patch)
tree517bb1fd3d56c6016b21bc394956064ee56294ab /xlators/mgmt/glusterd/src/glusterd.c
parent2b9b3ef3b646989bbc0412dca187b3f5fcad3283 (diff)
glusterd: Porting left out log messages to new framework
Change-Id: I70d40ae3b5f49a21e1b93f82885cd58fa2723647 BUG: 1235538 Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com> Reviewed-on: http://review.gluster.org/11388 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Anand Nekkunti <anekkunt@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c68
1 files changed, 39 insertions, 29 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 9b86f9bdb94..bdd141d24ae 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -148,7 +148,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;
}
@@ -179,7 +180,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);
@@ -391,7 +393,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;
@@ -474,7 +476,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));
@@ -586,7 +588,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;
}
@@ -838,7 +840,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);
@@ -847,7 +849,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);
@@ -855,7 +857,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);
@@ -870,7 +872,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));
@@ -883,7 +885,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");
@@ -891,7 +893,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");
@@ -908,7 +910,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);
@@ -1000,7 +1002,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);
@@ -1155,7 +1157,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++) {
@@ -1307,19 +1309,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;
@@ -1361,9 +1365,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");
}
@@ -1412,12 +1417,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);
}
@@ -1437,7 +1444,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);
}
@@ -1515,18 +1523,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);
}