diff options
| author | Nandaja Varma <nandaja.varma@gmail.com> | 2015-06-25 00:57:00 +0530 |
|---|---|---|
| committer | Kaushal M <kaushal@redhat.com> | 2015-06-26 23:56:09 -0700 |
| commit | 8708953fa3d9187997dc6d484dae663b4469c7ca (patch) | |
| tree | 38e9ef4db291ee0c1c50805bc08aee6fa3c7780f /xlators/mgmt/glusterd/src/glusterd-bitrot.c | |
| parent | 08586ee518de438fe2bbbaa74ae4c9a02a5d88cf (diff) | |
glusterd: Porting left out log messages to new framework
This is a backport of http://review.gluster.org/11388
cherry-picked from commit 23c1e6dc0fa86c014e1a8b6aa5729675f6d69017
>Change-Id: I70d40ae3b5f49a21e1b93f82885cd58fa2723647
>BUG: 1235538
>Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com>
Change-Id: I70d40ae3b5f49a21e1b93f82885cd58fa2723647
BUG: 1217722
Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com>
Reviewed-on: http://review.gluster.org/11422
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Anand Nekkunti <anekkunt@redhat.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-bitrot.c')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-bitrot.c | 87 |
1 files changed, 59 insertions, 28 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitrot.c b/xlators/mgmt/glusterd/src/glusterd-bitrot.c index 758a46b3834..897916ed860 100644 --- a/xlators/mgmt/glusterd/src/glusterd-bitrot.c +++ b/xlators/mgmt/glusterd/src/glusterd-bitrot.c @@ -26,6 +26,7 @@ #include "byte-order.h" #include "compat-errno.h" #include "glusterd-scrub-svc.h" +#include "glusterd-messages.h" #include <sys/wait.h> #include <dlfcn.h> @@ -75,7 +76,8 @@ __glusterd_handle_bitrot (rpcsvc_request_t *req) cli_req.dict.dict_len, &dict); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "failed to " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to " "unserialize req-buffer to dictionary"); snprintf (msg, sizeof (msg), "Unable to decode the " "command"); @@ -88,7 +90,8 @@ __glusterd_handle_bitrot (rpcsvc_request_t *req) ret = dict_get_str (dict, "volname", &volname); if (ret) { snprintf (msg, sizeof (msg), "Unable to get volume name"); - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name, " + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name, " "while handling bitrot command"); goto out; } @@ -96,7 +99,8 @@ __glusterd_handle_bitrot (rpcsvc_request_t *req) ret = dict_get_int32 (dict, "type", &type); if (ret) { snprintf (msg, sizeof (msg), "Unable to get type of command"); - gf_log (this->name, GF_LOG_ERROR, "Unable to get type of cmd, " + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get type of cmd, " "while handling bitrot command"); goto out; } @@ -143,7 +147,8 @@ glusterd_bitrot_scrub_throttle (glusterd_volinfo_t *volinfo, dict_t *dict, ret = dict_get_str (dict, "scrub-throttle-value", &scrub_throttle); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to fetch scrub-" + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to fetch scrub-" "throttle value"); goto out; } @@ -151,14 +156,17 @@ glusterd_bitrot_scrub_throttle (glusterd_volinfo_t *volinfo, dict_t *dict, option = gf_strdup (scrub_throttle); ret = dict_set_dynstr (volinfo->dict, key, option); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to set option %s", + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Failed to set option %s", key); goto out; } ret = glusterd_scrubsvc_reconfigure (); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to reconfigure scrub " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SCRUBSVC_RECONF_FAIL, + "Failed to reconfigure scrub " "services"); goto out; } @@ -181,7 +189,8 @@ glusterd_bitrot_scrub_freq (glusterd_volinfo_t *volinfo, dict_t *dict, ret = dict_get_str (dict, "scrub-frequency-value", &scrub_freq); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to fetch scrub-" + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to fetch scrub-" "freq value"); goto out; } @@ -189,14 +198,17 @@ glusterd_bitrot_scrub_freq (glusterd_volinfo_t *volinfo, dict_t *dict, option = gf_strdup (scrub_freq); ret = dict_set_dynstr (volinfo->dict, key, option); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to set option %s", + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Failed to set option %s", key); goto out; } ret = glusterd_scrubsvc_reconfigure (); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to reconfigure scrub " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SCRUBSVC_RECONF_FAIL, + "Failed to reconfigure scrub " "services"); goto out; } @@ -219,7 +231,8 @@ glusterd_bitrot_scrub (glusterd_volinfo_t *volinfo, dict_t *dict, ret = dict_get_str (dict, "scrub-value", &scrub_value); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to fetch scrub" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_GET_FAILED, "Unable to fetch scrub" "value"); goto out; } @@ -232,14 +245,17 @@ glusterd_bitrot_scrub (glusterd_volinfo_t *volinfo, dict_t *dict, ret = dict_set_dynstr (volinfo->dict, key, option); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to set option %s", + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Failed to set option %s", key); goto out; } ret = glusterd_scrubsvc_reconfigure (); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to reconfigure scrub " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SCRUBSVC_RECONF_FAIL, + "Failed to reconfigure scrub " "services"); goto out; } @@ -262,7 +278,8 @@ glusterd_bitrot_expiry_time (glusterd_volinfo_t *volinfo, dict_t *dict, ret = dict_get_uint32 (dict, "expiry-time", &expiry_time); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get bitrot expiry" + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get bitrot expiry" " timer value."); goto out; } @@ -271,14 +288,17 @@ glusterd_bitrot_expiry_time (glusterd_volinfo_t *volinfo, dict_t *dict, ret = dict_set_dynstr_with_alloc (volinfo->dict, key, dkey); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to set option %s", + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Failed to set option %s", key); goto out; } ret = glusterd_bitdsvc_reconfigure (); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to reconfigure bitrot" + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_BITDSVC_RECONF_FAIL, + "Failed to reconfigure bitrot" "services"); goto out; } @@ -315,7 +335,8 @@ glusterd_bitrot_enable (glusterd_volinfo_t *volinfo, char **op_errstr) ret = dict_set_dynstr_with_alloc (volinfo->dict, VKEY_FEATURES_BITROT, "on"); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "dict set failed"); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "dict set failed"); goto out; } @@ -323,7 +344,8 @@ glusterd_bitrot_enable (glusterd_volinfo_t *volinfo, char **op_errstr) ret = dict_set_dynstr_with_alloc (volinfo->dict, "features.scrub", "Active"); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to set option " + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Failed to set option " "features.scrub value"); goto out; } @@ -351,7 +373,8 @@ glusterd_bitrot_disable (glusterd_volinfo_t *volinfo, char **op_errstr) ret = dict_set_dynstr_with_alloc (volinfo->dict, VKEY_FEATURES_BITROT, "off"); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "dict set failed"); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "dict set failed"); goto out; } @@ -359,7 +382,8 @@ glusterd_bitrot_disable (glusterd_volinfo_t *volinfo, char **op_errstr) ret = dict_set_dynstr_with_alloc (volinfo->dict, "features.scrub", "Inactive"); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to set " + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_SET_FAILED, "Failed to set " "features.scrub value"); goto out; } @@ -461,7 +485,8 @@ glusterd_op_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } @@ -473,7 +498,8 @@ glusterd_op_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = dict_get_int32 (dict, "type", &type); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get type from " + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get type from " "dict"); goto out; } @@ -536,7 +562,8 @@ glusterd_op_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = glusterd_create_volfiles_and_notify_services (volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to re-create " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLFILE_CREATE_FAIL, "Unable to re-create " "volfiles"); ret = -1; goto out; @@ -545,7 +572,7 @@ glusterd_op_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT); if (ret) { - gf_log (this->name, GF_LOG_DEBUG, "Failed to store volinfo for " + gf_msg_debug (this->name, 0, "Failed to store volinfo for " "bitrot"); goto out; } @@ -577,7 +604,8 @@ glusterd_op_stage_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = dict_get_str (dict, "volname", &volname); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name"); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get volume name"); goto out; } @@ -596,7 +624,8 @@ glusterd_op_stage_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict) ret = dict_get_int32 (dict, "type", &type); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to get type for " + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to get type for " "operation"); *op_errstr = gf_strdup ("Staging stage failed for bitrot " @@ -619,7 +648,8 @@ glusterd_op_stage_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict) if (!ret) { ret = dict_get_str (dict, "scrub-value", &scrub_cmd); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to " + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_DICT_GET_FAILED, "Unable to " "get scrub-value"); *op_errstr = gf_strdup ("Staging failed for " "bitrot operation. " @@ -646,8 +676,9 @@ glusterd_op_stage_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict) out: if (ret && op_errstr && *op_errstr) - gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr); - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_OP_STAGE_BITROT_FAIL, "%s", *op_errstr); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } |
