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