cb8e9e
From dab6b91c987cd2cfcd0c26114780cee5845190d4 Mon Sep 17 00:00:00 2001
cb8e9e
From: Nandaja Varma <nandaja.varma@gmail.com>
cb8e9e
Date: Fri, 13 Mar 2015 16:55:17 +0530
cb8e9e
Subject: [PATCH 088/101] rebalance,store,glusterd/glusterd: porting to new logging framework
cb8e9e
cb8e9e
cherry-picked from commit 25f28a9c23b1adf665a982c2f5157bf13361521b
cb8e9e
>Change-Id: I231b79e3414e60fe67cde577dd585cce83c8bfad
cb8e9e
>BUG: 1194640
cb8e9e
>Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com>
cb8e9e
>Reviewed-on: http://review.gluster.org/9877
cb8e9e
>Tested-by: Gluster Build System <jenkins@build.gluster.com>
cb8e9e
>Reviewed-by: Sachin Pandit <spandit@redhat.com>
cb8e9e
>Tested-by: NetBSD Build System <jenkins@build.gluster.org>
cb8e9e
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
cb8e9e
cb8e9e
Change-Id: I231b79e3414e60fe67cde577dd585cce83c8bfad
cb8e9e
BUG: 1231771
cb8e9e
Signed-off-by: Nandaja Varma <nvarma@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/50895
cb8e9e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
cb8e9e
Tested-by: Atin Mukherjee <amukherj@redhat.com>
cb8e9e
---
cb8e9e
 xlators/mgmt/glusterd/src/glusterd-rebalance.c |  102 +++--
cb8e9e
 xlators/mgmt/glusterd/src/glusterd-store.c     |  552 +++++++++++++++---------
cb8e9e
 xlators/mgmt/glusterd/src/glusterd.c           |  208 ++++++---
cb8e9e
 3 files changed, 538 insertions(+), 324 deletions(-)
cb8e9e
cb8e9e
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
cb8e9e
index 0367df3..4fd95c2 100644
cb8e9e
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
cb8e9e
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
cb8e9e
@@ -55,7 +55,7 @@ glusterd_defrag_start_validate (glusterd_volinfo_t *volinfo, char *op_errstr,
cb8e9e
         /* Check only if operation is not remove-brick */
cb8e9e
         if ((GD_OP_REMOVE_BRICK != op) &&
cb8e9e
             !gd_is_remove_brick_committed (volinfo)) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "A remove-brick task on "
cb8e9e
+                gf_msg_debug (this->name, 0, "A remove-brick task on "
cb8e9e
                         "volume %s is not yet committed", volinfo->volname);
cb8e9e
                 snprintf (op_errstr, len, "A remove-brick task on volume %s is"
cb8e9e
                           " not yet committed. Either commit or stop the "
cb8e9e
@@ -64,7 +64,7 @@ glusterd_defrag_start_validate (glusterd_volinfo_t *volinfo, char *op_errstr,
cb8e9e
         }
cb8e9e
 
cb8e9e
         if (glusterd_is_defrag_on (volinfo)) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
                         "rebalance on volume %s already started",
cb8e9e
                         volinfo->volname);
cb8e9e
                 snprintf (op_errstr, len, "Rebalance on %s is already started",
cb8e9e
@@ -74,7 +74,7 @@ glusterd_defrag_start_validate (glusterd_volinfo_t *volinfo, char *op_errstr,
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
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -123,7 +123,7 @@ __glusterd_defrag_notify (struct rpc_clnt *rpc, void *mydata,
cb8e9e
                 }
cb8e9e
                 UNLOCK (&defrag->lock);
cb8e9e
 
cb8e9e
-               gf_log ("", GF_LOG_DEBUG, "%s got RPC_CLNT_CONNECT",
cb8e9e
+               gf_msg_debug (this->name, 0, "%s got RPC_CLNT_CONNECT",
cb8e9e
                         rpc->conn.name);
cb8e9e
                break;
cb8e9e
         }
cb8e9e
@@ -165,7 +165,7 @@ __glusterd_defrag_notify (struct rpc_clnt *rpc, void *mydata,
cb8e9e
                 glusterd_volinfo_unref (volinfo);
cb8e9e
                 break;
cb8e9e
         default:
cb8e9e
-                gf_log ("", GF_LOG_TRACE,
cb8e9e
+                gf_msg_trace (this->name, 0,
cb8e9e
                         "got some other RPC event %d", event);
cb8e9e
                 ret = 0;
cb8e9e
                 break;
cb8e9e
@@ -234,7 +234,8 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
cb8e9e
         GLUSTERD_GET_DEFRAG_DIR (defrag_path, volinfo, priv);
cb8e9e
         ret = mkdir_p (defrag_path, 0777, _gf_true);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR, "Failed to create "
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED, "Failed to create "
cb8e9e
                         "directory %s", defrag_path);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -296,7 +297,7 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
cb8e9e
 
cb8e9e
         ret = runner_run_nowait (&runner);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log ("glusterd", GF_LOG_DEBUG, "rebalance command failed");
cb8e9e
+                gf_msg_debug ("glusterd", 0, "rebalance command failed");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -310,7 +311,7 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
cb8e9e
                 defrag->cbk_fn = cbk;
cb8e9e
 
cb8e9e
 out:
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
cb8e9e
+        gf_msg_debug ("glusterd", 0, "Returning %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -352,7 +353,8 @@ glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo,
cb8e9e
                  * with the older path
cb8e9e
                  */
cb8e9e
                 if (ret && (errno == ENOENT)) {
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING, "Rebalance sockfile "
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, errno,
cb8e9e
+                                GD_MSG_FILE_OP_FAILED, "Rebalance sockfile "
cb8e9e
                                 "%s does not exist. Trying old path.",
cb8e9e
                                 sockfile);
cb8e9e
                         GLUSTERD_GET_DEFRAG_SOCK_FILE_OLD (sockfile, volinfo,
cb8e9e
@@ -400,14 +402,16 @@ glusterd_rebalance_cmd_validate (int cmd, char *volname,
cb8e9e
         int ret = -1;
cb8e9e
 
cb8e9e
         if (glusterd_volinfo_find(volname, volinfo)) {
cb8e9e
-                gf_log ("glusterd", GF_LOG_ERROR, "Received rebalance on invalid"
cb8e9e
+                gf_msg ("glusterd", GF_LOG_ERROR, EINVAL,
cb8e9e
+                        GD_MSG_VOL_NOT_FOUND, "Received rebalance on invalid"
cb8e9e
                         " volname %s", volname);
cb8e9e
                 snprintf (op_errstr, len, "Volume %s does not exist",
cb8e9e
                           volname);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
         if ((*volinfo)->brick_count <= (*volinfo)->dist_leaf_count) {
cb8e9e
-                gf_log ("glusterd", GF_LOG_ERROR, "Volume %s is not a "
cb8e9e
+                gf_msg ("glusterd", GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_VOL_NOT_DISTRIBUTE, "Volume %s is not a "
cb8e9e
                 "distribute type or contains only 1 brick", volname);
cb8e9e
                 snprintf (op_errstr, len, "Volume %s is not a distribute "
cb8e9e
                           "volume or contains only 1 brick.\n"
cb8e9e
@@ -416,7 +420,8 @@ glusterd_rebalance_cmd_validate (int cmd, char *volname,
cb8e9e
         }
cb8e9e
 
cb8e9e
         if ((*volinfo)->status != GLUSTERD_STATUS_STARTED) {
cb8e9e
-                gf_log ("glusterd", GF_LOG_ERROR, "Received rebalance on stopped"
cb8e9e
+                gf_msg ("glusterd", GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_VOL_STOPPED, "Received rebalance on stopped"
cb8e9e
                         " volname %s", volname);
cb8e9e
                 snprintf (op_errstr, len, "Volume %s needs to "
cb8e9e
                           "be started to perform rebalance", volname);
cb8e9e
@@ -435,7 +440,7 @@ glusterd_rebalance_cmd_validate (int cmd, char *volname,
cb8e9e
         ret = 0;
cb8e9e
 
cb8e9e
 out:
cb8e9e
-        gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
cb8e9e
+        gf_msg_debug ("glusterd", 0, "Returning %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -473,7 +478,8 @@ __glusterd_handle_defrag_volume (rpcsvc_request_t *req)
cb8e9e
                                         cli_req.dict.dict_len,
cb8e9e
                                         &dict);
cb8e9e
                 if (ret < 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "failed to "
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to "
cb8e9e
                                 "unserialize req-buffer to dictionary");
cb8e9e
                         snprintf (msg, sizeof (msg), "Unable to decode the "
cb8e9e
                                   "command");
cb8e9e
@@ -484,14 +490,16 @@ __glusterd_handle_defrag_volume (rpcsvc_request_t *req)
cb8e9e
         ret = dict_get_str (dict, "volname", &volname);
cb8e9e
         if (ret) {
cb8e9e
                 snprintf (msg, sizeof (msg), "Failed to get volume name");
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "%s", msg);
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_DICT_GET_FAILED, "%s", msg);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = dict_get_int32 (dict, "rebalance-command", (int32_t*)&cmd);
cb8e9e
         if (ret) {
cb8e9e
                 snprintf (msg, sizeof (msg), "Failed to get command");
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "%s", msg);
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_DICT_GET_FAILED, "%s", msg);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -581,20 +589,20 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
cb8e9e
 
cb8e9e
         ret = dict_get_str (dict, "volname", &volname);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "volname not found");
cb8e9e
+                gf_msg_debug (this->name, 0, "volname not found");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = dict_get_int32 (dict, "rebalance-command", &cmd);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "cmd not found");
cb8e9e
+                gf_msg_debug (this->name, 0, "cmd not found");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = glusterd_rebalance_cmd_validate (cmd, volname, &volinfo,
cb8e9e
                                                msg, sizeof (msg));
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "failed to validate");
cb8e9e
+                gf_msg_debug (this->name, 0, "failed to validate");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
         switch (cmd) {
cb8e9e
@@ -626,7 +634,8 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
cb8e9e
                         op_ctx = glusterd_op_get_ctx ();
cb8e9e
                         if (!op_ctx) {
cb8e9e
                                 ret = -1;
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_OPCTX_GET_FAIL,
cb8e9e
                                         "Failed to get op_ctx");
cb8e9e
                                 goto out;
cb8e9e
                         }
cb8e9e
@@ -634,7 +643,8 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
cb8e9e
                         ret = glusterd_generate_and_set_task_id
cb8e9e
                                 (op_ctx, GF_REBALANCE_TID_KEY);
cb8e9e
                         if (ret) {
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_TASKID_GEN_FAIL,
cb8e9e
                                         "Failed to generate task-id");
cb8e9e
                                 goto out;
cb8e9e
                         }
cb8e9e
@@ -644,7 +654,8 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
cb8e9e
                         if (ret) {
cb8e9e
                                 snprintf (msg, sizeof (msg),
cb8e9e
                                           "Missing rebalance-id");
cb8e9e
-                                gf_log (this->name, GF_LOG_WARNING, "%s", msg);
cb8e9e
+                                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                        GD_MSG_REBALANCE_ID_MISSING, "%s", msg);
cb8e9e
                                 ret = 0;
cb8e9e
                         }
cb8e9e
                 }
cb8e9e
@@ -652,7 +663,7 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
cb8e9e
                                                       sizeof (msg),
cb8e9e
                                                       GD_OP_REBALANCE);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
+                        gf_msg_debug (this->name, 0,
cb8e9e
                                         "start validate failed");
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -662,10 +673,11 @@ glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr)
cb8e9e
         case GF_DEFRAG_CMD_STOP_DETACH_TIER:
cb8e9e
                 ret = dict_get_str (dict, "cmd-str", &cmd_str);
cb8e9e
                 if (ret) {
cb8e9e
-                     gf_log (this->name, GF_LOG_ERROR, "Failed to get "
cb8e9e
-                             "command string");
cb8e9e
-                     ret = -1;
cb8e9e
-                     goto out;
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_DICT_GET_FAILED, "Failed to get "
cb8e9e
+                                "command string");
cb8e9e
+                        ret = -1;
cb8e9e
+                        goto out;
cb8e9e
                 }
cb8e9e
                 if ((strstr(cmd_str, "rebalance") != NULL) &&
cb8e9e
                     (volinfo->rebal.op != GD_OP_REBALANCE)) {
cb8e9e
@@ -736,13 +748,13 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
cb8e9e
 
cb8e9e
         ret = dict_get_str (dict, "volname", &volname);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "volname not given");
cb8e9e
+                gf_msg_debug (this->name, 0, "volname not given");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = dict_get_int32 (dict, "rebalance-command", &cmd);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "command not given");
cb8e9e
+                gf_msg_debug (this->name, 0, "command not given");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -750,7 +762,7 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
cb8e9e
         ret = glusterd_rebalance_cmd_validate (cmd, volname, &volinfo,
cb8e9e
                                                msg, sizeof (msg));
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "cmd validate failed");
cb8e9e
+                gf_msg_debug (this->name, 0, "cmd validate failed");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -763,7 +775,8 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
cb8e9e
                 if (!gf_uuid_is_null (volinfo->rebal.rebalance_id)) {
cb8e9e
                         ctx = glusterd_op_get_ctx ();
cb8e9e
                         if (!ctx) {
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_OPCTX_GET_FAIL,
cb8e9e
                                         "Failed to get op_ctx");
cb8e9e
                                 ret = -1;
cb8e9e
                                 goto out;
cb8e9e
@@ -778,7 +791,8 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
cb8e9e
                                         (volinfo->rebal.rebalance_id, ctx,
cb8e9e
                                          GF_REBALANCE_TID_KEY);
cb8e9e
                         if (ret) {
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_TASKID_GEN_FAIL,
cb8e9e
                                         "Failed to set task-id");
cb8e9e
                                 goto out;
cb8e9e
                         }
cb8e9e
@@ -798,7 +812,7 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
cb8e9e
 
cb8e9e
                 ret = dict_get_str (dict, GF_REBALANCE_TID_KEY, &task_id_str);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "Missing rebalance "
cb8e9e
+                        gf_msg_debug (this->name, 0, "Missing rebalance "
cb8e9e
                                 "id");
cb8e9e
                         ret = 0;
cb8e9e
                 } else {
cb8e9e
@@ -848,7 +862,8 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
cb8e9e
 
cb8e9e
                 ret = glusterd_create_volfiles_and_notify_services (volinfo);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                GD_MSG_VOLFILE_CREATE_FAIL,
cb8e9e
                                 "failed to create volfiles");
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -856,7 +871,8 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
cb8e9e
                 ret = glusterd_store_volinfo (volinfo,
cb8e9e
                                              GLUSTERD_VOLINFO_VER_AC_INCREMENT);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                GD_MSG_VOLINFO_SET_FAIL,
cb8e9e
                                 "failed to store volinfo");
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -894,7 +910,8 @@ glusterd_defrag_event_notify_handle (dict_t *dict)
cb8e9e
 
