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