7f4c2a
From 28802dc69d4b2110ae6a74d67356669d4e104157 Mon Sep 17 00:00:00 2001
7f4c2a
From: Nandaja Varma <nandaja.varma@gmail.com>
7f4c2a
Date: Thu, 30 Apr 2015 16:57:00 +0530
7f4c2a
Subject: [PATCH 092/101] quota/glusterd: porting to new logging framework
7f4c2a
7f4c2a
Change-Id: I879a181b6d6b97119a6b4fab90a12b8386635383
7f4c2a
BUG: 1231771
7f4c2a
Signed-off-by: Nandaja Varma <nvarma@redhat.com>
7f4c2a
Reviewed-on: https://code.engineering.redhat.com/gerrit/50910
7f4c2a
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
7f4c2a
Tested-by: Atin Mukherjee <amukherj@redhat.com>
7f4c2a
---
7f4c2a
 xlators/mgmt/glusterd/src/glusterd-quota.c |  159 +++++++++++++++++-----------
7f4c2a
 1 files changed, 97 insertions(+), 62 deletions(-)
7f4c2a
7f4c2a
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
7f4c2a
index 7238032..f4fc831 100644
7f4c2a
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
7f4c2a
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
7f4c2a
@@ -22,6 +22,7 @@
7f4c2a
 #include "glusterd-nfs-svc.h"
7f4c2a
 #include "glusterd-quotad-svc.h"
7f4c2a
 #include "glusterd-volgen.h"
7f4c2a
+#include "glusterd-messages.h"
7f4c2a
 #include "run.h"
7f4c2a
 #include "syscall.h"
7f4c2a
 #include "byte-order.h"
7f4c2a
@@ -142,7 +143,8 @@ __glusterd_handle_quota (rpcsvc_request_t *req)
7f4c2a
                                         cli_req.dict.dict_len,
7f4c2a
                                         &dict);
7f4c2a
                 if (ret < 0) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR, "failed to "
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to "
7f4c2a
                                     "unserialize req-buffer to dictionary");
7f4c2a
                         snprintf (msg, sizeof (msg), "Unable to decode the "
7f4c2a
                                   "command");
7f4c2a
@@ -155,7 +157,8 @@ __glusterd_handle_quota (rpcsvc_request_t *req)
7f4c2a
         ret = dict_get_str (dict, "volname", &volname);
7f4c2a
         if (ret) {
7f4c2a
                 snprintf (msg, sizeof (msg), "Unable to get volume name");
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name, "
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Unable to get volume name, "
7f4c2a
                         "while handling quota command");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
@@ -163,7 +166,8 @@ __glusterd_handle_quota (rpcsvc_request_t *req)
7f4c2a
         ret = dict_get_int32 (dict, "type", &type);
7f4c2a
         if (ret) {
7f4c2a
                 snprintf (msg, sizeof (msg), "Unable to get type of command");
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Unable to get type of cmd, "
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Unable to get type of cmd, "
7f4c2a
                         "while handling quota command");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
@@ -204,7 +208,9 @@ glusterd_check_if_quota_trans_enabled (glusterd_volinfo_t *volinfo)
7f4c2a
 
7f4c2a
         flag = glusterd_volinfo_get_boolean (volinfo, VKEY_FEATURES_QUOTA);