cb8e9e
         ret = dict_get_str (dict, "volname", &volname);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to get volname");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_DICT_GET_FAILED, "Failed to get volname");
cb8e9e
                 return ret;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -907,8 +924,9 @@ glusterd_defrag_event_notify_handle (dict_t *dict)
cb8e9e
                 }
cb8e9e
                 volname = volname_ptr + 1;
cb8e9e
         } else {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "volname received (%s) is not prefixed with rebalance.",
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_NO_REBALANCE_PFX_IN_VOLNAME,
cb8e9e
+                        "volname recieved (%s) is not prefixed with rebalance.",
cb8e9e
                         volname);
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -916,7 +934,9 @@ glusterd_defrag_event_notify_handle (dict_t *dict)
cb8e9e
 
cb8e9e
         ret = glusterd_volinfo_find (volname, &volinfo);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to get volinfo for %s"
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_VOLINFO_GET_FAIL,
cb8e9e
+                        "Failed to get volinfo for %s"
cb8e9e
                         , volname);
cb8e9e
                 return ret;
cb8e9e
         }
cb8e9e
@@ -924,7 +944,9 @@ glusterd_defrag_event_notify_handle (dict_t *dict)
cb8e9e
         ret = glusterd_defrag_volume_status_update (volinfo, dict);
cb8e9e
 
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to update status");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_DEFRAG_STATUS_UPDATE_FAIL,
cb8e9e
+                        "Failed to update status");
cb8e9e
 
cb8e9e
 out:
cb8e9e
         return ret;
cb8e9e
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
cb8e9e
index ae87e9a..d790c6f 100644
cb8e9e
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
cb8e9e
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
cb8e9e
@@ -38,6 +38,7 @@
cb8e9e
 #include "store.h"
cb8e9e
 #include "glusterd-store.h"
cb8e9e
 #include "glusterd-snapshot-utils.h"
cb8e9e
+#include "glusterd-messages.h"
cb8e9e
 
cb8e9e
 #include "rpc-clnt.h"
cb8e9e
 #include "common-utils.h"
cb8e9e
@@ -170,19 +171,22 @@ glusterd_store_is_valid_brickpath (char *volname, char *brick)
cb8e9e
 
cb8e9e
         ret = glusterd_brickinfo_new_from_brick (brick, &brickinfo);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING, "Failed to create brick "
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                        GD_MSG_BRICK_CREATION_FAIL, "Failed to create brick "
cb8e9e
                         "info for brick %s", brick);
cb8e9e
                 ret = 0;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
         ret = glusterd_volinfo_new (&volinfo);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING, "Failed to create volinfo");
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                        GD_MSG_VOLFILE_CREATE_FAIL, "Failed to create volinfo");
cb8e9e
                 ret = 0;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
         if (volname_len >= sizeof (volinfo->volname)) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING, "volume name too long");
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                        GD_MSG_NAME_TOO_LONG, "volume name too long");
cb8e9e
                 ret = 0;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -332,7 +336,8 @@ gd_store_brick_snap_details_write (int fd, glusterd_brickinfo_t *brickinfo)
cb8e9e
                 ret = gf_store_save_value (fd,
cb8e9e
                                 GLUSTERD_STORE_KEY_BRICK_FSTYPE, value);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "Failed to save "
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_FS_LABEL_UPDATE_FAIL, "Failed to save "
cb8e9e
                                 "brick fs type of brick %s", brickinfo->path);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -343,7 +348,8 @@ gd_store_brick_snap_details_write (int fd, glusterd_brickinfo_t *brickinfo)
cb8e9e
                 ret = gf_store_save_value (fd,
cb8e9e
                                 GLUSTERD_STORE_KEY_BRICK_MNTOPTS, value);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "Failed to save "
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_BRK_MOUNTOPTS_FAIL, "Failed to save "
cb8e9e
                                 "brick mnt opts of brick %s", brickinfo->path);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -405,7 +411,7 @@ glusterd_store_brickinfo_write (int fd, glusterd_brickinfo_t *brickinfo)
cb8e9e
         ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_BRICK_VGNAME,
cb8e9e
                                          brickinfo->vg);
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
@@ -425,11 +431,13 @@ glusterd_store_snapd_write (int fd, glusterd_volinfo_t *volinfo)
cb8e9e
         snprintf (value, sizeof(value), "%d", volinfo->snapd.port);
cb8e9e
         ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_SNAPD_PORT, value);
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "failed to store the snapd "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAPD_PORT_STORE_FAIL,
cb8e9e
+                        "failed to store the snapd "
cb8e9e
                         "port of volume %s", volinfo->volname);
cb8e9e
 
cb8e9e
 
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
@@ -453,7 +461,7 @@ glusterd_store_perform_brick_store (glusterd_brickinfo_t *brickinfo)
cb8e9e
 out:
cb8e9e
         if (ret && (fd > 0))
cb8e9e
                 gf_store_unlink_tmppath (brickinfo->shandle);
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
@@ -471,7 +479,8 @@ glusterd_store_perform_snapd_store (glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
         fd = gf_store_mkstemp (volinfo->snapd.handle);
cb8e9e
         if (fd <= 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "failed to create the "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_FILE_OP_FAILED, "failed to create the "
cb8e9e
                         "temporary file for the snapd store handle of volume "
cb8e9e
                         "%s", volinfo->volname);
cb8e9e
                 goto out;
cb8e9e
@@ -479,7 +488,9 @@ glusterd_store_perform_snapd_store (glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
         ret = glusterd_store_snapd_write (fd, volinfo);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "failed to write snapd port "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAPD_PORT_STORE_FAIL,
cb8e9e
+                        "failed to write snapd port "
cb8e9e
                         "info to store handle (volume: %s", volinfo->volname);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -489,7 +500,7 @@ glusterd_store_perform_snapd_store (glusterd_volinfo_t *volinfo)
cb8e9e
 out:
cb8e9e
         if (ret && (fd > 0))
cb8e9e
                 gf_store_unlink_tmppath (volinfo->snapd.handle);
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
@@ -519,7 +530,7 @@ glusterd_store_brickinfo (glusterd_volinfo_t *volinfo,
cb8e9e
 
cb8e9e
         ret = glusterd_store_perform_brick_store (brickinfo);
cb8e9e
 out:
cb8e9e
-        gf_log (THIS->name, GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug (THIS->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -536,21 +547,25 @@ glusterd_store_snapd_info (glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
         ret = glusterd_store_create_snapd_shandle_on_absence (volinfo);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "failed to create store "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_HANDLE_CREATE_FAIL,
cb8e9e
+                        "failed to create store "
cb8e9e
                         "handle for snapd (volume: %s)", volinfo->volname);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = glusterd_store_perform_snapd_store (volinfo);
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "failed to store snapd info "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAPD_INFO_STORE_FAIL,
cb8e9e
+                        "failed to store snapd info "
cb8e9e
                         "of the volume %s", volinfo->volname);
cb8e9e
 
cb8e9e
 out:
cb8e9e
         if (ret)
cb8e9e
                 gf_store_unlink_tmppath (volinfo->snapd.handle);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug (this->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -589,8 +604,8 @@ glusterd_store_delete_brick (glusterd_brickinfo_t *brickinfo, char *delete_path)
cb8e9e
         ret = unlink (brickpath);
cb8e9e
 
cb8e9e
         if ((ret < 0) && (errno != ENOENT)) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "Unlink failed on %s, "
cb8e9e
-                        "reason: %s", brickpath, strerror(errno));
cb8e9e
+                gf_msg_debug (this->name, 0, "Unlink failed on %s",
cb8e9e
+                              brickpath);
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         } else {
cb8e9e
@@ -602,7 +617,7 @@ out:
cb8e9e
                 gf_store_handle_destroy (brickinfo->shandle);
cb8e9e
                 brickinfo->shandle = NULL;
cb8e9e
         }
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug (this->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -644,8 +659,8 @@ glusterd_store_remove_bricks (glusterd_volinfo_t *volinfo, char *delete_path)
cb8e9e
                           brickdir, entry->d_name);
cb8e9e
                 ret = unlink (path);
cb8e9e
                 if (ret && errno != ENOENT) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "Unable to unlink %s, "
cb8e9e
-                                "reason: %s", path, strerror(errno));
cb8e9e
+                        gf_msg_debug (this->name, 0, "Unable to unlink %s",
cb8e9e
+                                      path);
cb8e9e
                 }
cb8e9e
                 GF_FOR_EACH_ENTRY_IN_DIR (entry, dir);
cb8e9e
         }
cb8e9e
@@ -655,7 +670,7 @@ glusterd_store_remove_bricks (glusterd_volinfo_t *volinfo, char *delete_path)
cb8e9e
         ret = rmdir (brickdir);
cb8e9e
 
cb8e9e
 out:
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug (this->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -685,13 +700,15 @@ _storeslaves (dict_t *this, char *key, data_t *value, void *data)
cb8e9e
         if (!value || !value->data)
cb8e9e
                 return -1;
cb8e9e
 
cb8e9e
-        gf_log (xl->name, GF_LOG_DEBUG, "Storing in volinfo:key= %s, val=%s",
cb8e9e
+        gf_msg_debug (xl->name, 0, "Storing in volinfo:key= %s, val=%s",
cb8e9e
                 key, value->data);
cb8e9e
 
cb8e9e
         ret = gf_store_save_value (shandle->fd, key, (char*)value->data);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (xl->name, GF_LOG_ERROR, "Unable to write into store"
cb8e9e
-                                " handle for path: %s", shandle->path);
cb8e9e
+                gf_msg (xl->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_HANDLE_WRITE_FAIL,
cb8e9e
+                        "Unable to write into store"
cb8e9e
+                        " handle for path: %s", shandle->path);
cb8e9e
                 return -1;
cb8e9e
         }
cb8e9e
         return 0;
cb8e9e
@@ -732,18 +749,20 @@ int _storeopts (dict_t *this, char *key, data_t *value, void *data)
cb8e9e
         }
cb8e9e
 
cb8e9e
         if (1 == exists) {
cb8e9e
-                gf_log (xl->name, GF_LOG_DEBUG, "Storing in volinfo:key= %s, "
cb8e9e
+                gf_msg_debug (xl->name, 0, "Storing in volinfo:key= %s, "
cb8e9e
                         "val=%s", key, value->data);
cb8e9e
 
cb8e9e
         } else {
cb8e9e
-                gf_log (xl->name, GF_LOG_DEBUG, "Discarding:key= %s, val=%s",
cb8e9e
+                gf_msg_debug (xl->name, 0, "Discarding:key= %s, val=%s",
cb8e9e
                         key, value->data);
cb8e9e
                 return 0;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = gf_store_save_value (shandle->fd, key, (char*)value->data);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (xl->name, GF_LOG_ERROR, "Unable to write into store"
cb8e9e
+                gf_msg (xl->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_HANDLE_WRITE_FAIL,
cb8e9e
+                        "Unable to write into store"
cb8e9e
                         " handle for path: %s", shandle->path);
cb8e9e
                 return -1;
cb8e9e
         }
cb8e9e
@@ -779,7 +798,8 @@ glusterd_volume_write_snap_details (int fd, glusterd_volinfo_t *volinfo)
cb8e9e
         snprintf (buf, sizeof (buf), "%s", volinfo->parent_volname);
cb8e9e
         ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_PARENT_VOLNAME, buf);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to store "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_FAIL, "Failed to store "
cb8e9e
                         GLUSTERD_STORE_KEY_PARENT_VOLNAME);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -787,7 +807,8 @@ glusterd_volume_write_snap_details (int fd, glusterd_volinfo_t *volinfo)
cb8e9e
         ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_RESTORED_SNAP,
cb8e9e
                                    uuid_utoa (volinfo->restored_from_snap));
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_HANDLE_WRITE_FAIL,
cb8e9e
                         "Unable to write restored_from_snap");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -797,19 +818,23 @@ glusterd_volume_write_snap_details (int fd, glusterd_volinfo_t *volinfo)
cb8e9e
         ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_SNAP_MAX_HARD_LIMIT,
cb8e9e
                                    buf);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_HARD_LIMIT_SET_FAIL,
cb8e9e
                         "Unable to write snap-max-hard-limit");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = glusterd_store_snapd_info (volinfo);
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "snapd info store failed "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAPD_INFO_STORE_FAIL, "snapd info store failed "
cb8e9e
                         "volume: %s", volinfo->volname);
cb8e9e
 
cb8e9e
 out:
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to write snap details"
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAPINFO_WRITE_FAIL,
cb8e9e
+                        "Failed to write snap details"
cb8e9e
                         " for volume %s", volinfo->volname);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
@@ -988,7 +1013,8 @@ glusterd_volume_exclude_options_write (int fd, glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
 out:
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Unable to write volume "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_VOL_VALS_WRITE_FAIL, "Unable to write volume "
cb8e9e
                         "values for %s", volinfo->volname);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
@@ -1018,7 +1044,7 @@ glusterd_store_create_volume_dir (glusterd_volinfo_t *volinfo)
cb8e9e
                                        sizeof (voldirpath));
cb8e9e
         ret = gf_store_mkdir (voldirpath);
cb8e9e
 
