summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorNandaja Varma <nandaja.varma@gmail.com>2015-03-09 16:59:54 +0530
committerAtin Mukherjee <amukherj@redhat.com>2015-06-16 03:50:10 -0700
commitb3c9fdacce4057e1ca8275dd095782ac4004dd92 (patch)
tree37c5394639848a48a096dd368136562783fa88b1 /xlators/mgmt/glusterd
parentc58a15811a82c675a4cc20d664731239daa0c48c (diff)
glusterd: Porting messages to new logging framework.
Backport of http://review.gluster.org/#/c/9836/ Change-Id: I56ced6fca0246c230cc389132c47a0f60472ed0c BUG: 1217722 Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com> Reviewed-on: http://review.gluster.org/9836 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> (cherry picked from commit 2ae034374ce449c54b1b4ae8350401371db1d8d3) Reviewed-on: http://review.gluster.org/11221
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-hooks.h2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-nfs-svc.c11
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-pmap.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quotad-svc.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-shd-svc.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapd-svc.c50
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.h8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c28
9 files changed, 77 insertions, 44 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.h b/xlators/mgmt/glusterd/src/glusterd-hooks.h
index 1e99f3472fb..85039abb12c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-hooks.h
+++ b/xlators/mgmt/glusterd/src/glusterd-hooks.h
@@ -56,7 +56,7 @@ is_key_glusterd_hooks_friendly (char *key)
/* This is very specific to hooks friendly behavior */
if (fnmatch (GD_HOOKS_SPECIFIC_KEY, key, FNM_NOESCAPE) == 0) {
- gf_log (THIS->name, GF_LOG_DEBUG, "user namespace key %s", key);
+ gf_msg_debug (THIS->name, 0, "user namespace key %s", key);
is_friendly = _gf_true;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
index cb08a208101..0c4d3c1e903 100644
--- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
@@ -14,6 +14,7 @@
#include "glusterd-utils.h"
#include "glusterd-volgen.h"
#include "glusterd-nfs-svc.h"
+#include "glusterd-messages.h"
char *nfs_svc_name = "nfs";
@@ -84,7 +85,8 @@ glusterd_nfssvc_check_volfile_identical (gf_boolean_t *identical)
tmp_fd = mkstemp (tmpnfsvol);
if (tmp_fd < 0) {
- gf_log (this->name, GF_LOG_WARNING, "Unable to create temp file"
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ GD_MSG_FILE_OP_FAILED, "Unable to create temp file"
" %s:(%s)", tmpnfsvol, strerror (errno));
goto out;
}
@@ -136,7 +138,8 @@ glusterd_nfssvc_check_topology_identical (gf_boolean_t *identical)
snprintf (tmpnfsvol, sizeof (tmpnfsvol), "/tmp/gnfs-XXXXXX");
tmpfd = mkstemp (tmpnfsvol);
if (tmpfd < 0) {
- gf_log (this->name, GF_LOG_WARNING, "Unable to create temp file"
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ GD_MSG_FILE_OP_FAILED, "Unable to create temp file"
" %s: (%s)", tmpnfsvol, strerror (errno));
goto out;
}
@@ -182,7 +185,7 @@ glusterd_nfssvc_manager (glusterd_svc_t *svc, void *data, int flags)
goto out;
}
out:
- gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (THIS->name, 0, "Returning %d", ret);
return ret;
}
@@ -211,7 +214,7 @@ glusterd_nfssvc_stop (glusterd_svc_t *svc, int sig)
glusterd_nfs_pmap_deregister ();
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-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c
index e4dacb80c4a..fbdcfc86050 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.c
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c
@@ -23,6 +23,7 @@
#include "portmap-xdr.h"
#include "xdr-generic.h"
#include "protocol-common.h"
+#include "glusterd-messages.h"
#include "rpcsvc.h"
#include <sys/socket.h>
@@ -223,7 +224,8 @@ pmap_registry_bind (xlator_t *this, int port, const char *brickname,
pmap->ports[p].type = type;
pmap->ports[p].xprt = xprt;
- gf_log ("pmap", GF_LOG_INFO, "adding brick %s on port %d",
+ gf_msg ("pmap", GF_LOG_INFO, 0,
+ GD_MSG_BRICK_ADD, "adding brick %s on port %d",
brickname, port);
if (pmap->last_alloc < p)
@@ -267,7 +269,8 @@ pmap_registry_remove (xlator_t *this, int port, const char *brickname,
goto out;
remove:
- gf_log ("pmap", GF_LOG_INFO, "removing brick %s on port %d",
+ gf_msg ("pmap", GF_LOG_INFO, 0,
+ GD_MSG_BRICK_REMOVE, "removing brick %s on port %d",
pmap->ports[p].brickname, p);
free (pmap->ports[p].brickname);
diff --git a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c
index bd77a72c5ab..37824f6904f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c
@@ -14,6 +14,7 @@
#include "glusterd-utils.h"
#include "glusterd-volgen.h"
#include "glusterd-quotad-svc.h"
+#include "glusterd-messages.h"
char *quotad_svc_name = "quotad";
@@ -94,7 +95,7 @@ glusterd_quotadsvc_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;
}
@@ -134,7 +135,7 @@ out:
if (cmdline)
dict_unref (cmdline);
- 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-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
index dd85d1e3638..49454cc5875 100644
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
@@ -61,14 +61,15 @@ glusterd_shdsvc_create_volfile ()
ret = glusterd_create_global_volfile (build_shd_graph, filepath,
mod_dict);
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:
if (mod_dict)
dict_unref (mod_dict);
- gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (THIS->name, 0, "Returning %d", ret);
return ret;
}
@@ -116,7 +117,7 @@ glusterd_shdsvc_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;
}
@@ -154,7 +155,7 @@ out:
if (cmdline)
dict_unref (cmdline);
- 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-snapd-svc.c b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
index 7e63929f28e..757c7f6d81c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
@@ -92,7 +92,8 @@ glusterd_snapdsvc_init (void *data)
sizeof (logdir));
ret = mkdir_p (logdir, 0755, _gf_true);
if ((ret == -1) && (EEXIST != errno)) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to create logdir %s",
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_CREATE_DIR_FAILED, "Unable to create logdir %s",
logdir);
goto out;
}
@@ -109,7 +110,7 @@ glusterd_snapdsvc_init (void *data)
goto out;
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -124,7 +125,8 @@ glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags)
ret = glusterd_is_snapd_enabled (volinfo);
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to read volume "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_GET_FAIL, "Failed to read volume "
"options");
goto out;
}
@@ -134,7 +136,8 @@ glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags)
if (glusterd_proc_is_running (&svc->proc)) {
ret = svc->stop (svc, SIGTERM);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAPD_STOP_FAIL,
"Couldn't stop snapd for "
"volume: %s",
volinfo->volname);
@@ -147,7 +150,8 @@ glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags)
ret = glusterd_snapdsvc_create_volfile (volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Couldn't create "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAPD_CREATE_FAIL, "Couldn't create "
"snapd volfile for volume: %s",
volinfo->volname);
goto out;
@@ -155,7 +159,8 @@ glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags)
ret = svc->start (svc, flags);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Couldn't start "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAPD_START_FAIL, "Couldn't start "
"snapd for volume: %s", volinfo->volname);
goto out;
}
@@ -170,7 +175,8 @@ glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags)
} else if (glusterd_proc_is_running (&svc->proc)) {
ret = svc->stop (svc, SIGTERM);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAPD_STOP_FAIL,
"Couldn't stop snapd for volume: %s",
volinfo->volname);
goto out;
@@ -179,7 +185,7 @@ glusterd_snapdsvc_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;
}
@@ -212,7 +218,8 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags)
/* Get volinfo->snapd from svc object */
snapd = cds_list_entry (svc, glusterd_snapdsvc_t, svc);
if (!snapd) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get snapd object "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAPD_OBJ_GET_FAIL, "Failed to get snapd object "
"from snapd service");
goto out;
}
@@ -220,14 +227,16 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags)
/* Get volinfo from snapd */
volinfo = cds_list_entry (snapd, glusterd_volinfo_t, snapd);
if (!volinfo) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get volinfo from "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_GET_FAIL, "Failed to get volinfo from "
"from snapd");
goto out;
}
ret = access (svc->proc.volfile, F_OK);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg (this->name, GF_LOG_DEBUG, 0,
+ GD_MSG_VOLINFO_GET_FAIL,
"snapd Volfile %s is not present", svc->proc.volfile);
/* If glusterd is down on one of the nodes and during
* that time "USS is enabled" for the first time. After some
@@ -239,7 +248,8 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags)
*/
ret = glusterd_snapdsvc_create_volfile (volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Couldn't create "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL, "Couldn't create "
"snapd volfile for volume: %s",
volinfo->volname);
goto out;
@@ -325,7 +335,8 @@ glusterd_snapdsvc_restart ()
svc = &(volinfo->snapd.svc);
ret = svc->start (svc, PROC_START_NO_WAIT);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAPD_START_FAIL,
"Couldn't start snapd for "
"vol: %s", volinfo->volname);
goto out;
@@ -350,13 +361,14 @@ glusterd_snapdsvc_rpc_notify (glusterd_conn_t *conn, rpc_clnt_event_t event)
svc = cds_list_entry (conn, glusterd_svc_t, conn);
if (!svc) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get the service");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SVC_GET_FAIL, "Failed to get the service");
return -1;
}
switch (event) {
case RPC_CLNT_CONNECT:
- gf_log (this->name, GF_LOG_DEBUG, "%s has connected with "
+ gf_msg_debug (this->name, 0, "%s has connected with "
"glusterd.", svc->name);
svc->online = _gf_true;
break;
@@ -373,21 +385,23 @@ glusterd_snapdsvc_rpc_notify (glusterd_conn_t *conn, rpc_clnt_event_t event)
case RPC_CLNT_DESTROY:
snapd = cds_list_entry (svc, glusterd_snapdsvc_t, svc);
if (!snapd) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get the "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAPD_OBJ_GET_FAIL, "Failed to get the "
"snapd object");
return -1;
}
volinfo = cds_list_entry (snapd, glusterd_volinfo_t, snapd);
if (!volinfo) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get the "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_GET_FAIL, "Failed to get the "
"volinfo object");
return -1;
}
glusterd_volinfo_unref (volinfo);
default:
- gf_log (this->name, GF_LOG_TRACE,
+ gf_msg_trace (this->name, 0,
"got some other RPC event %d", event);
break;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index fc8b7699833..9c09c78f79e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -32,6 +32,7 @@
#include "glusterd-volgen.h"
#include "glusterd-geo-rep.h"
#include "glusterd-utils.h"
+#include "glusterd-messages.h"
#include "run.h"
#include "options.h"
#include "glusterd-snapshot-utils.h"
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h
index 571a13c02f4..cdeaea42c99 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.h
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h
@@ -21,6 +21,7 @@
#endif
#include "glusterd.h"
+#include "glusterd-messages.h"
/* volopt map key name definitions */
@@ -64,12 +65,15 @@ typedef struct volgen_graph volgen_graph_t;
if (!strchr (key, '.')) { \
ret = option_complete (key, &completion); \
if (ret) { \
- gf_log ("", GF_LOG_ERROR, "Out of memory"); \
+ gf_msg ("", GF_LOG_ERROR, ENOMEM, \
+ GD_MSG_NO_MEMORY, "Out of memory"); \
return _gf_false; \
} \
\
if (!completion) { \
- gf_log ("", GF_LOG_ERROR, "option %s does not" \
+ gf_msg ("", GF_LOG_ERROR, 0, \
+ GD_MSG_INVALID_ENTRY, \
+ "option %s does not" \
"exist", key); \
return _gf_false; \
} \
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 8dea0695d67..aed24469608 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -61,14 +61,15 @@ validate_cache_max_min_size (glusterd_volinfo_t *volinfo, dict_t *dict,
"cache-min-file-size (%s) is greater than "
"cache-max-file-size (%s)",
current_min_value, current_max_value);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_CACHE_MINMAX_SIZE_INVALID, "%s", errstr);
*op_errstr = gf_strdup (errstr);
ret = -1;
goto out;
}
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -118,7 +119,8 @@ validate_quota (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
ret = glusterd_volinfo_get_boolean (volinfo, VKEY_FEATURES_QUOTA);
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_QUOTA_GET_STAT_FAIL,
"failed to get the quota status");
goto out;
}
@@ -126,7 +128,8 @@ validate_quota (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
if (ret == _gf_false) {
snprintf (errstr, sizeof (errstr),
"Cannot set %s. Enable quota first.", key);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_QUOTA_DISABLED, "%s", errstr);
*op_errstr = gf_strdup (errstr);
ret = -1;
goto out;
@@ -134,7 +137,7 @@ validate_quota (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
ret = 0;
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -156,12 +159,13 @@ validate_uss (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
snprintf (errstr, sizeof (errstr), "%s is not a valid boolean "
"value. %s expects a valid boolean value.", value,
key);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_INVALID_ENTRY, "%s", errstr);
*op_errstr = gf_strdup (errstr);
goto out;
}
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -183,14 +187,15 @@ validate_stripe (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
if (volinfo->stripe_count == 1) {
snprintf (errstr, sizeof (errstr),
"Cannot set %s for a non-stripe volume.", key);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_NON_STRIPE_VOL, "%s", errstr);
*op_errstr = gf_strdup (errstr);
ret = -1;
goto out;
}
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -219,7 +224,8 @@ validate_subvols_per_directory (glusterd_volinfo_t *volinfo, dict_t *dict,
"subvols-per-directory(%d) is greater "
"than the number of subvolumes(%d).",
subvols, volinfo->subvol_count);
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SUBVOLUMES_EXCEED,
"%s.", errstr);
*op_errstr = gf_strdup (errstr);
ret = -1;
@@ -227,7 +233,7 @@ validate_subvols_per_directory (glusterd_volinfo_t *volinfo, dict_t *dict,
}
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}