summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorNandaja Varma <nandaja.varma@gmail.com>2015-06-25 00:57:00 +0530
committerKaushal M <kaushal@redhat.com>2015-06-26 23:56:09 -0700
commit8708953fa3d9187997dc6d484dae663b4469c7ca (patch)
tree38e9ef4db291ee0c1c50805bc08aee6fa3c7780f /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parent08586ee518de438fe2bbbaa74ae4c9a02a5d88cf (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-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c80
1 files changed, 53 insertions, 27 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 06d9923ea14..492b3672869 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -235,7 +235,8 @@ glusterd_get_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo)
GF_ASSERT (priv);
if (!txn_id || !opinfo) {
- gf_log_callingfn (this->name, GF_LOG_ERROR,
+ gf_msg_callingfn (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_ID_GET_FAIL,
"Empty transaction id or opinfo received.");
ret = -1;
goto out;
@@ -245,7 +246,8 @@ glusterd_get_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo)
uuid_utoa (*txn_id),
(void **) &opinfo_obj);
if (ret) {
- gf_log_callingfn (this->name, GF_LOG_ERROR,
+ gf_msg_callingfn (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED,
"Unable to get transaction opinfo "
"for transaction ID : %s",
uuid_utoa (*txn_id));
@@ -278,7 +280,8 @@ glusterd_set_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo)
GF_ASSERT (priv);
if (!txn_id) {
- gf_log_callingfn (this->name, GF_LOG_ERROR,
+ gf_msg_callingfn (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_ID_GET_FAIL,
"Empty transaction id received.");
ret = -1;
goto out;
@@ -299,7 +302,8 @@ glusterd_set_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo)
uuid_utoa (*txn_id), opinfo_obj,
sizeof(glusterd_txn_opinfo_obj));
if (ret) {
- gf_log_callingfn (this->name, GF_LOG_ERROR,
+ gf_msg_callingfn (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
"Unable to set opinfo for transaction"
" ID : %s", uuid_utoa (*txn_id));
goto out;
@@ -784,7 +788,8 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr)
snprintf (errstr, PATH_MAX,
"Invalid option(%s). Valid options "
"are 'enable' and 'disable'", value);
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s", errstr);
ret = -1;
goto out;
}
@@ -798,7 +803,8 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr)
snprintf (errstr, PATH_MAX,
"Shared storage volume("GLUSTER_SHARED_STORAGE
") already exists.");
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_ALREADY_EXIST, "%s", errstr);
ret = -1;
goto out;
}
@@ -807,7 +813,8 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr)
if (ret) {
snprintf (errstr, PATH_MAX,
"Failed to calculate number of connected peers.");
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEER_COUNT_GET_FAIL, "%s", errstr);
goto out;
}
@@ -815,7 +822,8 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr)
snprintf (errstr, PATH_MAX,
"More than one node should "
"be up/present in the cluster to enable this option");
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_INSUFFICIENT_UP_NODES, "%s", errstr);
ret = -1;
goto out;
}
@@ -1168,7 +1176,8 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
ret = glusterd_validate_shared_storage (key, value, errstr);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SHARED_STRG_VOL_OPT_VALIDATE_FAIL,
"Failed to validate shared "
"storage volume options");
goto out;
@@ -1433,7 +1442,8 @@ out:
GF_FREE (key_fixed);
if (msg[0] != '\0') {
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_STAGE_RESET_VOL_FAIL, "%s", msg);
*op_errstr = gf_strdup (msg);
}
@@ -1762,7 +1772,8 @@ glusterd_op_stage_stats_volume (dict_t *dict, char **op_errstr)
ret = 0;
out:
if (msg[0] != '\0') {
- gf_log ("glusterd", GF_LOG_ERROR, "%s", msg);
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_OP_STAGE_STATS_VOL_FAIL, "%s", msg);
*op_errstr = gf_strdup (msg);
}
gf_msg_debug ("glusterd", 0, "Returning %d", ret);
@@ -1940,11 +1951,13 @@ glusterd_op_reset_all_volume_options (xlator_t *this, dict_t *dict)
if (option) {
ret = tear_down_cluster();
if (ret == -1)
- gf_log (THIS->name, GF_LOG_WARNING,
+ gf_msg (THIS->name, GF_LOG_WARNING, errno,
+ GD_MSG_DICT_GET_FAILED,
"Could not tear down NFS-Ganesha cluster");
ret = stop_ganesha (&op_errstr);
if (ret)
- gf_log (THIS->name, GF_LOG_WARNING,
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ GD_MSG_NFS_GNS_STOP_FAIL,
"Could not stop NFS-Ganesha service");
}
@@ -2059,7 +2072,8 @@ glusterd_op_reset_volume (dict_t *dict, char **op_rspstr)
if (ret) {
ret = ganesha_manage_export (dict, "off", op_rspstr);
if (ret) {
- gf_log (THIS->name, GF_LOG_WARNING,
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ GD_MSG_NFS_GNS_RESET_FAIL,
"Could not reset ganesha.enable key");
ret = 0;
}
@@ -2170,7 +2184,8 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,
ret = glusterd_set_shared_storage (dict, key, value, op_errstr);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SHARED_STRG_SET_FAIL,
"Failed to set shared storage option");
goto out;
}
@@ -2287,7 +2302,8 @@ glusterd_set_shared_storage (dict_t *dict, char *key, char *value,
"storage brick(%s). "
"Reason: %s", ss_brick_path,
strerror (errno));
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DIR_OP_FAILED, "%s", errstr);
ret = -1;
goto out;
}
@@ -2299,7 +2315,8 @@ glusterd_set_shared_storage (dict_t *dict, char *key, char *value,
"storage brick(%s). "
"Reason: %s", ss_brick_path,
strerror (errno));
- gf_log (this->name, GF_LOG_ERROR, "%s", errstr);
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_CREATE_DIR_FAILED, "%s", errstr);
goto out;
}
@@ -2315,7 +2332,8 @@ glusterd_set_shared_storage (dict_t *dict, char *key, char *value,
ret = dict_set_dynstr_with_alloc (dict, "hooks_args", hooks_args);
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"
" hooks_args in dict.");
goto out;
}
@@ -2437,7 +2455,8 @@ glusterd_op_set_volume (dict_t *dict, char **errstr)
}
if (strcmp (key, "config.transport") == 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_VOL_TRANSPORT_TYPE_CHANGE,
"changing transport-type for volume %s to %s",
volname, value);
ret = 0;
@@ -3590,7 +3609,8 @@ glusterd_op_ac_lock (glusterd_op_sm_event_t *event, void *ctx)
ret = glusterd_mgmt_v3_lock (globalname, lock_ctx->uuid,
&op_errno, "global");
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_LOCK_GET_FAIL,
"Unable to acquire lock for %s",
globalname);
@@ -3653,7 +3673,8 @@ glusterd_op_ac_unlock (glusterd_op_sm_event_t *event, void *ctx)
ret = glusterd_mgmt_v3_unlock (globalname, lock_ctx->uuid,
"global");
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_UNLOCK_FAIL,
"Unable to release lock for %s",
globalname);
@@ -3745,7 +3766,8 @@ glusterd_dict_set_volid (dict_t *dict, char *volname, char **op_errstr)
}
out:
if (msg[0] != '\0') {
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_ID_SET_FAIL, "%s", msg);
*op_errstr = gf_strdup (msg);
}
return ret;
@@ -3985,7 +4007,8 @@ glusterd_op_build_payload (dict_t **req, char **op_errstr, dict_t *op_ctx)
if (do_common) {
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, -ret,
+ GD_MSG_DICT_GET_FAILED,
"volname is not present in "
"operation ctx");
goto out;
@@ -5641,14 +5664,15 @@ glusterd_bricks_select_remove_brick (dict_t *dict, char **op_errstr,
ret = dict_get_int32 (dict, "count", &count);
if (ret) {
- gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ gf_msg ("glusterd", GF_LOG_ERROR, -ret,
GD_MSG_DICT_GET_FAILED, "Unable to get count");
goto out;
}
ret = dict_get_int32 (dict, "command", &command);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR, "Unable to get command");
+ gf_msg ("glusterd", GF_LOG_ERROR, -ret,
+ GD_MSG_DICT_GET_FAILED, "Unable to get command");
goto out;
}
@@ -6555,7 +6579,8 @@ glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
ret = 0;
} else if ((cmd & GF_CLI_STATUS_BITD) != 0) {
if (!priv->bitd_svc.online) {
- gf_log (this->name, GF_LOG_ERROR, "Bitrot is not "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BITROT_NOT_RUNNING, "Bitrot is not "
"running");
ret = -1;
goto out;
@@ -6574,7 +6599,8 @@ glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
ret = 0;
} else if ((cmd & GF_CLI_STATUS_SCRUB) != 0) {
if (!priv->scrub_svc.online) {
- gf_log (this->name, GF_LOG_ERROR, "Scrubber is not "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SCRUBBER_NOT_RUNNING, "Scrubber is not "
"running");
ret = -1;
goto out;