cb8e9e
-        gf_log (THIS->name, GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug (THIS->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -1037,7 +1063,8 @@ glusterd_store_create_snap_dir (glusterd_snap_t *snap)
cb8e9e
 
cb8e9e
         ret = mkdir_p (snapdirpath, 0755, _gf_true);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR, "Failed to create snaps dir "
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED, "Failed to create snaps dir "
cb8e9e
                         "%s", snapdirpath);
cb8e9e
         }
cb8e9e
         return ret;
cb8e9e
@@ -1063,7 +1090,7 @@ glusterd_store_volinfo_write (int fd, glusterd_volinfo_t *volinfo)
cb8e9e
         dict_foreach (volinfo->gsync_slaves, _storeslaves, shandle);
cb8e9e
         shandle->fd = 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
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -1106,7 +1133,7 @@ glusterd_store_snapinfo_write (glusterd_snap_t *snap)
cb8e9e
         ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_SNAP_TIMESTAMP, buf);
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
@@ -1284,7 +1311,7 @@ glusterd_store_brickinfos (glusterd_volinfo_t *volinfo, int vol_fd)
cb8e9e
                 brick_count++;
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
@@ -1342,7 +1369,7 @@ glusterd_store_node_state_write (int fd, glusterd_volinfo_t *volinfo)
cb8e9e
                               &fd;;
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
@@ -1370,7 +1397,7 @@ glusterd_store_perform_node_state_store (glusterd_volinfo_t *volinfo)
cb8e9e
 out:
cb8e9e
         if (ret && (fd > 0))
cb8e9e
                 gf_store_unlink_tmppath (volinfo->node_state_shandle);
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
@@ -1398,7 +1425,7 @@ glusterd_store_perform_volume_store (glusterd_volinfo_t *volinfo)
cb8e9e
 out:
cb8e9e
         if (ret && (fd > 0))
cb8e9e
                 gf_store_unlink_tmppath (volinfo->shandle);
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
@@ -1475,8 +1502,9 @@ glusterd_store_volinfo_atomic_update (glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
 out:
cb8e9e
         if (ret)
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR, "Couldn't rename "
cb8e9e
-                        "temporary file(s): Reason %s", strerror (errno));
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_FILE_OP_FAILED, "Couldn't rename "
cb8e9e
+                        "temporary file(s)");
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -1504,8 +1532,9 @@ glusterd_store_snap_atomic_update (glusterd_snap_t *snap)
cb8e9e
 
cb8e9e
         ret = gf_store_rename_tmppath (snap->shandle);
cb8e9e
         if (ret)
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR, "Couldn't rename "
cb8e9e
-                        "temporary file(s): Reason %s", strerror (errno));
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_FILE_OP_FAILED, "Couldn't rename "
cb8e9e
+                        "temporary file(s)");
cb8e9e
 
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
@@ -1519,26 +1548,34 @@ glusterd_store_snap (glusterd_snap_t *snap)
cb8e9e
 
cb8e9e
         ret = glusterd_store_create_snap_dir (snap);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR, "Failed to create snap dir");
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAPDIR_CREATE_FAIL,
cb8e9e
+                        "Failed to create snap dir");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = glusterd_store_create_snap_shandle_on_absence (snap);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR, "Failed to create snap info "
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, 0,
cb8e9e
+                       GD_MSG_SNAPINFO_CREATE_FAIL,
cb8e9e
+                       "Failed to create snap info "
cb8e9e
                         "file");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = glusterd_store_snapinfo_write (snap);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR, "Failed to write snap info");
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAPINFO_WRITE_FAIL,
cb8e9e
+                        "Failed to write snap info");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = glusterd_store_snap_atomic_update (snap);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR,"Failed to do automic update");
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAP_AUTOMIC_UPDATE_FAIL,
cb8e9e
+                        "Failed to do automic update");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1546,7 +1583,7 @@ out:
cb8e9e
         if (ret && snap->shandle)
cb8e9e
                 gf_store_unlink_tmppath (snap->shandle);
cb8e9e
 
cb8e9e
-        gf_log (THIS->name, GF_LOG_TRACE, "Returning %d", ret);
cb8e9e
+        gf_msg_trace (THIS->name, 0, "Returning %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -1594,7 +1631,7 @@ out:
cb8e9e
         if (ret)
cb8e9e
                 glusterd_store_volume_cleanup_tmp (volinfo);
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
@@ -1629,15 +1666,17 @@ glusterd_store_delete_volume (glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
         ret = mkdir (trashdir, 0777);
cb8e9e
         if (ret && errno != EEXIST) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to create trash "
cb8e9e
-                        "directory, reason : %s", strerror (errno));
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED, "Failed to create trash "
cb8e9e
+                        "directory");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = rename (pathname, delete_path);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to rename volume "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_DIR_OP_FAILED, "Failed to rename volume "
cb8e9e
                         "directory for volume %s", volinfo->volname);
cb8e9e
                 rename_fail = _gf_true;
cb8e9e
                 goto out;
cb8e9e
@@ -1645,8 +1684,8 @@ glusterd_store_delete_volume (glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
         ret = recursive_rmdir (trashdir);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "Failed to rmdir: %s, Reason:"
cb8e9e
-                        " %s", trashdir, strerror (errno));
cb8e9e
+                gf_msg_debug (this->name, 0, "Failed to rmdir: %s",
cb8e9e
+                                 trashdir);
cb8e9e
         }
cb8e9e
 
cb8e9e
 out:
cb8e9e
@@ -1656,7 +1695,7 @@ out:
cb8e9e
         }
cb8e9e
         ret = (rename_fail == _gf_true) ? -1: 0;
cb8e9e
 
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
@@ -1693,15 +1732,17 @@ glusterd_store_delete_snap (glusterd_snap_t *snap)
cb8e9e
 
cb8e9e
         ret = mkdir (trashdir, 0777);
cb8e9e
         if (ret && errno != EEXIST) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to create trash "
cb8e9e
-                        "directory, reason : %s", strerror (errno));
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED, "Failed to create trash "
cb8e9e
+                        "directory");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = rename (pathname, delete_path);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to rename snap "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_DIR_OP_FAILED, "Failed to rename snap "
cb8e9e
                         "directory %s to %s", pathname, delete_path);
cb8e9e
                 rename_fail = _gf_true;
cb8e9e
                 goto out;
cb8e9e
@@ -1709,8 +1750,8 @@ glusterd_store_delete_snap (glusterd_snap_t *snap)
cb8e9e
 
cb8e9e
         dir = opendir (delete_path);
cb8e9e
         if (!dir) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "Failed to open directory %s."
cb8e9e
-                        " Reason : %s", delete_path, strerror (errno));
cb8e9e
+                gf_msg_debug (this->name, 0, "Failed to open directory %s.",
cb8e9e
+                                 delete_path);
cb8e9e
                 ret = 0;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -1720,8 +1761,8 @@ glusterd_store_delete_snap (glusterd_snap_t *snap)
cb8e9e
                 snprintf (path, PATH_MAX, "%s/%s", delete_path, entry->d_name);
cb8e9e
                 ret = stat (path, &st);
cb8e9e
                 if (ret == -1) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, "Failed to stat "
cb8e9e
-                                "entry %s : %s", path, strerror (errno));
cb8e9e
+                        gf_msg_debug (this->name, 0, "Failed to stat "
cb8e9e
+                                "entry %s", path);
cb8e9e
                         goto stat_failed;
cb8e9e
                 }
cb8e9e
 
cb8e9e
@@ -1731,11 +1772,11 @@ glusterd_store_delete_snap (glusterd_snap_t *snap)
cb8e9e
                         ret = unlink (path);
cb8e9e
 
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG, " Failed to remove "
cb8e9e
-                                "%s. Reason : %s", path, strerror (errno));
cb8e9e
+                        gf_msg_debug (this->name, 0, " Failed to remove "
cb8e9e
+                                "%s", path);
cb8e9e
                 }
cb8e9e
 
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "%s %s",
cb8e9e
+                gf_msg_debug (this->name, 0, "%s %s",
cb8e9e
                                 ret ? "Failed to remove":"Removed",
cb8e9e
                                 entry->d_name);
cb8e9e
 stat_failed:
cb8e9e
@@ -1745,19 +1786,19 @@ stat_failed:
cb8e9e
 
cb8e9e
         ret = closedir (dir);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "Failed to close dir %s. "
cb8e9e
-                        "Reason : %s",delete_path, strerror (errno));
cb8e9e
+                gf_msg_debug (this->name, 0, "Failed to close dir %s.",
cb8e9e
+                                delete_path);
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = rmdir (delete_path);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "Failed to rmdir: %s,err: %s",
cb8e9e
-                        delete_path, strerror (errno));
cb8e9e
+                gf_msg_debug (this->name, 0, "Failed to rmdir: %s",
cb8e9e
+                        delete_path);
cb8e9e
         }
cb8e9e
         ret = rmdir (trashdir);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "Failed to rmdir: %s, Reason:"
cb8e9e
-                        " %s", trashdir, strerror (errno));
cb8e9e
+                gf_msg_debug (this->name, 0, "Failed to rmdir: %s",
cb8e9e
+                                 trashdir);
cb8e9e
         }
cb8e9e
 
cb8e9e
 out:
cb8e9e
@@ -1767,7 +1808,7 @@ out:
cb8e9e
         }
cb8e9e
         ret = (rename_fail == _gf_true) ? -1: 0;
cb8e9e
 
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
@@ -1793,7 +1834,8 @@ glusterd_store_global_info (xlator_t *this)
cb8e9e
                           GLUSTERD_INFO_FILE);
cb8e9e
                 ret = gf_store_handle_new (path, &handle);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_STORE_HANDLE_GET_FAIL,
cb8e9e
                                 "Unable to get store handle");
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -1805,8 +1847,9 @@ glusterd_store_global_info (xlator_t *this)
cb8e9e
         /* These options need to be available for all users */
cb8e9e
         ret = chmod (handle->path, 0644);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "chmod error for %s: %s",
cb8e9e
-                        GLUSTERD_INFO_FILE, strerror (errno));
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_FILE_OP_FAILED, "chmod error for %s",
cb8e9e
+                        GLUSTERD_INFO_FILE);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1819,7 +1862,8 @@ glusterd_store_global_info (xlator_t *this)
cb8e9e
         ret = gf_store_save_value (handle->fd, GLUSTERD_STORE_UUID_KEY,
cb8e9e
                                    uuid_str);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, 0,
cb8e9e
+                        GD_MSG_UUID_SET_FAIL,
cb8e9e
                         "Storing uuid failed ret = %d", ret);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -1828,7 +1872,8 @@ glusterd_store_global_info (xlator_t *this)
cb8e9e
         ret = gf_store_save_value (handle->fd, GD_OP_VERSION_KEY,
cb8e9e
                                    op_version_str);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_OP_VERS_STORE_FAIL,
cb8e9e
                         "Storing op-version failed ret = %d", ret);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -1848,7 +1893,8 @@ out:
cb8e9e
                 GF_FREE (uuid_str);
cb8e9e
 
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_GLUSTERD_GLOBAL_INFO_STORE_FAIL,
cb8e9e
                         "Failed to store glusterd global-info");
cb8e9e
 
cb8e9e
         return ret;
cb8e9e
@@ -1873,7 +1919,7 @@ glusterd_retrieve_op_version (xlator_t *this, int *op_version)
cb8e9e
                 ret = gf_store_handle_retrieve (path, &handle);
cb8e9e
 
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log ("", GF_LOG_DEBUG, "Unable to get store "
cb8e9e
+                        gf_msg_debug (this->name, 0, "Unable to get store "
cb8e9e
                                 "handle!");
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -1884,14 +1930,15 @@ glusterd_retrieve_op_version (xlator_t *this, int *op_version)
cb8e9e
         ret = gf_store_retrieve_value (priv->handle, GD_OP_VERSION_KEY,
cb8e9e
                                        &op_version_str);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
                         "No previous op_version present");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         tmp_version = strtol (op_version_str, &tmp, 10);
cb8e9e
         if ((tmp_version <= 0) || (tmp && strlen (tmp) > 1)) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING, "invalid version number");
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, EINVAL,
cb8e9e
+                        GD_MSG_UNSUPPORTED_VERSION, "invalid version number");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1930,7 +1977,7 @@ glusterd_retrieve_sys_snap_max_limit (xlator_t *this, uint64_t *limit,
cb8e9e
                 ret = gf_store_handle_retrieve (path, &handle);
cb8e9e
 
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log ("", GF_LOG_DEBUG, "Unable to get store "
cb8e9e
+                        gf_msg_debug (this->name, 0, "Unable to get store "
cb8e9e
                                 "handle!");
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -1942,14 +1989,15 @@ glusterd_retrieve_sys_snap_max_limit (xlator_t *this, uint64_t *limit,
cb8e9e
                                        key,
cb8e9e
                                        &limit_str);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
                         "No previous %s present", key);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         tmp_limit = strtoul (limit_str, &tmp, 10);
cb8e9e
         if ((tmp_limit <= 0) || (tmp && strlen (tmp) > 1)) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING, "invalid version number");
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, EINVAL,
cb8e9e
+                        GD_MSG_UNSUPPORTED_VERSION, "invalid version number");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1976,7 +2024,8 @@ glusterd_restore_op_version (xlator_t *this)
cb8e9e
         if (!ret) {
cb8e9e
                 if ((op_version < GD_OP_VERSION_MIN) ||
cb8e9e
                     (op_version > GD_OP_VERSION_MAX)) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, EINVAL,
cb8e9e
+                                GD_MSG_UNSUPPORTED_VERSION,
cb8e9e
                                 "wrong op-version (%d) retrieved", op_version);
cb8e9e
                         ret = -1;
cb8e9e
                         goto out;
cb8e9e
@@ -2022,9 +2071,11 @@ glusterd_retrieve_uuid ()
cb8e9e
         int32_t         ret = -1;
cb8e9e
         gf_store_handle_t *handle = NULL;
cb8e9e
         glusterd_conf_t *priv = NULL;
cb8e9e
+        xlator_t        *this = NULL;
cb8e9e
         char            path[PATH_MAX] = {0,};
cb8e9e
 