7f4c2a
         if (flag == -1) {
7f4c2a
-                gf_log ("", GF_LOG_ERROR, "failed to get the quota status");
7f4c2a
+                gf_msg ("glusterd", GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_QUOTA_GET_STAT_FAIL,
7f4c2a
+                        "failed to get the quota status");
7f4c2a
                 ret = -1;
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
@@ -230,7 +236,7 @@ glusterd_quota_initiate_fs_crawl (glusterd_conf_t *priv, char *volname,
7f4c2a
         runner_t                   runner            = {0};
7f4c2a
 
7f4c2a
         if (mkdtemp (mountdir) == NULL) {
7f4c2a
-                gf_log ("glusterd", GF_LOG_DEBUG,
7f4c2a
+                gf_msg_debug ("glusterd", 0,
7f4c2a
                         "failed to create a temporary mount directory");
7f4c2a
                 ret = -1;
7f4c2a
                 goto out;
7f4c2a
@@ -257,7 +263,8 @@ glusterd_quota_initiate_fs_crawl (glusterd_conf_t *priv, char *volname,
7f4c2a
         runner_end (&runner);
7f4c2a
 
7f4c2a
         if ((pid = fork ()) < 0) {
7f4c2a
-                gf_log ("glusterd", GF_LOG_WARNING, "fork from parent failed");
7f4c2a
+                gf_msg ("glusterd", GF_LOG_WARNING, 0,
7f4c2a
+                        GD_MSG_FORK_FAIL, "fork from parent failed");
7f4c2a
                 ret = -1;
7f4c2a
                 goto out;
7f4c2a
         } else if (pid == 0) {//first child
7f4c2a
@@ -270,8 +277,9 @@ glusterd_quota_initiate_fs_crawl (glusterd_conf_t *priv, char *volname,
7f4c2a
 
7f4c2a
                 ret = chdir (mountdir);
7f4c2a
                 if (ret == -1) {
7f4c2a
-                        gf_log ("glusterd", GF_LOG_WARNING, "chdir %s failed, "
7f4c2a
-                                "reason: %s", mountdir, strerror (errno));
7f4c2a
+                        gf_msg ("glusterd", GF_LOG_WARNING, errno,
7f4c2a
+                                GD_MSG_DIR_OP_FAILED, "chdir %s failed",
7f4c2a
+                                mountdir);
7f4c2a
                         exit (EXIT_FAILURE);
7f4c2a
                 }
7f4c2a
                 runinit (&runner);
7f4c2a
@@ -348,7 +356,8 @@ glusterd_quota_get_default_soft_limit (glusterd_volinfo_t *volinfo,
7f4c2a
 
7f4c2a
         ret = dict_set_dynstr (rsp_dict, "default-soft-limit", val);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Failed to set default "
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_SET_FAILED, "Failed to set default "
7f4c2a
                         "soft-limit into dict");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
@@ -445,14 +454,16 @@ glusterd_quota_enable (glusterd_volinfo_t *volinfo, char **op_errstr,
7f4c2a
         ret = dict_set_dynstr_with_alloc (volinfo->dict, VKEY_FEATURES_QUOTA,
7f4c2a
                                           "on");
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "dict set failed");
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, errno,
7f4c2a
+                        GD_MSG_DICT_SET_FAILED, "dict set failed");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
         ret = dict_set_dynstr_with_alloc (volinfo->dict,
7f4c2a
                                           VKEY_FEATURES_INODE_QUOTA, "on");
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "dict set failed");
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_SET_FAILED, "dict set failed");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -512,23 +523,25 @@ glusterd_quota_disable (glusterd_volinfo_t *volinfo, char **op_errstr,
7f4c2a
         ret = dict_set_dynstr_with_alloc (volinfo->dict, VKEY_FEATURES_QUOTA,
7f4c2a
                                           "off");
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "dict set failed");
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, errno,
7f4c2a
+                        GD_MSG_DICT_SET_FAILED, "dict set failed");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
         ret = dict_set_dynstr_with_alloc (volinfo->dict,
7f4c2a
                                           VKEY_FEATURES_INODE_QUOTA, "off");
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "dict set failed");
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_SET_FAILED, "dict set failed");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
         for (i = 0; quota_options [i]; i++) {
7f4c2a
                 ret = glusterd_volinfo_get (volinfo, quota_options[i], &value);
7f4c2a
                 if (ret) {
7f4c2a
-                        gf_log (this->name, GF_LOG_INFO, "failed to get option"
7f4c2a
-                                                         " %s",
7f4c2a
-                                                         quota_options[i]);
7f4c2a
+                        gf_msg (this->name, GF_LOG_INFO, 0,
7f4c2a
+                                GD_MSG_VOLINFO_GET_FAIL, "failed to get option"
7f4c2a
+                                " %s", quota_options[i]);
7f4c2a
                 } else {
7f4c2a
                 dict_del (volinfo->dict, quota_options[i]);
7f4c2a
                 }
7f4c2a
@@ -755,16 +768,17 @@ glusterd_copy_to_tmp_file (int src_fd, int dst_fd)
7f4c2a
 
7f4c2a
         while ((bytes_read = read (src_fd, (void *)&buf, entry_sz)) > 0) {
7f4c2a
                 if (bytes_read % 16 != 0) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR, "quota.conf "
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                GD_MSG_QUOTA_CONF_CORRUPT, "quota.conf "
7f4c2a
                                 "corrupted");
7f4c2a
                         ret = -1;
7f4c2a
                         goto out;
7f4c2a
                 }
7f4c2a
                 ret = write (dst_fd, (void *) buf, bytes_read);
7f4c2a
                 if (ret == -1) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR,
7f4c2a
-                                "write into quota.conf failed. Reason : %s",
7f4c2a
-                                strerror (errno));
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, errno,
7f4c2a
+                                GD_MSG_QUOTA_CONF_WRITE_FAIL,
7f4c2a
+                                "write into quota.conf failed.");
7f4c2a
                         goto out;
7f4c2a
                 }
7f4c2a
         }
7f4c2a
@@ -958,7 +972,8 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path,
7f4c2a
                         break;
7f4c2a
                 }
7f4c2a
                 if ((bytes_read % quota_conf_line_sz) != 0) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR, "quota.conf "
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                GD_MSG_QUOTA_CONF_CORRUPT, "quota.conf "
7f4c2a
                                 "corrupted");
7f4c2a
                         ret = -1;
7f4c2a
                         goto out;
7f4c2a
@@ -968,9 +983,9 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path,
7f4c2a
 
7f4c2a
                 ret = write (fd, (void *) buf, bytes_to_write);
7f4c2a
                 if (ret == -1) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR,
7f4c2a
-                                "write into quota.conf failed. Reason : %s",
7f4c2a
-                                strerror (errno));
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, errno,
7f4c2a
+                                GD_MSG_QUOTA_CONF_WRITE_FAIL,
7f4c2a
+                                "write into quota.conf failed.");
7f4c2a
                         goto out;
7f4c2a
                 }
7f4c2a
 
7f4c2a
@@ -993,10 +1008,9 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path,
7f4c2a
                         ret = glusterd_quota_conf_write_gfid (fd, gfid,
7f4c2a
                                                      GF_QUOTA_CONF_TYPE_USAGE);
7f4c2a
                         if (ret == -1) {
7f4c2a
-                                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
-                                        "write into quota.conf failed. "
7f4c2a
-                                        "Reason : %s",
7f4c2a
-                                        strerror (errno));
7f4c2a
+                                gf_msg (this->name, GF_LOG_ERROR, errno,
7f4c2a
+                                        GD_MSG_QUOTA_CONF_WRITE_FAIL,
7f4c2a
+                                        "write into quota.conf failed. ");
7f4c2a
                                 goto out;
7f4c2a
                         }
7f4c2a
                         modified = _gf_true;
7f4c2a
@@ -1007,10 +1021,9 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path,
7f4c2a
                         ret = glusterd_quota_conf_write_gfid (fd, gfid,
7f4c2a
                                                    GF_QUOTA_CONF_TYPE_OBJECTS);
7f4c2a
                         if (ret == -1) {
7f4c2a
-                                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
-                                        "write into quota.conf failed. "
7f4c2a
-                                        "Reason : %s",
7f4c2a
-                                        strerror (errno));
7f4c2a
+                                gf_msg (this->name, GF_LOG_ERROR, errno,
7f4c2a
+                                        GD_MSG_QUOTA_CONF_WRITE_FAIL,
7f4c2a
+                                        "write into quota.conf failed. ");
7f4c2a
                                 goto out;
7f4c2a
                         }
7f4c2a
                         modified = _gf_true;
7f4c2a
@@ -1060,7 +1073,8 @@ out:
7f4c2a
                 if (modified) {
7f4c2a
                         ret = glusterd_compute_cksum (volinfo, _gf_true);
7f4c2a
                         if (ret) {
7f4c2a
-                                gf_log (this->name, GF_LOG_ERROR, "Failed to "
7f4c2a
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                        GD_MSG_CKSUM_COMPUTE_FAIL, "Failed to "
7f4c2a
                                         "compute cksum for quota conf file");
7f4c2a
                                 return ret;
7f4c2a
                         }
7f4c2a
@@ -1068,7 +1082,9 @@ out:
7f4c2a
                         ret = glusterd_store_save_quota_version_and_cksum
7f4c2a
                                                                       (volinfo);
7f4c2a
                         if (ret)
7f4c2a
-                                gf_log (this->name, GF_LOG_ERROR, "Failed to "
7f4c2a
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                        GD_MSG_VERS_CKSUM_STORE_FAIL,
7f4c2a
+                                        "Failed to "
7f4c2a
                                         "store quota version and cksum");
7f4c2a
                 }
7f4c2a
         }