cb8e9e
-        priv = THIS->private;
cb8e9e
+        this = THIS;
cb8e9e
+        priv = this->private;
cb8e9e
 
cb8e9e
         if (!priv->handle) {
cb8e9e
                 snprintf (path, PATH_MAX, "%s/%s", priv->workdir,
cb8e9e
@@ -2032,7 +2083,7 @@ glusterd_retrieve_uuid ()
cb8e9e
                 ret = gf_store_handle_retrieve (path, &handle);
cb8e9e
 
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log ("", GF_LOG_DEBUG, "Unable to get store"
cb8e9e
+                        gf_msg_debug (this->name, 0, "Unable to get store"
cb8e9e
                                 "handle!");
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -2044,7 +2095,7 @@ glusterd_retrieve_uuid ()
cb8e9e
                                        &uuid_str);
cb8e9e
 
cb8e9e
         if (ret) {
cb8e9e
-                gf_log ("", GF_LOG_DEBUG, "No previous uuid is present");
cb8e9e
+                gf_msg_debug (this->name, 0, "No previous uuid is present");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -2052,7 +2103,7 @@ glusterd_retrieve_uuid ()
cb8e9e
 
cb8e9e
 out:
cb8e9e
         GF_FREE (uuid_str);
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
cb8e9e
+        gf_msg_debug (this->name, 0, "Returning %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -2107,20 +2158,23 @@ glusterd_store_retrieve_snapd (glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
         ret = gf_store_handle_retrieve (path, &volinfo->snapd.handle);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "volinfo handle is NULL");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_HANDLE_NULL, "volinfo handle is NULL");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = gf_store_iter_new (volinfo->snapd.handle, &iter);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to get new store "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_ITER_GET_FAIL, "Failed to get new store "
cb8e9e
                         "iter");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = gf_store_iter_get_next (iter, &key, &value, &op_errno);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to get next store "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_ITER_GET_FAIL, "Failed to get next store "
cb8e9e
                         "iter");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -2140,7 +2194,9 @@ glusterd_store_retrieve_snapd (glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
         ret = gf_store_iter_destroy (iter);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to destroy store "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_ITER_DESTROY_FAIL,
cb8e9e
+                        "Failed to destroy store "
cb8e9e
                         "iter");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -2167,13 +2223,15 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo)
cb8e9e
         gf_store_iter_t         *tmpiter = NULL;
cb8e9e
         char                    *tmpvalue = NULL;
cb8e9e
         struct pmap_registry    *pmap = NULL;
cb8e9e
+        xlator_t                *this = NULL;
cb8e9e
         int                      brickid = 0;
cb8e9e
         gf_store_op_errno_t     op_errno = GD_STORE_SUCCESS;
cb8e9e
 
cb8e9e
         GF_ASSERT (volinfo);
cb8e9e
         GF_ASSERT (volinfo->volname);
cb8e9e
 
cb8e9e
-        priv = THIS->private;
cb8e9e
+        this = THIS;
cb8e9e
+        priv = this->private;
cb8e9e
 
cb8e9e
         GLUSTERD_GET_BRICK_DIR (brickdir, volinfo, priv);
cb8e9e
 
cb8e9e
@@ -2208,9 +2266,9 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
                 ret = gf_store_iter_get_next (iter, &key, &value, &op_errno);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log ("glusterd", GF_LOG_ERROR, "Unable to iterate "
cb8e9e
-                                "the store for brick: %s, reason: %s", path,
cb8e9e
-                                gf_store_strerror (op_errno));
cb8e9e
+                        gf_msg ("glusterd", GF_LOG_ERROR, op_errno,
cb8e9e
+                                GD_MSG_STORE_ITER_GET_FAIL, "Unable to iterate "
cb8e9e
+                                "the store for brick: %s", path);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
                 while (!ret) {
cb8e9e
@@ -2286,7 +2344,8 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo)
cb8e9e
                                 strncpy (brickinfo->brick_id, value,
cb8e9e
                                          sizeof (brickinfo->brick_id));
cb8e9e
                         } else {
cb8e9e
-                                gf_log ("", GF_LOG_ERROR, "Unknown key: %s",
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_UNKNOWN_KEY, "Unknown key: %s",
cb8e9e
                                         key);
cb8e9e
                         }
cb8e9e
 
cb8e9e
@@ -2300,7 +2359,9 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo)
cb8e9e
                 }
cb8e9e
 
cb8e9e
                 if (op_errno != GD_STORE_EOF) {
cb8e9e
-                        gf_log ("", GF_LOG_ERROR, "Error parsing brickinfo: "
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, op_errno,
cb8e9e
+                                GD_MSG_PARSE_BRICKINFO_FAIL,
cb8e9e
+                                "Error parsing brickinfo: "
cb8e9e
                                 "op_errno=%d", op_errno);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -2323,7 +2384,7 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo)
cb8e9e
         if (ret)
cb8e9e
                 goto out;
cb8e9e
 out:
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug (this->name, 0, "Returning with %d", ret);
cb8e9e
 
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
@@ -2390,15 +2451,17 @@ glusterd_store_retrieve_node_state (glusterd_volinfo_t *volinfo)
cb8e9e
                         dup_value = gf_strdup (value);
cb8e9e
                         if (!dup_value) {
cb8e9e
                                 ret = -1;
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
cb8e9e
+                                        GD_MSG_NO_MEMORY,
cb8e9e
                                         "Failed to strdup value string");
cb8e9e
                                 goto out;
cb8e9e
                         }
cb8e9e
                         ret = dict_set_str (tmp_dict, key, dup_value);
cb8e9e
                         if (ret) {
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                                "Error setting data in rebal "
cb8e9e
-                                                "dict.");
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_DICT_SET_FAILED,
cb8e9e
+                                        "Error setting data in rebal "
cb8e9e
+                                        "dict.");
cb8e9e
                                 goto out;
cb8e9e
                         }
cb8e9e
                         dup_value = NULL;
cb8e9e
@@ -2432,7 +2495,7 @@ out:
cb8e9e
         if (tmp_dict)
cb8e9e
                 dict_unref (tmp_dict);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning with %d", ret);
cb8e9e
 
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
@@ -2464,26 +2527,29 @@ glusterd_store_update_volinfo (glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
         ret = gf_store_handle_retrieve (path, &volinfo->shandle);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "volinfo handle is NULL");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_HANDLE_NULL, "volinfo handle is NULL");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = gf_store_iter_new (volinfo->shandle, &iter);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to get new store "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_ITER_GET_FAIL, "Failed to get new store "
cb8e9e
                         "iter");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = gf_store_iter_get_next (iter, &key, &value, &op_errno);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to get next store "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_ITER_GET_FAIL, "Failed to get next store "
cb8e9e
                         "iter");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         while (!ret) {
cb8e9e
-                gf_log ("", GF_LOG_DEBUG, "key = %s value = %s", key, value);
cb8e9e
+                gf_msg_debug (this->name, 0, "key = %s value = %s", key, value);
cb8e9e
                 if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_TYPE,
cb8e9e
                               strlen (GLUSTERD_STORE_KEY_VOL_TYPE))) {
cb8e9e
                         volinfo->type = atoi (value);
cb8e9e
@@ -2521,7 +2587,8 @@ glusterd_store_update_volinfo (glusterd_volinfo_t *volinfo)
cb8e9e
                                      strlen (GLUSTERD_STORE_KEY_VOL_ID))) {
cb8e9e
                         ret = gf_uuid_parse (value, volinfo->volume_id);
cb8e9e
                         if (ret)
cb8e9e
-                                gf_log ("", GF_LOG_WARNING,
cb8e9e
+                                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                        GD_MSG_UUID_PARSE_FAIL,
cb8e9e
                                         "failed to parse uuid");
cb8e9e
 
cb8e9e
                 } else if (!strncmp (key, GLUSTERD_STORE_KEY_USERNAME,
cb8e9e
@@ -2538,11 +2605,12 @@ glusterd_store_update_volinfo (glusterd_volinfo_t *volinfo)
cb8e9e
                         ret = dict_set_dynstr (volinfo->gsync_slaves, key,
cb8e9e
                                                 gf_strdup (value));
cb8e9e
                         if (ret) {
cb8e9e
-                                gf_log ("",GF_LOG_ERROR, "Error in "
cb8e9e
-                                                "dict_set_str");
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_DICT_SET_FAILED, "Error in "
cb8e9e
+                                        "dict_set_str");
cb8e9e
                                 goto out;
cb8e9e
                         }
cb8e9e
-                        gf_log ("", GF_LOG_DEBUG, "Parsed as "GEOREP" "
cb8e9e
+                        gf_msg_debug (this->name, 0, "Parsed as "GEOREP" "
cb8e9e
                                 " slave:key=%s,value:%s", key, value);
cb8e9e
 
cb8e9e
                 } else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_OP_VERSION,
cb8e9e
@@ -2561,7 +2629,8 @@ glusterd_store_update_volinfo (glusterd_volinfo_t *volinfo)
cb8e9e
                               strlen (GLUSTERD_STORE_KEY_VOL_RESTORED_SNAP))) {
cb8e9e
                         ret = gf_uuid_parse (value, volinfo->restored_from_snap);
cb8e9e
                         if (ret)
cb8e9e
-                                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                        GD_MSG_UUID_PARSE_FAIL,
cb8e9e
                                         "failed to parse restored snap's uuid");
cb8e9e
                 } else if (!strncmp (key, GLUSTERD_STORE_KEY_PARENT_VOLNAME,
cb8e9e
                                 strlen (GLUSTERD_STORE_KEY_PARENT_VOLNAME))) {
cb8e9e
@@ -2611,7 +2680,8 @@ glusterd_store_update_volinfo (glusterd_volinfo_t *volinfo)
cb8e9e
                                  /*Ignore GLUSTERD_STORE_KEY_VOL_BRICK since
cb8e9e
                                   glusterd_store_retrieve_bricks gets it later*/
cb8e9e
                                 if (!strstr (key, GLUSTERD_STORE_KEY_VOL_BRICK))
cb8e9e
-                                        gf_log ("", GF_LOG_WARNING,
cb8e9e
+                                        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                                GD_MSG_UNKNOWN_KEY,
cb8e9e
                                                 "Unknown key: %s", key);
cb8e9e
                                 break;
cb8e9e
 
cb8e9e
@@ -2627,11 +2697,13 @@ glusterd_store_update_volinfo (glusterd_volinfo_t *volinfo)
cb8e9e
                                 ret = dict_set_str(volinfo->dict, key,
cb8e9e
                                                    gf_strdup (value));
cb8e9e
                                 if (ret) {
cb8e9e
-                                        gf_log ("",GF_LOG_ERROR, "Error in "
cb8e9e
+                                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                                GD_MSG_DICT_SET_FAILED,
cb8e9e
+                                                "Error in "
cb8e9e
                                                 "dict_set_str");
cb8e9e
                                         goto out;
cb8e9e
                                 }
cb8e9e
-                                gf_log ("", GF_LOG_DEBUG, "Parsed as Volume-"
cb8e9e
+                                gf_msg_debug (this->name, 0, "Parsed as Volume-"
cb8e9e
                                         "set:key=%s,value:%s", key, value);
cb8e9e
                                 break;
cb8e9e
                         }
cb8e9e
@@ -2702,7 +2774,9 @@ glusterd_store_update_volinfo (glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
         ret = gf_store_iter_destroy (iter);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to destroy store "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_ITER_DESTROY_FAIL,
cb8e9e
+                        "Failed to destroy store "
cb8e9e
                         "iter");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -2747,7 +2821,8 @@ glusterd_store_retrieve_volume (char *volname, glusterd_snap_t *snap)
cb8e9e
 
cb8e9e
         ret = glusterd_store_update_volinfo (volinfo);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to update volinfo "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_VOLINFO_UPDATE_FAIL, "Failed to update volinfo "
cb8e9e
                         "for %s volume", volname);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -2789,7 +2864,8 @@ glusterd_store_retrieve_volume (char *volname, glusterd_snap_t *snap)
cb8e9e
                 ret = glusterd_volinfo_find (volinfo->parent_volname,
cb8e9e
                                              &origin_volinfo);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "Parent volinfo "
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_VOLINFO_GET_FAIL, "Parent volinfo "
cb8e9e
                                 "not found for %s volume", volname);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -2803,7 +2879,7 @@ out:
cb8e9e
                 volinfo = NULL;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning with %d", ret);
cb8e9e
 
cb8e9e
         return volinfo;
cb8e9e
 }
cb8e9e
@@ -2929,7 +3005,8 @@ glusterd_store_retrieve_volumes (xlator_t  *this, glusterd_snap_t *snap)
cb8e9e
         dir = opendir (path);
cb8e9e
 
cb8e9e
         if (!dir) {
cb8e9e
-                gf_log ("", GF_LOG_ERROR, "Unable to open dir %s", path);
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_DIR_OP_FAILED, "Unable to open dir %s", path);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -2942,7 +3019,8 @@ glusterd_store_retrieve_volumes (xlator_t  *this, glusterd_snap_t *snap)
cb8e9e
 
cb8e9e
                 volinfo = glusterd_store_retrieve_volume (entry->d_name, snap);
cb8e9e
                 if (!volinfo) {
cb8e9e
-                        gf_log ("", GF_LOG_ERROR, "Unable to restore "
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_VOL_RESTORE_FAIL, "Unable to restore "
cb8e9e
                                 "volume: %s", entry->d_name);
cb8e9e
                         ret = -1;
cb8e9e
                         goto out;
cb8e9e
@@ -2951,7 +3029,8 @@ glusterd_store_retrieve_volumes (xlator_t  *this, glusterd_snap_t *snap)
cb8e9e
                 ret = glusterd_store_retrieve_node_state (volinfo);
cb8e9e
                 if (ret) {
cb8e9e
                         /* Backward compatibility */
cb8e9e
-                        gf_log ("", GF_LOG_INFO, "Creating a new node_state "
cb8e9e
+                        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                                "Creating a new node_state "
cb8e9e
                                 "for volume: %s.", entry->d_name);
cb8e9e
                         glusterd_store_create_nodestate_sh_on_absence (volinfo);
cb8e9e
                         ret = glusterd_store_perform_node_state_store (volinfo);
cb8e9e
@@ -2966,7 +3045,7 @@ next:
cb8e9e
 out:
cb8e9e
         if (dir)
cb8e9e
                 closedir (dir);
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug (this->name, 0, "Returning with %d", ret);
cb8e9e
 
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
@@ -2999,7 +3078,8 @@ glusterd_find_brick_mount_path (char *brick_path, char **brick_mount_path)
cb8e9e
                 /* Snapshot bricks must have brick num as part
cb8e9e
                  * of the brickpath
cb8e9e
                  */
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
cb8e9e
+                        GD_MSG_INVALID_ENTRY,
cb8e9e
                         "Invalid brick path(%s)", brick_path);
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -3023,7 +3103,7 @@ out:
cb8e9e
                 GF_FREE (*brick_mount_path);
cb8e9e
                 *brick_mount_path = NULL;
cb8e9e
         }
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -3071,24 +3151,26 @@ glusterd_mount_brick_paths (char *brick_mount_path,
cb8e9e
                          NULL);
cb8e9e
         ret = runner_run (&runner);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "Failed to activate %s. Error: %s",
cb8e9e
-                        brickinfo->device_path, strerror(errno));
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_SNAP_ACTIVATE_FAIL,
cb8e9e
+                        "Failed to activate %s.",
cb8e9e
+                        brickinfo->device_path);
cb8e9e
                 goto out;
cb8e9e
         } else
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
                         "Activating %s successful", brickinfo->device_path);
cb8e9e
 
cb8e9e
         /* Mount the snapshot */
cb8e9e
         ret = glusterd_mount_lvm_snapshot (brickinfo, brick_mount_path);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAP_MOUNT_FAIL,
cb8e9e
                         "Failed to mount lvm snapshot.");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
 out:
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -3118,7 +3200,8 @@ glusterd_recreate_vol_brick_mounts (xlator_t  *this,
cb8e9e
                 ret = glusterd_find_brick_mount_path (brickinfo->path,
cb8e9e
                                                       &brick_mount_path);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_BRK_MNTPATH_GET_FAIL,
cb8e9e
                                 "Failed to find brick_mount_path for %s",
cb8e9e
                                 brickinfo->path);
cb8e9e
                         goto out;
cb8e9e
@@ -3132,17 +3215,17 @@ glusterd_recreate_vol_brick_mounts (xlator_t  *this,
cb8e9e
                                 ret = mkdir_p (brick_mount_path, 0777,
cb8e9e
                                                _gf_true);
cb8e9e
                                 if (ret) {
cb8e9e
-                                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                                "Failed to create %s. "
cb8e9e
-                                                "Error: %s", brick_mount_path,
cb8e9e
-                                                strerror (errno));
cb8e9e
+                                        gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                                                GD_MSG_CREATE_DIR_FAILED,
cb8e9e
+                                                "Failed to create %s. ",
cb8e9e
+                                                 brick_mount_path);
cb8e9e
                                         goto out;
cb8e9e
                                 }
cb8e9e
                         } else {
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                        "Brick Path(%s) not valid. "
cb8e9e
-                                        "Error: %s", brickinfo->path,
cb8e9e
-                                        strerror(errno));
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                                        GD_MSG_FILE_OP_FAILED,
cb8e9e
+                                        "Brick Path(%s) not valid. ",
cb8e9e
+                                         brickinfo->path);
cb8e9e
                                 goto out;
cb8e9e
                         }
cb8e9e
                 }
cb8e9e
@@ -3151,7 +3234,8 @@ glusterd_recreate_vol_brick_mounts (xlator_t  *this,
cb8e9e
                  * If not, mount the device_path at the brick_mount_path */
cb8e9e
                 ret = glusterd_mount_brick_paths (brick_mount_path, brickinfo);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_BRK_MNTPATH_MOUNT_FAIL,
cb8e9e
                                 "Failed to mount brick_mount_path");
cb8e9e
                 }
cb8e9e
 
cb8e9e
@@ -3166,7 +3250,7 @@ out:
cb8e9e
         if (ret && brick_mount_path)
cb8e9e
                 GF_FREE (brick_mount_path);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -3185,7 +3269,8 @@ glusterd_resolve_snap_bricks (xlator_t  *this, glusterd_snap_t *snap)
cb8e9e
                                          brick_list) {
cb8e9e
                         ret = glusterd_resolve_brick (brickinfo);
cb8e9e
                         if (ret) {
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_RESOLVE_BRICK_FAIL,
cb8e9e
                                         "resolve brick failed in restore");
cb8e9e
                                 goto out;
cb8e9e
                         }
cb8e9e
@@ -3195,7 +3280,7 @@ glusterd_resolve_snap_bricks (xlator_t  *this, glusterd_snap_t *snap)
cb8e9e
         ret = 0;
cb8e9e
 
cb8e9e
 out:
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning with %d", ret);
cb8e9e
 
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
@@ -3224,33 +3309,37 @@ glusterd_store_update_snap (glusterd_snap_t *snap)
cb8e9e
 
cb8e9e
         ret = gf_store_handle_retrieve (path, &snap->shandle);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "snap handle is NULL");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_HANDLE_NULL, "snap handle is NULL");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = gf_store_iter_new (snap->shandle, &iter);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to get new store "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_ITER_GET_FAIL, "Failed to get new store "
cb8e9e
                         "iter");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = gf_store_iter_get_next (iter, &key, &value, &op_errno);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to get next store "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_ITER_GET_FAIL, "Failed to get next store "
cb8e9e
                         "iter");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         while (!ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "key = %s value = %s",
cb8e9e
+                gf_msg_debug (this->name, 0, "key = %s value = %s",
cb8e9e
                         key, value);
cb8e9e
 
cb8e9e
                 if (!strncmp (key, GLUSTERD_STORE_KEY_SNAP_ID,
cb8e9e
                                      strlen (GLUSTERD_STORE_KEY_SNAP_ID))) {
cb8e9e
                         ret = gf_uuid_parse (value, snap->snap_id);
cb8e9e
                         if (ret)
cb8e9e
-                                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                        GD_MSG_UUID_PARSE_FAIL,
cb8e9e
                                         "Failed to parse uuid");
cb8e9e
                 } else if (!strncmp (key, GLUSTERD_STORE_KEY_SNAP_RESTORED,
cb8e9e
                                    strlen (GLUSTERD_STORE_KEY_SNAP_RESTORED))) {
cb8e9e
@@ -3279,7 +3368,9 @@ glusterd_store_update_snap (glusterd_snap_t *snap)
cb8e9e
 
cb8e9e
         ret = gf_store_iter_destroy (iter);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to destroy store "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_ITER_DESTROY_FAIL,
cb8e9e
+                        "Failed to destroy store "
cb8e9e
                         "iter");
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -3302,22 +3393,26 @@ glusterd_store_retrieve_snap (char *snapname)
cb8e9e
 
cb8e9e
         snap = glusterd_new_snap_object ();
cb8e9e
         if (!snap) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to create "
cb8e9e
-                                                  " snap object");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAP_OBJECT_STORE_FAIL, "Failed to create "
cb8e9e
+                        " snap object");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         strncpy (snap->snapname, snapname, strlen(snapname));
cb8e9e
         ret = glusterd_store_update_snap (snap);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to update snapshot "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAPSHOT_UPDATE_FAIL,
cb8e9e
+                        "Failed to update snapshot "
cb8e9e
                         "for %s snap", snapname);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = glusterd_store_retrieve_volumes (this, snap);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to retrieve "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAP_VOL_RETRIEVE_FAIL, "Failed to retrieve "
cb8e9e
                         "snap volumes for snap %s", snapname);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -3329,7 +3424,7 @@ glusterd_store_retrieve_snap (char *snapname)
cb8e9e
                                  glusterd_compare_snap_time);
cb8e9e
 
cb8e9e
 out:
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -3363,11 +3458,13 @@ glusterd_store_retrieve_missed_snaps_list (xlator_t  *this)
cb8e9e
         if (!fp) {
cb8e9e
                 /* If errno is ENOENT then there are no missed snaps yet */
cb8e9e
                 if (errno != ENOENT) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                "Failed to open %s. "
cb8e9e
-                                "Error: %s", path, strerror(errno));
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                                GD_MSG_FILE_OP_FAILED,
cb8e9e
+                                "Failed to open %s. ",
cb8e9e
+                                path);
cb8e9e
                 } else {
cb8e9e
-                        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                        gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                                GD_MSG_MISSED_SNAP_LIST_EMPTY,
cb8e9e
                                 "No missed snaps list.");
cb8e9e
                         ret = 0;
cb8e9e
                 }
cb8e9e
@@ -3380,16 +3477,16 @@ glusterd_store_retrieve_missed_snaps_list (xlator_t  *this)
cb8e9e
                                                   &store_errno);
cb8e9e
                 if (ret) {
cb8e9e
                         if (store_errno == GD_STORE_EOF) {
cb8e9e
-                                gf_log (this->name,
cb8e9e
-                                        GF_LOG_DEBUG,
cb8e9e
+                                gf_msg_debug (this->name,
cb8e9e
+                                        0,
cb8e9e
                                         "EOF for missed_snap_list");
cb8e9e
                                 ret = 0;
cb8e9e
                                 break;
cb8e9e
                         }
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, store_errno,
cb8e9e
+                                GD_MSG_MISSED_SNAP_GET_FAIL,
cb8e9e
                                 "Failed to fetch data from "
cb8e9e
-                                "missed_snaps_list. Error: %s",
cb8e9e
-                                gf_store_strerror (store_errno));
cb8e9e
+                                "missed_snaps_list.");
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
 
cb8e9e
@@ -3403,7 +3500,8 @@ glusterd_store_retrieve_missed_snaps_list (xlator_t  *this)
cb8e9e
                 if (!missed_node_info || !brick_path || !snap_vol_id ||
cb8e9e
                     brick_num < 1 || snap_op < 1 ||
cb8e9e
                     snap_status < 1) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, EINVAL,
cb8e9e
+                                GD_MSG_INVALID_MISSED_SNAP_ENTRY,
cb8e9e
                                 "Invalid missed_snap_entry");
cb8e9e
                         ret = -1;
cb8e9e
                         goto out;
cb8e9e
@@ -3416,7 +3514,8 @@ glusterd_store_retrieve_missed_snaps_list (xlator_t  *this)
cb8e9e
                                                       snap_op,
cb8e9e
                                                       snap_status);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_MISSED_SNAP_LIST_STORE_FAIL,
cb8e9e
                                 "Failed to store missed snaps_list");
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -3425,7 +3524,7 @@ glusterd_store_retrieve_missed_snaps_list (xlator_t  *this)
cb8e9e
 
cb8e9e
         ret = 0;
cb8e9e
 out:
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -3452,7 +3551,9 @@ glusterd_store_retrieve_snaps (xlator_t  *this)
cb8e9e
                    backward compatibility */
cb8e9e
                 if (errno != ENOENT) {
cb8e9e
                         ret = -1;
cb8e9e
-                        gf_log ("", GF_LOG_ERROR, "Unable to open dir %s", path);
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                                GD_MSG_DIR_OP_FAILED, "Unable to open dir %s",
cb8e9e
+                                path);
cb8e9e
                 }
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -3463,7 +3564,8 @@ glusterd_store_retrieve_snaps (xlator_t  *this)
cb8e9e
                 if (strcmp (entry->d_name, GLUSTERD_MISSED_SNAPS_LIST_FILE)) {
cb8e9e
                         ret = glusterd_store_retrieve_snap (entry->d_name);
cb8e9e
                         if (ret) {
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_SNAP_RESTORE_FAIL,
cb8e9e
                                         "Unable to restore snapshot: %s",
cb8e9e
                                         entry->d_name);
cb8e9e
                                 goto out;
cb8e9e
@@ -3475,7 +3577,7 @@ glusterd_store_retrieve_snaps (xlator_t  *this)
cb8e9e
         /* Retrieve missed_snaps_list */
cb8e9e
         ret = glusterd_store_retrieve_missed_snaps_list (this);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
                         "Failed to retrieve missed_snaps_list");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -3483,7 +3585,7 @@ glusterd_store_retrieve_snaps (xlator_t  *this)
cb8e9e
 out:
cb8e9e
         if (dir)
cb8e9e
                 closedir (dir);
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug (this->name, 0, "Returning with %d", ret);
cb8e9e
 
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
@@ -3522,7 +3624,8 @@ glusterd_store_write_missed_snapinfo (int32_t fd)
cb8e9e
                                   snap_opinfo->op, snap_opinfo->status);
cb8e9e
                         ret = gf_store_save_value (fd, key, value);
cb8e9e
                         if (ret) {
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_MISSEDSNAP_INFO_SET_FAIL,
cb8e9e
                                         "Failed to write missed snapinfo");
cb8e9e
                                 goto out;
cb8e9e
                         }
cb8e9e
@@ -3531,7 +3634,7 @@ glusterd_store_write_missed_snapinfo (int32_t fd)
cb8e9e
 
cb8e9e
         ret = 0;
cb8e9e
 out:
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -3553,14 +3656,17 @@ glusterd_store_update_missed_snaps ()
cb8e9e
 
cb8e9e
         ret = glusterd_store_create_missed_snaps_list_shandle_on_absence ();
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Unable to obtain "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_MISSED_SNAP_LIST_STORE_HANDLE_GET_FAIL,
cb8e9e
+                        "Unable to obtain "
cb8e9e
                         "missed_snaps_list store handle.");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         fd = gf_store_mkstemp (priv->missed_snaps_list_shandle);
cb8e9e
         if (fd <= 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_FILE_OP_FAILED,
cb8e9e
                         "Failed to create tmp file");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -3568,14 +3674,16 @@ glusterd_store_update_missed_snaps ()
cb8e9e
 
cb8e9e
         ret = glusterd_store_write_missed_snapinfo (fd);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_MISSED_SNAP_CREATE_FAIL,
cb8e9e
                         "Failed to write missed snaps to disk");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = gf_store_rename_tmppath (priv->missed_snaps_list_shandle);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_FILE_OP_FAILED,