7f4c2a
@@ -1103,7 +1119,8 @@ glusterd_quota_limit_usage (glusterd_volinfo_t *volinfo, dict_t *dict,
7f4c2a
 
7f4c2a
         ret = dict_get_str (dict, "path", &path);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Unable to fetch path");
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Unable to fetch path");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
         ret = gf_canonicalize_path (path);
7f4c2a
@@ -1112,14 +1129,16 @@ glusterd_quota_limit_usage (glusterd_volinfo_t *volinfo, dict_t *dict,
7f4c2a
 
7f4c2a
         ret = dict_get_str (dict, "hard-limit", &hard_limit);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Unable to fetch hard limit");
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Unable to fetch hard limit");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
         if (dict_get (dict, "soft-limit")) {
7f4c2a
                 ret = dict_get_str (dict, "soft-limit", &soft_limit);
7f4c2a
                 if (ret) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR, "Unable to fetch "
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                GD_MSG_DICT_GET_FAILED, "Unable to fetch "
7f4c2a
                                 "soft limit");
7f4c2a
                         goto out;
7f4c2a
                 }
7f4c2a
@@ -1143,7 +1162,8 @@ glusterd_quota_limit_usage (glusterd_volinfo_t *volinfo, dict_t *dict,
7f4c2a
 
7f4c2a
         ret = dict_get_str (dict, "gfid", &gfid_str);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Failed to get gfid of path "
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Failed to get gfid of path "
7f4c2a
                         "%s", path);
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
@@ -1234,7 +1254,8 @@ glusterd_quota_remove_limits (glusterd_volinfo_t *volinfo, dict_t *dict,
7f4c2a
 
7f4c2a
         ret = dict_get_str (dict, "path", &path);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Unable to fetch path");
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Unable to fetch path");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1251,7 +1272,8 @@ glusterd_quota_remove_limits (glusterd_volinfo_t *volinfo, dict_t *dict,
7f4c2a
 
7f4c2a
         ret = dict_get_str (dict, "gfid", &gfid_str);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Failed to get gfid of path "
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Failed to get gfid of path "
7f4c2a
                         "%s", path);
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
@@ -1289,14 +1311,16 @@ glusterd_set_quota_option (glusterd_volinfo_t *volinfo, dict_t *dict,
7f4c2a
 
7f4c2a
         ret = dict_get_str (dict, "value", &value);
7f4c2a
         if(ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Option value absent.");
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Option value absent.");
7f4c2a
                 return -1;
7f4c2a
         }
7f4c2a
 
7f4c2a
         option = gf_strdup (value);
7f4c2a
         ret = dict_set_dynstr (volinfo->dict, key, option);
7f4c2a
         if(ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Failed to set option %s",
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Failed to set option %s",
7f4c2a
                         key);
7f4c2a
                 return -1;
7f4c2a
         }
7f4c2a
@@ -1358,7 +1382,8 @@ glusterd_op_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
7f4c2a
 
7f4c2a
         ret = dict_get_str (dict, "volname", &volname);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name");
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Unable to get volume name");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1469,7 +1494,8 @@ glusterd_op_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
7f4c2a
 
7f4c2a
         ret = glusterd_create_volfiles_and_notify_services (volinfo);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Unable to re-create "
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_VOLFILE_CREATE_FAIL, "Unable to re-create "
7f4c2a
                                                   "volfiles");
7f4c2a
                 ret = -1;
7f4c2a
                 goto out;
7f4c2a
@@ -1520,14 +1546,16 @@ glusterd_get_gfid_from_brick (dict_t *dict, glusterd_volinfo_t *volinfo,
7f4c2a
 
7f4c2a
         ret = dict_get_str (dict, "path", &path);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Failed to get path");
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Failed to get path");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
         cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
7f4c2a
                 ret = glusterd_resolve_brick (brickinfo);
7f4c2a
                 if (ret) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR, FMTSTR_RESOLVE_BRICK,
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                GD_MSG_RESOLVE_BRICK_FAIL, FMTSTR_RESOLVE_BRICK,
7f4c2a
                                 brickinfo->hostname, brickinfo->path);
7f4c2a
                         goto out;
7f4c2a
                 }
7f4c2a
@@ -1543,18 +1571,18 @@ glusterd_get_gfid_from_brick (dict_t *dict, glusterd_volinfo_t *volinfo,
7f4c2a
 
7f4c2a
                 ret = gf_lstat_dir (backend_path, NULL);
7f4c2a
                 if (ret) {
7f4c2a
-                        gf_log (this->name, GF_LOG_INFO, "Failed to find "
7f4c2a
-                                "directory %s. Reason : %s", backend_path,
7f4c2a
-                                strerror (errno));
7f4c2a
+                        gf_msg (this->name, GF_LOG_INFO, errno,
7f4c2a
+                                GD_MSG_DIR_OP_FAILED, "Failed to find "
7f4c2a
+                                "directory %s.", backend_path);
7f4c2a
                         ret = 0;
7f4c2a
                         continue;
7f4c2a
                 }
7f4c2a
                 ret = sys_lgetxattr (backend_path, GFID_XATTR_KEY, gfid, 16);
7f4c2a
                 if (ret < 0) {
7f4c2a
-                        gf_log (this->name, GF_LOG_INFO, "Failed to get "
7f4c2a
-                                "extended attribute %s for directory %s. "
7f4c2a
-                                "Reason : %s", GFID_XATTR_KEY, backend_path,
7f4c2a
-                                     strerror (errno));
7f4c2a
+                        gf_msg (this->name, GF_LOG_INFO, errno,
7f4c2a
+                                GD_MSG_SETXATTR_FAIL, "Failed to get "
7f4c2a
+                                "extended attribute %s for directory %s. ",
7f4c2a
+                                GFID_XATTR_KEY, backend_path);
7f4c2a
                         ret = 0;
7f4c2a
                         continue;
7f4c2a
                 }
7f4c2a
@@ -1568,7 +1596,8 @@ glusterd_get_gfid_from_brick (dict_t *dict, glusterd_volinfo_t *volinfo,
7f4c2a
 
7f4c2a
                 ret = dict_set_dynstr (rsp_dict, key, gfid_str);
7f4c2a
                 if (ret) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR, "Failed to place "
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                GD_MSG_DICT_SET_FAILED, "Failed to place "
7f4c2a
                                 "gfid of %s in dict", backend_path);
7f4c2a
                         GF_FREE (gfid_str);
7f4c2a
                         goto out;
7f4c2a
@@ -1578,7 +1607,8 @@ glusterd_get_gfid_from_brick (dict_t *dict, glusterd_volinfo_t *volinfo,
7f4c2a
 
7f4c2a
         ret = dict_set_int32 (rsp_dict, "count", count);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Failed to set count");
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_SET_FAILED, "Failed to set count");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1620,12 +1650,14 @@ _glusterd_validate_quota_opts (dict_t *dict, int type, char **errstr)
7f4c2a
         opt = xlator_volume_option_get_list (&opt_list, key);
7f4c2a
         if (!opt) {
7f4c2a
                 ret = -1;
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Unknown option: %s", key);
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
7f4c2a
+                        GD_MSG_UNKNOWN_KEY, "Unknown option: %s", key);
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
         ret = dict_get_str (dict, "value", &value);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Value not found for key %s",
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Value not found for key %s",
7f4c2a
                         key);
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
@@ -1664,7 +1696,8 @@ glusterd_op_stage_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
7f4c2a
 
7f4c2a
         ret = dict_get_str (dict, "volname", &volname);
7f4c2a
         if (ret) {
7f4c2a
-                gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name");
7f4c2a
+                gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                        GD_MSG_DICT_GET_FAILED, "Unable to get volume name");
7f4c2a
                 goto out;
7f4c2a
         }
7f4c2a
 
7f4c2a
@@ -1742,7 +1775,8 @@ glusterd_op_stage_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
7f4c2a
         case GF_QUOTA_OPTION_TYPE_LIMIT_USAGE:
7f4c2a
                 ret = dict_get_str (dict, "hard-limit", &hard_limit_str);
7f4c2a
                 if (ret) {
7f4c2a
-                        gf_log (this->name, GF_LOG_ERROR,
7f4c2a
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
7f4c2a
+                                GD_MSG_DICT_GET_FAILED,
7f4c2a
                                 "Faild to get hard-limit from dict");
7f4c2a
                         goto out;
7f4c2a
                 }
7f4c2a
@@ -1753,9 +1787,10 @@ glusterd_op_stage_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
7f4c2a
                                         "value out of range (0 - %"PRId64
7f4c2a
                                         "): %s", hard_limit_str);
7f4c2a
                         else
7f4c2a
-                                gf_log (this->name, GF_LOG_ERROR,
7f4c2a
+                                gf_msg (this->name, GF_LOG_ERROR, errno,
7f4c2a
+                                        GD_MSG_CONVERSION_FAILED,
7f4c2a
                                         "Failed to convert hard-limit "
7f4c2a
-                                        "from string to bytes");
7f4c2a
+                                        "string to value");
7f4c2a
                         goto out;
7f4c2a
                 }
7f4c2a
                 get_gfid = _gf_true;
7f4c2a
@@ -1794,7 +1829,7 @@ glusterd_op_stage_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
7f4c2a
  out:
7f4c2a
         if (ret && op_errstr && *op_errstr)
7f4c2a
                 gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
7f4c2a
-        gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
7f4c2a
+        gf_msg_debug (this->name, 0, "Returning %d", ret);
7f4c2a
 
7f4c2a
          return ret;
7f4c2a
 }
7f4c2a
-- 
7f4c2a
1.7.1
7f4c2a