cb8e9e
                         "Failed to rename the tmp file");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -3583,13 +3691,14 @@ out:
cb8e9e
         if (ret && (fd > 0)) {
cb8e9e
                 ret = gf_store_unlink_tmppath (priv->missed_snaps_list_shandle);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_TMP_FILE_UNLINK_FAIL,
cb8e9e
                                 "Failed to unlink the tmp file");
cb8e9e
                 }
cb8e9e
                 ret = -1;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -3598,6 +3707,7 @@ glusterd_store_delete_peerinfo (glusterd_peerinfo_t *peerinfo)
cb8e9e
 {
cb8e9e
         int32_t                         ret = -1;
cb8e9e
         glusterd_conf_t                 *priv = NULL;
cb8e9e
+        xlator_t                        *this = NULL;
cb8e9e
         char                            peerdir[PATH_MAX] = {0,};
cb8e9e
         char                            filepath[PATH_MAX] = {0,};
cb8e9e
         char                            hostname_path[PATH_MAX] = {0,};
cb8e9e
@@ -3608,7 +3718,8 @@ glusterd_store_delete_peerinfo (glusterd_peerinfo_t *peerinfo)
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        priv = THIS->private;
cb8e9e
+        this = THIS;
cb8e9e
+        priv = this->private;
cb8e9e
 
cb8e9e
         snprintf (peerdir, PATH_MAX, "%s/peers", priv->workdir);
cb8e9e
 
cb8e9e
@@ -3644,7 +3755,7 @@ out:
cb8e9e
                 gf_store_handle_destroy (peerinfo->shandle);
cb8e9e
                 peerinfo->shandle = NULL;
cb8e9e
         }
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug (this->name, 0, "Returning with %d", ret);
cb8e9e
 
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
@@ -3669,7 +3780,7 @@ glusterd_store_create_peer_dir ()
cb8e9e
         glusterd_store_peerinfo_dirpath_set (path, sizeof (path));
cb8e9e
         ret = gf_store_mkdir (path);
cb8e9e
 
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug ("glusterd", 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -3798,7 +3909,7 @@ glusterd_store_peer_write (int fd, glusterd_peerinfo_t *peerinfo)
cb8e9e
         }
cb8e9e
 
cb8e9e
 out:
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug ("glusterd", 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -3824,7 +3935,7 @@ glusterd_store_perform_peer_store (glusterd_peerinfo_t *peerinfo)
cb8e9e
 out:
cb8e9e
         if (ret && (fd > 0))
cb8e9e
                 gf_store_unlink_tmppath (peerinfo->shandle);
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
cb8e9e
+        gf_msg_debug ("glusterd", 0, "Returning %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -3845,7 +3956,7 @@ glusterd_store_peerinfo (glusterd_peerinfo_t *peerinfo)
cb8e9e
 
cb8e9e
         ret = glusterd_store_perform_peer_store (peerinfo);
cb8e9e
 out:
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug ("glusterd", 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -3879,7 +3990,9 @@ glusterd_store_retrieve_peers (xlator_t *this)
cb8e9e
         dir = opendir (path);
cb8e9e
 
cb8e9e
         if (!dir) {
cb8e9e
-                gf_log ("", GF_LOG_ERROR, "Unable to open dir %s", path);
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_DIR_OP_FAILED,
cb8e9e
+                        "Unable to open dir %s", path);
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -3925,7 +4038,8 @@ glusterd_store_retrieve_peers (xlator_t *this)
cb8e9e
                                    strlen (GLUSTERD_STORE_KEY_PEER_HOSTNAME))) {
cb8e9e
                                 ret = gd_add_address_to_peer (peerinfo, value);
cb8e9e
                         } else {
cb8e9e
-                                gf_log ("", GF_LOG_ERROR, "Unknown key: %s",
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_UNKNOWN_KEY, "Unknown key: %s",
cb8e9e
                                         key);
cb8e9e
                         }
cb8e9e
 
cb8e9e
@@ -3982,7 +4096,7 @@ out:
cb8e9e
 
cb8e9e
         if (dir)
cb8e9e
                 closedir (dir);
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
cb8e9e
+        gf_msg_debug (this->name, 0, "Returning with %d", ret);
cb8e9e
 
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
@@ -4012,7 +4126,8 @@ glusterd_recreate_all_snap_brick_mounts (xlator_t  *this)
cb8e9e
 
cb8e9e
                 ret = glusterd_recreate_vol_brick_mounts (this, volinfo);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_BRK_MNT_RECREATE_FAIL,
cb8e9e
                                 "Failed to recreate brick mounts "
cb8e9e
                                 "for %s", volinfo->volname);
cb8e9e
                         goto out;
cb8e9e
@@ -4025,7 +4140,8 @@ glusterd_recreate_all_snap_brick_mounts (xlator_t  *this)
cb8e9e
                         ret = glusterd_recreate_vol_brick_mounts (this,
cb8e9e
                                                                   volinfo);
cb8e9e
                         if (ret) {
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_BRK_MNT_RECREATE_FAIL,
cb8e9e
                                         "Failed to recreate brick mounts "
cb8e9e
                                         "for %s", snap->snapname);
cb8e9e
                                 goto out;
cb8e9e
@@ -4034,7 +4150,7 @@ glusterd_recreate_all_snap_brick_mounts (xlator_t  *this)
cb8e9e
         }
cb8e9e
 
cb8e9e
 out:
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -4066,7 +4182,8 @@ glusterd_snap_cleanup (xlator_t  *this)
cb8e9e
 
cb8e9e
         dict = dict_new();
cb8e9e
         if (!dict) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_DICT_CREATE_FAIL,
cb8e9e
                         "Failed to create dict");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -4077,7 +4194,9 @@ glusterd_snap_cleanup (xlator_t  *this)
cb8e9e
                 if (snap->snap_status == GD_SNAP_STATUS_RESTORED) {
cb8e9e
                         ret = glusterd_snapshot_revert_restore_from_snap (snap);
cb8e9e
                         if (ret) {
cb8e9e
-                                gf_log (this->name, GF_LOG_WARNING, "Failed to "
cb8e9e
+                                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                        GD_MSG_SNAP_RESTORE_REVERT_FAIL,
cb8e9e
+                                        "Failed to "
cb8e9e
                                         "revert partially restored snapshot "
cb8e9e
                                         "(%s)", snap->snapname);
cb8e9e
                                 goto out;
cb8e9e
@@ -4086,7 +4205,8 @@ glusterd_snap_cleanup (xlator_t  *this)
cb8e9e
                         ret = glusterd_snap_remove (dict, snap,
cb8e9e
                                                     _gf_true, _gf_true);
cb8e9e
                         if (ret) {
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_SNAP_REMOVE_FAIL,
cb8e9e
                                         "Failed to remove the snapshot %s",
cb8e9e
                                         snap->snapname);
cb8e9e
                                 goto out;
cb8e9e
@@ -4097,7 +4217,7 @@ out:
cb8e9e
         if (dict)
cb8e9e
                 dict_unref (dict);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -4121,7 +4241,8 @@ glusterd_resolve_all_bricks (xlator_t  *this)
cb8e9e
                                          brick_list) {
cb8e9e
                         ret = glusterd_resolve_brick (brickinfo);
cb8e9e
                         if (ret) {
cb8e9e
-                                gf_log ("glusterd", GF_LOG_ERROR,
cb8e9e
+                                gf_msg ("glusterd", GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_RESOLVE_BRICK_FAIL,
cb8e9e
                                         "resolve brick failed in restore");
cb8e9e
                                 goto out;
cb8e9e
                         }
cb8e9e
@@ -4132,7 +4253,8 @@ glusterd_resolve_all_bricks (xlator_t  *this)
cb8e9e
         cds_list_for_each_entry (snap, &priv->snapshots, snap_list) {
cb8e9e
                 ret = glusterd_resolve_snap_bricks (this, snap);
cb8e9e
                 if (ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_SNAP_RESOLVE_BRICK_FAIL,
cb8e9e
                                 "resolving the snap bricks"
cb8e9e
                                 " failed for snap: %s",
cb8e9e
                                 snap->snapname);
cb8e9e
@@ -4141,7 +4263,7 @@ glusterd_resolve_all_bricks (xlator_t  *this)
cb8e9e
         }
cb8e9e
 
cb8e9e
 out:
cb8e9e
-        gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
cb8e9e
+        gf_msg_trace (this->name, 0, "Returning with %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -4179,20 +4301,22 @@ glusterd_restore ()
cb8e9e
 
cb8e9e
         ret = glusterd_snap_cleanup (this);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to perform "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAP_CLEANUP_FAIL, "Failed to perform "
cb8e9e
                         "a cleanup of the snapshots");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = glusterd_recreate_all_snap_brick_mounts (this);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to recreate "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_SNAP_BRK_MNT_RECREATE_FAIL, "Failed to recreate "
cb8e9e
                         "all snap brick mounts");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
 out:
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
cb8e9e
+        gf_msg_debug (this->name, 0, "Returning %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -4220,22 +4344,24 @@ glusterd_store_retrieve_quota_version (glusterd_volinfo_t *volinfo)
cb8e9e
 
cb8e9e
         ret = gf_store_handle_new (cksum_path, &handle);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Unable to get store handle "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_STORE_HANDLE_GET_FAIL,
cb8e9e
+                        "Unable to get store handle "
cb8e9e
                         "for %s", cksum_path);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = gf_store_retrieve_value (handle, "version", &version_str);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "Version absent");
cb8e9e
+                gf_msg_debug (this->name, 0, "Version absent");
cb8e9e
                 ret = 0;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         version = strtoul (version_str, &tmp, 10);
cb8e9e
 	if ((errno == ERANGE) || (errno == EINVAL)) {
cb8e9e
-                 gf_log (this->name, GF_LOG_DEBUG, "Invalid version number");
cb8e9e
-                 goto out;
cb8e9e
+                gf_msg_debug (this->name, 0, "Invalid version number");
cb8e9e
+                goto out;
cb8e9e
         }
cb8e9e
         volinfo->quota_conf_version = version;
cb8e9e
         ret = 0;
cb8e9e
@@ -4279,7 +4405,8 @@ glusterd_store_save_quota_version_and_cksum (glusterd_volinfo_t *volinfo)
cb8e9e
         snprintf (buf, sizeof (buf)-1, "%u", volinfo->quota_conf_cksum);
cb8e9e
         ret = gf_store_save_value (fd, "cksum", buf);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to store cksum");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_CKSUM_STORE_FAIL, "Failed to store cksum");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -4287,7 +4414,8 @@ glusterd_store_save_quota_version_and_cksum (glusterd_volinfo_t *volinfo)
cb8e9e
         snprintf (buf, sizeof (buf)-1, "%u", volinfo->quota_conf_version);
cb8e9e
         ret = gf_store_save_value (fd, "version", buf);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to store version");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_VERS_STORE_FAIL, "Failed to store version");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
cb8e9e
index 39160c0..57592c8 100644
cb8e9e
--- a/xlators/mgmt/glusterd/src/glusterd.c
cb8e9e
+++ b/xlators/mgmt/glusterd/src/glusterd.c
cb8e9e
@@ -45,6 +45,7 @@
cb8e9e
 #include "glusterd-scrub-svc.h"
cb8e9e
 #include "glusterd-quotad-svc.h"
cb8e9e
 #include "glusterd-snapd-svc.h"
cb8e9e
+#include "glusterd-messages.h"
cb8e9e
 #include "common-utils.h"
cb8e9e
 #include "glusterd-geo-rep.h"
cb8e9e
 #include "run.h"
cb8e9e
@@ -159,7 +160,8 @@ glusterd_uuid_init ()
cb8e9e
         ret = glusterd_uuid_generate_save ();
cb8e9e
 
cb8e9e
         if (ret) {
cb8e9e
-                gf_log ("glusterd", GF_LOG_ERROR,
cb8e9e
+                gf_msg ("glusterd", GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_UUID_GEN_STORE_FAIL,
cb8e9e
                           "Unable to generate and save new UUID");
cb8e9e
                 return ret;
cb8e9e
         }
cb8e9e
@@ -187,7 +189,8 @@ glusterd_uuid_generate_save ()
cb8e9e
         ret = glusterd_store_global_info (this);
cb8e9e
 
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_UUID_STORE_FAIL,
cb8e9e
                         "Unable to store the generated uuid %s",
cb8e9e
                         uuid_utoa (priv->uuid));
cb8e9e
 
cb8e9e
@@ -219,7 +222,8 @@ glusterd_options_init (xlator_t *this)
cb8e9e
 
cb8e9e
         ret = glusterd_store_options (this, priv->opts);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Unable to store version");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_VERS_STORE_FAIL, "Unable to store version");
cb8e9e
                 return ret;
cb8e9e
         }
cb8e9e
 out:
cb8e9e
@@ -298,7 +302,8 @@ mem_acct_init (xlator_t *this)
cb8e9e
         ret = xlator_mem_acct_init (this, gf_gld_mt_end + 1);
cb8e9e
 
cb8e9e
         if (ret != 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
cb8e9e
+                        GD_MSG_NO_MEMORY, "Memory accounting init"
cb8e9e
                         " failed");
cb8e9e
                 return ret;
cb8e9e
         }
cb8e9e
@@ -315,7 +320,8 @@ glusterd_rpcsvc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
cb8e9e
         glusterd_conf_t     *priv = NULL;
cb8e9e
 
cb8e9e
         if (!xl || !data) {
cb8e9e
-                gf_log ("glusterd", GF_LOG_WARNING,
cb8e9e
+                gf_msg ("glusterd", GF_LOG_WARNING, 0,
cb8e9e
+                        GD_MSG_NO_INIT,
cb8e9e
                         "Calling rpc_notify without initializing");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -360,7 +366,7 @@ glusterd_program_register (xlator_t *this, rpcsvc_t *svc,
cb8e9e
 
cb8e9e
         ret = rpcsvc_program_register (svc, prog);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
                         "cannot register program (name: %s, prognum:%d, "
cb8e9e
                         "progver:%d)", prog->progname, prog->prognum,
cb8e9e
                         prog->progver);
cb8e9e
@@ -389,7 +395,7 @@ glusterd_rpcsvc_options_build (dict_t *options)
cb8e9e
                         goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "listen-backlog value: %d", backlog);
cb8e9e
+        gf_msg_debug ("", 0, "listen-backlog value: %d", backlog);
cb8e9e
 
cb8e9e
 out:
cb8e9e
         return ret;
cb8e9e
@@ -410,12 +416,14 @@ glusterd_check_gsync_present (int *valid_state)
cb8e9e
         ret = runner_start (&runner);
cb8e9e
         if (ret == -1) {
cb8e9e
                 if (errno == ENOENT) {
cb8e9e
-                        gf_log ("glusterd", GF_LOG_INFO, GEOREP
cb8e9e
+                        gf_msg ("glusterd", GF_LOG_INFO, errno,
cb8e9e
+                                GD_MSG_MODULE_NOT_INSTALLED, GEOREP
cb8e9e
                                  " module not installed in the system");
cb8e9e
                         *valid_state = 0;
cb8e9e
                 }
cb8e9e
                 else {
cb8e9e
-                        gf_log ("glusterd", GF_LOG_ERROR, GEOREP
cb8e9e
+                        gf_msg ("glusterd", GF_LOG_ERROR, errno,
cb8e9e
+                                GD_MSG_MODULE_NOT_WORKING, GEOREP
cb8e9e
                                   " module not working as desired");
cb8e9e
                         *valid_state = -1;
cb8e9e
                 }
cb8e9e
@@ -426,14 +434,16 @@ glusterd_check_gsync_present (int *valid_state)
cb8e9e
         if (ptr) {
cb8e9e
                 if (!strstr (buff, "gsyncd")) {
cb8e9e
                         ret = -1;
cb8e9e
-                        gf_log ("glusterd", GF_LOG_ERROR, GEOREP" module not "
cb8e9e
+                        gf_msg ("glusterd", GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_MODULE_NOT_WORKING, GEOREP" module not "
cb8e9e
                                  "working as desired");
cb8e9e
                         *valid_state = -1;
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
         } else {
cb8e9e
                 ret = -1;
cb8e9e
-                gf_log ("glusterd", GF_LOG_ERROR, GEOREP" module not "
cb8e9e
+                gf_msg ("glusterd", GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_MODULE_NOT_WORKING, GEOREP" module not "
cb8e9e
                          "working as desired");
cb8e9e
                 *valid_state = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -444,7 +454,7 @@ glusterd_check_gsync_present (int *valid_state)
cb8e9e
 
cb8e9e
         runner_end (&runner);
cb8e9e
 
cb8e9e
-        gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
cb8e9e
+        gf_msg_debug ("glusterd", 0, "Returning %d", ret);
cb8e9e
         return ret;
cb8e9e
 
cb8e9e
 }
cb8e9e
@@ -468,7 +478,8 @@ group_write_allow (char *path, gid_t gid)
cb8e9e
 
cb8e9e
  out:
cb8e9e
         if (ret == -1)
cb8e9e
-                gf_log ("", GF_LOG_CRITICAL,
cb8e9e
+                gf_msg ("", GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_WRITE_ACCESS_GRANT_FAIL,
cb8e9e
                         "failed to set up write access to %s for group %d (%s)",
cb8e9e
                         path, gid, strerror (errno));
cb8e9e
         return ret;
cb8e9e
@@ -486,7 +497,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
cb8e9e
 
cb8e9e
         if (strlen (conf->workdir)+2 > PATH_MAX-strlen(GEOREP)) {
cb8e9e
                 ret = -1;
cb8e9e
-                gf_log ("glusterd", GF_LOG_CRITICAL,
cb8e9e
+                gf_msg ("glusterd", GF_LOG_CRITICAL, 0,
cb8e9e
+                        GD_MSG_DIRPATH_TOO_LONG,
cb8e9e
                         "directory path %s/"GEOREP" is longer than PATH_MAX",
cb8e9e
                         conf->workdir);
cb8e9e
                 goto out;
cb8e9e
@@ -495,7 +507,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
cb8e9e
         snprintf (georepdir, PATH_MAX, "%s/"GEOREP, conf->workdir);
cb8e9e
         ret = mkdir_p (georepdir, 0777, _gf_true);
cb8e9e
         if (-1 == ret) {
cb8e9e
-                gf_log ("glusterd", GF_LOG_CRITICAL,
cb8e9e
+                gf_msg ("glusterd", GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "Unable to create "GEOREP" directory %s",
cb8e9e
                         georepdir);
cb8e9e
                 goto out;
cb8e9e
@@ -503,14 +516,16 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
cb8e9e
 
cb8e9e
         if (strlen (DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP) >= PATH_MAX) {
cb8e9e
                 ret = -1;
cb8e9e
-                gf_log ("glusterd", GF_LOG_CRITICAL,
cb8e9e
+                gf_msg ("glusterd", GF_LOG_CRITICAL, 0,
cb8e9e
+                        GD_MSG_DIRPATH_TOO_LONG,
cb8e9e
                         "directory path "DEFAULT_LOG_FILE_DIRECTORY"/"
cb8e9e
                         GEOREP" is longer than PATH_MAX");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
         ret = mkdir_p (DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP, 0777, _gf_true);
cb8e9e
         if (-1 == ret) {
cb8e9e
-                gf_log ("glusterd", GF_LOG_CRITICAL,
cb8e9e
+                gf_msg ("glusterd", GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "Unable to create "GEOREP" log directory");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -518,7 +533,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
cb8e9e
         /* Slave log file directory */
cb8e9e
         if (strlen(DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves") >= PATH_MAX) {
cb8e9e
                 ret = -1;
cb8e9e
-                gf_log ("glusterd", GF_LOG_CRITICAL,
cb8e9e
+                gf_msg ("glusterd", GF_LOG_CRITICAL, 0,
cb8e9e
+                        GD_MSG_DIRPATH_TOO_LONG,
cb8e9e
                         "directory path "DEFAULT_LOG_FILE_DIRECTORY"/"
cb8e9e
                         GEOREP"-slaves"" is longer than PATH_MAX");
cb8e9e
                 goto out;
cb8e9e
@@ -526,7 +542,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
cb8e9e
         ret = mkdir_p (DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves", 0777,
cb8e9e
                       _gf_true);
cb8e9e
         if (-1 == ret) {
cb8e9e
-                gf_log ("glusterd", GF_LOG_CRITICAL,
cb8e9e
+                gf_msg ("glusterd", GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "Unable to create "GEOREP" slave log directory");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -534,7 +551,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
cb8e9e
         /* MountBroker log file directory */
cb8e9e
         if (strlen(DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr") >= PATH_MAX) {
cb8e9e
                 ret = -1;
cb8e9e
-                gf_log ("glusterd", GF_LOG_CRITICAL,
cb8e9e
+                gf_msg ("glusterd", GF_LOG_CRITICAL, 0,
cb8e9e
+                        GD_MSG_DIRPATH_TOO_LONG,
cb8e9e
                         "directory path "DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP
cb8e9e
                         "-slaves/mbr"" is longer than PATH_MAX");
cb8e9e
                 goto out;
cb8e9e
@@ -542,7 +560,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
cb8e9e
         ret = mkdir_p (DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr", 0777,
cb8e9e
                       _gf_true);
cb8e9e
         if (-1 == ret) {
cb8e9e
-                gf_log ("glusterd", GF_LOG_CRITICAL,
cb8e9e
+                gf_msg ("glusterd", GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "Unable to create "GEOREP" mountbroker slave log directory");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -553,7 +572,8 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
cb8e9e
         else {
cb8e9e
                 gr = getgrnam (greplg_s);
cb8e9e
                 if (!gr) {
cb8e9e
-                        gf_log ("glusterd", GF_LOG_CRITICAL,
cb8e9e
+                        gf_msg ("glusterd", GF_LOG_CRITICAL, 0,
cb8e9e
+                                GD_MSG_LOGGROUP_INVALID,
cb8e9e
                                 "group "GEOREP"-log-group %s does not exist", greplg_s);
cb8e9e
                         ret = -1;
cb8e9e
                         goto out;
cb8e9e
@@ -570,7 +590,7 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
cb8e9e
         }
cb8e9e
 
cb8e9e
  out:
cb8e9e
-        gf_log("", GF_LOG_DEBUG, "Returning %d", ret);
cb8e9e
+        gf_msg_debug ("", 0, "Returning %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -822,7 +842,8 @@ check_prepare_mountbroker_root (char *mountbroker_root)
cb8e9e
                 ret = fstat (dfd, &st);
cb8e9e
         }
cb8e9e
         if (ret == -1 || !S_ISDIR (st.st_mode)) {
cb8e9e
-                gf_log ("", GF_LOG_ERROR,
cb8e9e
+                gf_msg ("", GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_DIR_OP_FAILED,
cb8e9e
                         "cannot access mountbroker-root directory %s",
cb8e9e
                         mountbroker_root);
cb8e9e
                 ret = -1;
cb8e9e
@@ -830,14 +851,16 @@ check_prepare_mountbroker_root (char *mountbroker_root)
cb8e9e
         }
cb8e9e
         if (st.st_uid != 0 ||
cb8e9e
             (st.st_mode & (S_IWGRP|S_IWOTH))) {
cb8e9e
-                gf_log ("", GF_LOG_ERROR,
cb8e9e
+                gf_msg ("", GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_DIR_PERM_LIBERAL,
cb8e9e
                         "permissions on mountbroker-root directory %s are "
cb8e9e
                         "too liberal", mountbroker_root);
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
         if (!(st.st_mode & (S_IXGRP|S_IXOTH))) {
cb8e9e
-                gf_log ("", GF_LOG_WARNING,
cb8e9e
+                gf_msg ("", GF_LOG_WARNING, 0,
cb8e9e
+                        GD_MSG_DIR_PERM_STRICT,
cb8e9e
                         "permissions on mountbroker-root directory %s are "
cb8e9e
                         "probably too strict", mountbroker_root);
cb8e9e
         }
cb8e9e
@@ -851,7 +874,8 @@ check_prepare_mountbroker_root (char *mountbroker_root)
cb8e9e
                         ret = fstat (dfd2, &st2;;
cb8e9e
                 }
cb8e9e
                 if (ret == -1) {
cb8e9e
-                        gf_log ("", GF_LOG_ERROR,
cb8e9e
+                        gf_msg ("", GF_LOG_ERROR, errno,
cb8e9e
+                                GD_MSG_DIR_OP_FAILED,
cb8e9e
                                 "error while checking mountbroker-root ancestors "
cb8e9e
                                 "%d (%s)", errno, strerror (errno));
cb8e9e
                         goto out;
cb8e9e
@@ -863,14 +887,16 @@ check_prepare_mountbroker_root (char *mountbroker_root)
cb8e9e
                 if (st2.st_uid != 0 ||
cb8e9e
                     ((st2.st_mode & (S_IWGRP|S_IWOTH)) &&
cb8e9e
                      !(st2.st_mode & S_ISVTX))) {
cb8e9e
-                        gf_log ("", GF_LOG_ERROR,
cb8e9e
+                        gf_msg ("", GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_DIR_PERM_LIBERAL,
cb8e9e
                                 "permissions on ancestors of mountbroker-root "
cb8e9e
                                 "directory are too liberal");
cb8e9e
                         ret = -1;
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
                 if (!(st.st_mode & (S_IXGRP|S_IXOTH))) {
cb8e9e
-                        gf_log ("", GF_LOG_WARNING,
cb8e9e
+                        gf_msg ("", GF_LOG_WARNING, 0,
cb8e9e
+                                GD_MSG_DIR_PERM_STRICT,
cb8e9e
                                 "permissions on ancestors of mountbroker-root "
cb8e9e
                                 "directory are probably too strict");
cb8e9e
                 }
cb8e9e
@@ -886,7 +912,8 @@ check_prepare_mountbroker_root (char *mountbroker_root)
cb8e9e
         if (ret != -1)
cb8e9e
                 ret = sys_fstatat (dfd0, MB_HIVE, &st, AT_SYMLINK_NOFOLLOW);
cb8e9e
         if (ret == -1 || st.st_mode != (S_IFDIR|0711)) {
cb8e9e
-                gf_log ("", GF_LOG_ERROR,
cb8e9e
+                gf_msg ("", GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "failed to set up mountbroker-root directory %s",
cb8e9e
                         mountbroker_root);
cb8e9e
                 ret = -1;
cb8e9e
@@ -977,7 +1004,8 @@ _install_mount_spec (dict_t *opts, char *key, data_t *value, void *data)
cb8e9e
         return 0;
cb8e9e
  err:
cb8e9e
 
cb8e9e
-        gf_log ("", GF_LOG_ERROR,
cb8e9e
+        gf_msg ("", GF_LOG_ERROR, 0,
cb8e9e
+                GD_MSG_MOUNT_SPEC_INSTALL_FAIL,
cb8e9e
                 "adding %smount spec failed: label: %s desc: %s",
cb8e9e
                 georep ? GEOREP" " : "", label, pdesc);
cb8e9e
 
cb8e9e
@@ -1042,14 +1070,14 @@ glusterd_init_uds_listener (xlator_t *this)
cb8e9e
         ret = rpcsvc_register_notify (rpc, glusterd_uds_rpcsvc_notify,
cb8e9e
                                       this);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
                         "Failed to register notify function");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = rpcsvc_create_listeners (rpc, options, this->name);
cb8e9e
         if (ret != 1) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "Failed to create listener");
cb8e9e
+                gf_msg_debug (this->name, 0, "Failed to create listener");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
         ret = 0;
cb8e9e
@@ -1071,7 +1099,9 @@ out:
cb8e9e
                 dict_unref (options);
cb8e9e
 
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to start glusterd "
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_GLUSTERD_SOCK_LISTENER_START_FAIL,
cb8e9e
+                        "Failed to start glusterd "
cb8e9e
                         "unix domain socket listener.");
cb8e9e
                 if (rpc) {
cb8e9e
                         GF_FREE (rpc);
cb8e9e
@@ -1165,7 +1195,8 @@ glusterd_find_correct_var_run_dir (xlator_t *this, char *var_run_dir)
cb8e9e
          */
cb8e9e
         ret = lstat (GLUSTERD_VAR_RUN_DIR, &buf;;
cb8e9e
         if (ret != 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_FILE_OP_FAILED,
cb8e9e
                         "stat fails on %s, exiting. (errno = %d)",
cb8e9e
                         GLUSTERD_VAR_RUN_DIR, errno);
cb8e9e
                 goto out;
cb8e9e
@@ -1200,7 +1231,8 @@ glusterd_init_var_run_dirs (xlator_t *this, char *var_run_dir,
cb8e9e
 
cb8e9e
         ret = stat (abs_path, &buf;;
cb8e9e
         if ((ret != 0) && (ENOENT != errno)) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_FILE_OP_FAILED,
cb8e9e
                         "stat fails on %s, exiting. (errno = %d)",
cb8e9e
                         abs_path, errno);
cb8e9e
                 ret = -1;
cb8e9e
@@ -1208,7 +1240,8 @@ glusterd_init_var_run_dirs (xlator_t *this, char *var_run_dir,
cb8e9e
         }
cb8e9e
 
cb8e9e
         if ((!ret) && (!S_ISDIR(buf.st_mode))) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, ENOENT,
cb8e9e
+                        GD_MSG_DIR_NOT_FOUND,
cb8e9e
                         "Provided snap path %s is not a directory,"
cb8e9e
                         "exiting", abs_path);
cb8e9e
                 ret = -1;
cb8e9e
@@ -1220,7 +1253,8 @@ glusterd_init_var_run_dirs (xlator_t *this, char *var_run_dir,
cb8e9e
                 ret = mkdir_p (abs_path, 0777, _gf_true);
cb8e9e
 
cb8e9e
                 if (-1 == ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                        gf_msg (this->name, GF_LOG_CRITICAL, errno,
cb8e9e
+                                GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                                 "Unable to create directory %s"
cb8e9e
                                 " ,errno = %d", abs_path, errno);
cb8e9e
                         goto out;
cb8e9e
@@ -1247,27 +1281,32 @@ glusterd_svc_init_all ()
cb8e9e
         /* Init SHD svc */
cb8e9e
         ret = glusterd_shdsvc_init (&(priv->shd_svc));
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR, "Failed to init shd service");
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_FAILED_INIT_SHDSVC,
cb8e9e
+                        "Failed to init shd service");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
-        gf_log (THIS->name, GF_LOG_DEBUG, "shd service initialized");
cb8e9e
+        gf_msg_debug (THIS->name, 0, "shd service initialized");
cb8e9e
 
cb8e9e
         /* Init NFS svc */
cb8e9e
         ret = glusterd_nfssvc_init (&(priv->nfs_svc));
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR, "Failed to init nfs service");
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_FAILED_INIT_NFSSVC,
cb8e9e
+                        "Failed to init nfs service");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
-        gf_log (THIS->name, GF_LOG_DEBUG, "nfs service initialized");
cb8e9e
+        gf_msg_debug (THIS->name, 0, "nfs service initialized");
cb8e9e
 
cb8e9e
         /* Init QuotaD svc */
cb8e9e
         ret = glusterd_quotadsvc_init (&(priv->quotad_svc));
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR, "Failed to init quotad "
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_FAILED_INIT_QUOTASVC, "Failed to init quotad "
cb8e9e
                         "service");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
-        gf_log (THIS->name, GF_LOG_DEBUG, "quotad service initialized");
cb8e9e
+        gf_msg_debug (THIS->name, 0, "quotad service initialized");
cb8e9e
 
cb8e9e
         /* Init BitD svc */
cb8e9e
         ret = glusterd_bitdsvc_init (&(priv->bitd_svc));
cb8e9e
@@ -1323,7 +1362,8 @@ init (xlator_t *this)
cb8e9e
                 lim.rlim_max = 65536;
cb8e9e
 
cb8e9e
                 if (setrlimit (RLIMIT_NOFILE, &lim) == -1) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                                GD_MSG_SETXATTR_FAIL,
cb8e9e
                                 "Failed to set 'ulimit -n "
cb8e9e
                                 " 65536': %s", strerror(errno));
cb8e9e
                 } else {
cb8e9e
@@ -1345,14 +1385,16 @@ init (xlator_t *this)
cb8e9e
 
cb8e9e
         ret = stat (workdir, &buf;;
cb8e9e
         if ((ret != 0) && (ENOENT != errno)) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                        GD_MSG_DIR_OP_FAILED,
cb8e9e
                         "stat fails on %s, exiting. (errno = %d)",
cb8e9e
                         workdir, errno);
cb8e9e
                 exit (1);
cb8e9e
         }
cb8e9e
 
cb8e9e
         if ((!ret) && (!S_ISDIR(buf.st_mode))) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, ENOENT,
cb8e9e
+                        GD_MSG_DIR_NOT_FOUND,
cb8e9e
                         "Provided working area %s is not a directory,"
cb8e9e
                         "exiting", workdir);
cb8e9e
                 exit (1);
cb8e9e
@@ -1363,7 +1405,8 @@ init (xlator_t *this)
cb8e9e
                 ret = mkdir_p (workdir, 0777, _gf_true);
cb8e9e
 
cb8e9e
                 if (-1 == ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                        gf_msg (this->name, GF_LOG_CRITICAL, errno,
cb8e9e
+                                GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                                 "Unable to create directory %s"
cb8e9e
                                 " ,errno = %d", workdir, errno);
cb8e9e
                         exit (1);
cb8e9e
@@ -1386,8 +1429,9 @@ init (xlator_t *this)
cb8e9e
         ret = glusterd_init_var_run_dirs (this, var_run_dir,
cb8e9e
                                       GLUSTERD_DEFAULT_SNAPS_BRICK_DIR);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL, "Unable to create "
cb8e9e
-                        "snap backend dir");
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, 0,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED, "Unable to create "
cb8e9e
+                        "snap backend folder");
cb8e9e
                 exit (1);
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1410,7 +1454,8 @@ init (xlator_t *this)
cb8e9e
         ret = gf_cmd_log_init (cmd_log_filename);
cb8e9e
 
cb8e9e
         if (ret == -1) {
cb8e9e
-                gf_log ("this->name", GF_LOG_CRITICAL,
cb8e9e
+                gf_msg ("this->name", GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_FILE_OP_FAILED,
cb8e9e
                         "Unable to create cmd log file %s", cmd_log_filename);
cb8e9e
                 exit (1);
cb8e9e
         }
cb8e9e
@@ -1420,7 +1465,8 @@ init (xlator_t *this)
cb8e9e
         ret = mkdir (storedir, 0777);
cb8e9e
 
cb8e9e
         if ((-1 == ret) && (errno != EEXIST)) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "Unable to create volume directory %s"
cb8e9e
                         " ,errno = %d", storedir, errno);
cb8e9e
                 exit (1);
cb8e9e
@@ -1431,7 +1477,8 @@ init (xlator_t *this)
cb8e9e
         ret = mkdir (storedir, 0777);
cb8e9e
 
cb8e9e
         if ((-1 == ret) && (errno != EEXIST)) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "Unable to create snaps directory %s"
cb8e9e
                         " ,errno = %d", storedir, errno);
cb8e9e
                 exit (1);
cb8e9e
@@ -1442,7 +1489,8 @@ init (xlator_t *this)
cb8e9e
         ret = mkdir (storedir, 0777);
cb8e9e
 
cb8e9e
         if ((-1 == ret) && (errno != EEXIST)) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "Unable to create peers directory %s"
cb8e9e
                         " ,errno = %d", storedir, errno);
cb8e9e
                 exit (1);
cb8e9e
@@ -1451,7 +1499,8 @@ init (xlator_t *this)
cb8e9e
         snprintf (storedir, PATH_MAX, "%s/bricks", DEFAULT_LOG_FILE_DIRECTORY);
cb8e9e
         ret = mkdir (storedir, 0777);
cb8e9e
         if ((-1 == ret) && (errno != EEXIST)) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "Unable to create logs directory %s"
cb8e9e
                         " ,errno = %d", storedir, errno);
cb8e9e
                 exit (1);
cb8e9e
@@ -1460,7 +1509,8 @@ init (xlator_t *this)
cb8e9e
         snprintf (storedir, PATH_MAX, "%s/nfs", workdir);
cb8e9e
         ret = mkdir (storedir, 0777);
cb8e9e
         if ((-1 == ret) && (errno != EEXIST)) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "Unable to create nfs directory %s"
cb8e9e
                         " ,errno = %d", storedir, errno);
cb8e9e
                 exit (1);
cb8e9e
@@ -1487,7 +1537,8 @@ init (xlator_t *this)
cb8e9e
         snprintf (storedir, PATH_MAX, "%s/glustershd", workdir);
cb8e9e
         ret = mkdir (storedir, 0777);
cb8e9e
         if ((-1 == ret) && (errno != EEXIST)) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "Unable to create glustershd directory %s"
cb8e9e
                         " ,errno = %d", storedir, errno);
cb8e9e
                 exit (1);
cb8e9e
@@ -1496,7 +1547,8 @@ init (xlator_t *this)
cb8e9e
         snprintf (storedir, PATH_MAX, "%s/quotad", workdir);
cb8e9e
         ret = mkdir (storedir, 0777);
cb8e9e
         if ((-1 == ret) && (errno != EEXIST)) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "Unable to create quotad directory %s"
cb8e9e
                         " ,errno = %d", storedir, errno);
cb8e9e
                 exit (1);
cb8e9e
@@ -1505,7 +1557,8 @@ init (xlator_t *this)
cb8e9e
         snprintf (storedir, PATH_MAX, "%s/groups", workdir);
cb8e9e
         ret = mkdir (storedir, 0777);
cb8e9e
         if ((-1 == ret) && (errno != EEXIST)) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_CREATE_DIR_FAILED,
cb8e9e
                         "Unable to create glustershd directory %s"
cb8e9e
                         " ,errno = %d", storedir, errno);
cb8e9e
                 exit (1);
cb8e9e
@@ -1516,14 +1569,16 @@ init (xlator_t *this)
cb8e9e
                 goto out;
cb8e9e
         rpc = rpcsvc_init (this, this->ctx, this->options, 64);
cb8e9e
         if (rpc == NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_RPC_INIT_FAIL,
cb8e9e
                         "failed to init rpc");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = rpcsvc_register_notify (rpc, glusterd_rpcsvc_notify, this);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_RPCSVC_REG_NOTIFY_RETURNED,
cb8e9e
                         "rpcsvc_register_notify returned %d", ret);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -1538,7 +1593,8 @@ init (xlator_t *this)
cb8e9e
                 ret = dict_set_str (this->options,
cb8e9e
                                     "transport.socket.own-thread", "off");
cb8e9e
                 if (ret != 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                GD_MSG_DICT_SET_FAILED,
cb8e9e
                                 "failed to clear own-thread");
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -1561,14 +1617,16 @@ init (xlator_t *this)
cb8e9e
 
cb8e9e
         ret = dict_get_str (this->options, "transport-type", &transport_type);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to get transport type");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_DICT_GET_FAILED, "Failed to get transport type");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         total_transport = rpc_transport_count (transport_type);
cb8e9e
         if (total_transport <= 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_RPC_TRANSPORT_COUNT_GET_FAIL,
cb8e9e
                         "failed to get total number of available tranpsorts");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -1576,12 +1634,14 @@ init (xlator_t *this)
cb8e9e
 
cb8e9e
         ret = rpcsvc_create_listeners (rpc, this->options, this->name);
cb8e9e
         if (ret < 1) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_RPC_LISTENER_CREATE_FAIL,
cb8e9e
                         "creation of listener failed");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         } else if (ret < total_transport) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_RPC_LISTENER_CREATE_FAIL,
cb8e9e
                         "creation of %d listeners failed, continuing with "
cb8e9e
                         "succeeded transport", (total_transport - ret));
cb8e9e
         }
cb8e9e
@@ -1641,20 +1701,22 @@ init (xlator_t *this)
cb8e9e
 
cb8e9e
          conf->base_port = GF_IANA_PRIV_PORTS_START;
cb8e9e
          if (dict_get_uint32(this->options, "base-port", &conf->base_port) == 0) {
cb8e9e
-                 gf_log (this->name, GF_LOG_INFO,
cb8e9e
-                         "base-port override: %d", conf->base_port);
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        GD_MSG_DICT_SET_FAILED,
cb8e9e
+                        "base-port override: %d", conf->base_port);
cb8e9e
          }
cb8e9e
 
cb8e9e
         /* Set option to run bricks on valgrind if enabled in glusterd.vol */
cb8e9e
         conf->valgrind = _gf_false;
cb8e9e
         ret = dict_get_str (this->options, "run-with-valgrind", &valgrind_str);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
+                gf_msg_debug (this->name, 0,
cb8e9e
                         "cannot get run-with-valgrind value");
cb8e9e
         }
cb8e9e
         if (valgrind_str) {
cb8e9e
                 if (gf_string2boolean (valgrind_str, &(conf->valgrind))) {
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, EINVAL,
cb8e9e
+                                GD_MSG_INVALID_ENTRY,
cb8e9e
                                 "run-with-valgrind value not a boolean string");
cb8e9e
                 }
cb8e9e
         }
cb8e9e
@@ -1675,7 +1737,8 @@ init (xlator_t *this)
cb8e9e
          */
cb8e9e
         ret = glusterd_hooks_create_hooks_directory (conf->workdir);
cb8e9e
         if (-1 == ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_CRITICAL,
cb8e9e
+                gf_msg (this->name, GF_LOG_CRITICAL, errno,
cb8e9e
+                        GD_MSG_DIR_OP_FAILED,
cb8e9e
                         "Unable to create hooks directory ");
cb8e9e
                 exit (1);
cb8e9e
         }
cb8e9e
@@ -1709,7 +1772,8 @@ init (xlator_t *this)
cb8e9e
          * */
cb8e9e
         ret = glusterd_restore_op_version (this);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        GD_MSG_OP_VERS_RESTORE_FAIL,
cb8e9e
                         "Failed to restore op_version");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e