summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorNandaja Varma <nandaja.varma@gmail.com>2015-03-05 13:41:10 +0530
committerKaushal M <kaushal@redhat.com>2015-05-04 22:14:29 -0700
commit6d7428d2018c061ca2791443bd90980f9755ded3 (patch)
tree9d705ed391ab0e546528b21a2c48c1f0a7df9d2f /xlators/mgmt/glusterd
parente6f2472d2434ab43a30720ef4de2e0abc0a3f4ac (diff)
mgmt/glusterd: Porting messages to new logging framework
Change-Id: I25f3536446798ea1cffd6b5dfbb3d2398766fcf3 BUG: 1194640 Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com> Reviewed-on: http://review.gluster.org/9808 Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c158
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt.c218
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c21
5 files changed, 258 insertions, 150 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c
index 662aba6e724..da8c909a14b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c
@@ -14,6 +14,7 @@
#include "glusterd-conn-mgmt.h"
#include "glusterd-conn-helper.h"
#include "glusterd-utils.h"
+#include "glusterd-messages.h"
int
glusterd_conn_init (glusterd_conn_t *conn, char *sockpath,
@@ -30,7 +31,8 @@ glusterd_conn_init (glusterd_conn_t *conn, char *sockpath,
svc = glusterd_conn_get_svc_object (conn);
if (!svc) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get the service");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SVC_GET_FAIL, "Failed to get the service");
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
index 859690eee65..db5a19bf675 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
@@ -19,6 +19,7 @@
#include "glusterd-locks.h"
#include "glusterd-mgmt.h"
#include "glusterd-op-sm.h"
+#include "glusterd-messages.h"
static int
glusterd_mgmt_v3_null (rpcsvc_request_t *req)
@@ -47,7 +48,7 @@ glusterd_mgmt_v3_lock_send_resp (rpcsvc_request_t *req, int32_t status)
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_v3_lock_rsp);
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Responded to mgmt_v3 lock, ret: %d", ret);
return ret;
@@ -70,13 +71,14 @@ glusterd_synctasked_mgmt_v3_lock (rpcsvc_request_t *req,
/* Trying to acquire multiple mgmt_v3 locks */
ret = glusterd_multiple_mgmt_v3_lock (ctx->dict, ctx->uuid);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_LOCK_GET_FAIL,
"Failed to acquire mgmt_v3 locks for %s",
uuid_utoa (ctx->uuid));
ret = glusterd_mgmt_v3_lock_send_resp (req, ret);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -98,7 +100,8 @@ glusterd_op_state_machine_mgmt_v3_lock (rpcsvc_request_t *req,
ret = glusterd_set_txn_opinfo (&lock_req->txn_id, &txn_op_info);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OPINFO_SET_FAIL,
"Unable to set transaction's opinfo");
goto out;
}
@@ -106,14 +109,15 @@ glusterd_op_state_machine_mgmt_v3_lock (rpcsvc_request_t *req,
ret = glusterd_op_sm_inject_event (GD_OP_EVENT_LOCK,
&lock_req->txn_id, ctx);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_EVENT_LOCK_FAIL,
"Failed to inject event GD_OP_EVENT_LOCK");
out:
glusterd_friend_sm ();
glusterd_op_sm ();
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -134,17 +138,19 @@ glusterd_handle_mgmt_v3_lock_fn (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &lock_req,
(xdrproc_t)xdr_gd1_mgmt_v3_lock_req);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to decode lock "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode lock "
"request received from peer");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "Received mgmt_v3 lock req "
+ gf_msg_debug (this->name, 0, "Received mgmt_v3 lock req "
"from uuid: %s", uuid_utoa (lock_req.uuid));
if (glusterd_peerinfo_find_by_uuid (lock_req.uuid) == NULL) {
- gf_log (this->name, GF_LOG_WARNING, "%s doesn't "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_PEER_NOT_FOUND, "%s doesn't "
"belong to the cluster. Ignoring request.",
uuid_utoa (lock_req.uuid));
ret = -1;
@@ -169,7 +175,8 @@ glusterd_handle_mgmt_v3_lock_fn (rpcsvc_request_t *req)
ret = dict_unserialize (lock_req.dict.dict_val,
lock_req.dict.dict_len, &ctx->dict);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to unserialize the dictionary");
goto out;
}
@@ -179,7 +186,8 @@ glusterd_handle_mgmt_v3_lock_fn (rpcsvc_request_t *req)
if (is_synctasked) {
ret = glusterd_synctasked_mgmt_v3_lock (req, &lock_req, ctx);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_LOCK_GET_FAIL,
"Failed to acquire mgmt_v3_locks");
/* Ignore the return code, as it shouldn't be propagated
* from the handler function so as to avoid double
@@ -200,7 +208,8 @@ glusterd_handle_mgmt_v3_lock_fn (rpcsvc_request_t *req)
ret = glusterd_op_state_machine_mgmt_v3_lock (req, &lock_req,
ctx);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_LOCK_GET_FAIL,
"Failed to acquire mgmt_v3_locks");
}
@@ -215,7 +224,7 @@ out:
free (lock_req.dict.dict_val);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -243,7 +252,8 @@ glusterd_mgmt_v3_pre_validate_send_resp (rpcsvc_request_t *req,
ret = dict_allocate_and_serialize (rsp_dict, &rsp.dict.dict_val,
&rsp.dict.dict_len);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SERL_LENGTH_GET_FAIL,
"failed to get serialized length of dict");
goto out;
}
@@ -253,7 +263,7 @@ glusterd_mgmt_v3_pre_validate_send_resp (rpcsvc_request_t *req,
GF_FREE (rsp.dict.dict_val);
out:
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Responded to pre validation, ret: %d", ret);
return ret;
}
@@ -275,7 +285,8 @@ glusterd_handle_pre_validate_fn (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &op_req,
(xdrproc_t)xdr_gd1_mgmt_v3_pre_val_req);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL,
"Failed to decode pre validation "
"request received from peer");
req->rpc_err = GARBAGE_ARGS;
@@ -283,7 +294,8 @@ glusterd_handle_pre_validate_fn (rpcsvc_request_t *req)
}
if (glusterd_peerinfo_find_by_uuid (op_req.uuid) == NULL) {
- gf_log (this->name, GF_LOG_WARNING, "%s doesn't "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_PEER_NOT_FOUND, "%s doesn't "
"belong to the cluster. Ignoring request.",
uuid_utoa (op_req.uuid));
ret = -1;
@@ -297,14 +309,16 @@ glusterd_handle_pre_validate_fn (rpcsvc_request_t *req)
ret = dict_unserialize (op_req.dict.dict_val,
op_req.dict.dict_len, &dict);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to unserialize the dictionary");
goto out;
}
rsp_dict = dict_new ();
if (!rsp_dict) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_CREATE_FAIL,
"Failed to get new dictionary");
return -1;
}
@@ -313,7 +327,8 @@ glusterd_handle_pre_validate_fn (rpcsvc_request_t *req)
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PRE_VALIDATION_FAIL,
"Pre Validation failed on operation %s",
gd_op_list[op_req.op]);
}
@@ -322,7 +337,8 @@ glusterd_handle_pre_validate_fn (rpcsvc_request_t *req)
ret, op_errstr,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_OP_RESP_FAIL,
"Failed to send Pre Validation "
"response for operation %s",
gd_op_list[op_req.op]);
@@ -369,7 +385,8 @@ glusterd_mgmt_v3_brick_op_send_resp (rpcsvc_request_t *req,
ret = dict_allocate_and_serialize (rsp_dict, &rsp.dict.dict_val,
&rsp.dict.dict_len);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SERL_LENGTH_GET_FAIL,
"failed to get serialized length of dict");
goto out;
}
@@ -379,7 +396,7 @@ glusterd_mgmt_v3_brick_op_send_resp (rpcsvc_request_t *req,
GF_FREE (rsp.dict.dict_val);
out:
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Responded to brick op, ret: %d", ret);
return ret;
}
@@ -401,14 +418,16 @@ glusterd_handle_brick_op_fn (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &op_req,
(xdrproc_t)xdr_gd1_mgmt_v3_brick_op_req);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to decode brick op "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode brick op "
"request received from peer");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
if (glusterd_peerinfo_find_by_uuid (op_req.uuid) == NULL) {
- gf_log (this->name, GF_LOG_WARNING, "%s doesn't "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_PEER_NOT_FOUND, "%s doesn't "
"belong to the cluster. Ignoring request.",
uuid_utoa (op_req.uuid));
ret = -1;
@@ -422,14 +441,16 @@ glusterd_handle_brick_op_fn (rpcsvc_request_t *req)
ret = dict_unserialize (op_req.dict.dict_val,
op_req.dict.dict_len, &dict);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to unserialize the dictionary");
goto out;
}
rsp_dict = dict_new ();
if (!rsp_dict) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_CREATE_FAIL,
"Failed to get new dictionary");
return -1;
}
@@ -438,7 +459,8 @@ glusterd_handle_brick_op_fn (rpcsvc_request_t *req)
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_OP_FAIL,
"Brick Op failed on operation %s",
gd_op_list[op_req.op]);
}
@@ -447,7 +469,8 @@ glusterd_handle_brick_op_fn (rpcsvc_request_t *req)
ret, op_errstr,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PRE_VALD_RESP_FAIL,
"Failed to send brick op "
"response for operation %s",
gd_op_list[op_req.op]);
@@ -494,7 +517,8 @@ glusterd_mgmt_v3_commit_send_resp (rpcsvc_request_t *req,
ret = dict_allocate_and_serialize (rsp_dict, &rsp.dict.dict_val,
&rsp.dict.dict_len);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SERL_LENGTH_GET_FAIL,
"failed to get serialized length of dict");
goto out;
}
@@ -504,7 +528,7 @@ glusterd_mgmt_v3_commit_send_resp (rpcsvc_request_t *req,
GF_FREE (rsp.dict.dict_val);
out:
- gf_log (this->name, GF_LOG_DEBUG, "Responded to commit, ret: %d", ret);
+ gf_msg_debug (this->name, 0, "Responded to commit, ret: %d", ret);
return ret;
}
@@ -525,14 +549,16 @@ glusterd_handle_commit_fn (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &op_req,
(xdrproc_t)xdr_gd1_mgmt_v3_commit_req);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to decode commit "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode commit "
"request received from peer");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
if (glusterd_peerinfo_find_by_uuid (op_req.uuid) == NULL) {
- gf_log (this->name, GF_LOG_WARNING, "%s doesn't "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_PEER_NOT_FOUND, "%s doesn't "
"belong to the cluster. Ignoring request.",
uuid_utoa (op_req.uuid));
ret = -1;
@@ -546,14 +572,16 @@ glusterd_handle_commit_fn (rpcsvc_request_t *req)
ret = dict_unserialize (op_req.dict.dict_val,
op_req.dict.dict_len, &dict);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to unserialize the dictionary");
goto out;
}
rsp_dict = dict_new ();
if (!rsp_dict) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_CREATE_FAIL,
"Failed to get new dictionary");
return -1;
}
@@ -562,7 +590,8 @@ glusterd_handle_commit_fn (rpcsvc_request_t *req)
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_COMMIT_OP_FAIL,
"commit failed on operation %s",
gd_op_list[op_req.op]);
}
@@ -571,7 +600,8 @@ glusterd_handle_commit_fn (rpcsvc_request_t *req)
ret, op_errstr,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_OP_RESP_FAIL,
"Failed to send commit "
"response for operation %s",
gd_op_list[op_req.op]);
@@ -618,7 +648,8 @@ glusterd_mgmt_v3_post_validate_send_resp (rpcsvc_request_t *req,
ret = dict_allocate_and_serialize (rsp_dict, &rsp.dict.dict_val,
&rsp.dict.dict_len);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SERL_LENGTH_GET_FAIL,
"failed to get serialized length of dict");
goto out;
}
@@ -628,7 +659,7 @@ glusterd_mgmt_v3_post_validate_send_resp (rpcsvc_request_t *req,
GF_FREE (rsp.dict.dict_val);
out:
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Responded to post validation, ret: %d", ret);
return ret;
}
@@ -650,7 +681,8 @@ glusterd_handle_post_validate_fn (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &op_req,
(xdrproc_t)xdr_gd1_mgmt_v3_post_val_req);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL,
"Failed to decode post validation "
"request received from peer");
req->rpc_err = GARBAGE_ARGS;
@@ -658,7 +690,8 @@ glusterd_handle_post_validate_fn (rpcsvc_request_t *req)
}
if (glusterd_peerinfo_find_by_uuid (op_req.uuid) == NULL) {
- gf_log (this->name, GF_LOG_WARNING, "%s doesn't "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_PEER_NOT_FOUND, "%s doesn't "
"belong to the cluster. Ignoring request.",
uuid_utoa (op_req.uuid));
ret = -1;
@@ -672,14 +705,16 @@ glusterd_handle_post_validate_fn (rpcsvc_request_t *req)
ret = dict_unserialize (op_req.dict.dict_val,
op_req.dict.dict_len, &dict);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to unserialize the dictionary");
goto out;
}
rsp_dict = dict_new ();
if (!rsp_dict) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_CREATE_FAIL,
"Failed to get new dictionary");
return -1;
}
@@ -688,7 +723,8 @@ glusterd_handle_post_validate_fn (rpcsvc_request_t *req)
&op_errstr, rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_POST_VALIDATION_FAIL,
"Post Validation failed on operation %s",
gd_op_list[op_req.op]);
}
@@ -697,7 +733,8 @@ glusterd_handle_post_validate_fn (rpcsvc_request_t *req)
ret, op_errstr,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_OP_RESP_FAIL,
"Failed to send Post Validation "
"response for operation %s",
gd_op_list[op_req.op]);
@@ -741,7 +778,7 @@ glusterd_mgmt_v3_unlock_send_resp (rpcsvc_request_t *req, int32_t status)
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_v3_unlock_rsp);
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Responded to mgmt_v3 unlock, ret: %d", ret);
return ret;
@@ -763,14 +800,15 @@ glusterd_syctasked_mgmt_v3_unlock (rpcsvc_request_t *req,
/* Trying to release multiple mgmt_v3 locks */
ret = glusterd_multiple_mgmt_v3_unlock (ctx->dict, ctx->uuid);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_UNLOCK_FAIL,
"Failed to release mgmt_v3 locks for %s",
uuid_utoa(ctx->uuid));
}
ret = glusterd_mgmt_v3_unlock_send_resp (req, ret);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -790,13 +828,14 @@ glusterd_op_state_machine_mgmt_v3_unlock (rpcsvc_request_t *req,
ret = glusterd_op_sm_inject_event (GD_OP_EVENT_UNLOCK,
&lock_req->txn_id, ctx);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_EVENT_UNLOCK_FAIL,
"Failed to inject event GD_OP_EVENT_UNLOCK");
glusterd_friend_sm ();
glusterd_op_sm ();
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -817,17 +856,19 @@ glusterd_handle_mgmt_v3_unlock_fn (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &lock_req,
(xdrproc_t)xdr_gd1_mgmt_v3_unlock_req);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to decode unlock "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode unlock "
"request received from peer");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "Received volume unlock req "
+ gf_msg_debug (this->name, 0, "Received volume unlock req "
"from uuid: %s", uuid_utoa (lock_req.uuid));
if (glusterd_peerinfo_find_by_uuid (lock_req.uuid) == NULL) {
- gf_log (this->name, GF_LOG_WARNING, "%s doesn't "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_PEER_NOT_FOUND, "%s doesn't "
"belong to the cluster. Ignoring request.",
uuid_utoa (lock_req.uuid));
ret = -1;
@@ -852,7 +893,8 @@ glusterd_handle_mgmt_v3_unlock_fn (rpcsvc_request_t *req)
ret = dict_unserialize (lock_req.dict.dict_val,
lock_req.dict.dict_len, &ctx->dict);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to unserialize the dictionary");
goto out;
}
@@ -862,7 +904,8 @@ glusterd_handle_mgmt_v3_unlock_fn (rpcsvc_request_t *req)
if (is_synctasked) {
ret = glusterd_syctasked_mgmt_v3_unlock (req, &lock_req, ctx);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_UNLOCK_FAIL,
"Failed to release mgmt_v3_locks");
/* Ignore the return code, as it shouldn't be propagated
* from the handler function so as to avoid double
@@ -883,7 +926,8 @@ glusterd_handle_mgmt_v3_unlock_fn (rpcsvc_request_t *req)
ret = glusterd_op_state_machine_mgmt_v3_unlock (req, &lock_req,
ctx);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_UNLOCK_FAIL,
"Failed to release mgmt_v3_locks");
}
@@ -898,7 +942,7 @@ out:
free (lock_req.dict.dict_val);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index a99f8485e16..85d8c777884 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -22,6 +22,7 @@
#include "glusterd-volgen.h"
#include "glusterd-store.h"
#include "glusterd-snapshot-utils.h"
+#include "glusterd-messages.h"
extern struct rpc_clnt_program gd_mgmt_v3_prog;
@@ -130,7 +131,8 @@ gd_mgmt_v3_collate_errors (struct syncargs *args, int op_ret, int op_errno,
len = snprintf (err_str, sizeof(err_str),
"%s", cli_err_str);
- gf_log (this->name, GF_LOG_ERROR, "%s", op_err);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_OP_FAIL, "%s", op_err);
args->errstr = gf_strdup (err_str);
}
@@ -158,7 +160,8 @@ gd_mgmt_v3_pre_validate_fn (glusterd_op_t op, dict_t *dict,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_PRE_VALIDATION_FAIL,
"Snapshot Prevalidate Failed");
goto out;
}
@@ -171,7 +174,7 @@ gd_mgmt_v3_pre_validate_fn (glusterd_op_t op, dict_t *dict,
ret = 0;
out:
- gf_log (this->name, GF_LOG_DEBUG, "OP = %d. Returning %d", op, ret);
+ gf_msg_debug (this->name, 0, "OP = %d. Returning %d", op, ret);
return ret;
}
@@ -193,8 +196,9 @@ gd_mgmt_v3_brick_op_fn (glusterd_op_t op, dict_t *dict,
{
ret = glusterd_snapshot_brickop (dict, op_errstr, rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "snapshot brickop "
- "failed");
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_BRICK_OP_FAIL,
+ "snapshot brickop failed");
goto out;
}
break;
@@ -205,7 +209,7 @@ gd_mgmt_v3_brick_op_fn (glusterd_op_t op, dict_t *dict,
ret = 0;
out:
- gf_log (this->name, GF_LOG_TRACE, "OP = %d. Returning %d", op, ret);
+ gf_msg_trace (this->name, 0, "OP = %d. Returning %d", op, ret);
return ret;
}
@@ -227,9 +231,10 @@ gd_mgmt_v3_commit_fn (glusterd_op_t op, dict_t *dict,
{
ret = glusterd_snapshot (dict, op_errstr, rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
- "Snapshot Commit Failed");
- goto out;
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_COMMIT_OP_FAIL,
+ "Snapshot Commit Failed");
+ goto out;
}
break;
}
@@ -239,7 +244,7 @@ gd_mgmt_v3_commit_fn (glusterd_op_t op, dict_t *dict,
ret = 0;
out:
- gf_log (this->name, GF_LOG_DEBUG, "OP = %d. Returning %d", op, ret);
+ gf_msg_debug (this->name, 0, "OP = %d. Returning %d", op, ret);
return ret;
}
@@ -263,9 +268,10 @@ gd_mgmt_v3_post_validate_fn (glusterd_op_t op, int32_t op_ret, dict_t *dict,
op_errstr,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
- "postvalidate operation failed");
- goto out;
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_POST_VALIDATION_FAIL,
+ "postvalidate operation failed");
+ goto out;
}
break;
}
@@ -276,7 +282,7 @@ gd_mgmt_v3_post_validate_fn (glusterd_op_t op, int32_t op_ret, dict_t *dict,
ret = 0;
out:
- gf_log (this->name, GF_LOG_TRACE, "OP = %d. Returning %d", op, ret);
+ gf_msg_trace (this->name, 0, "OP = %d. Returning %d", op, ret);
return ret;
}
@@ -385,7 +391,7 @@ gd_mgmt_v3_lock (glusterd_op_t op, dict_t *op_ctx,
(xdrproc_t) xdr_gd1_mgmt_v3_lock_req);
out:
GF_FREE (req.dict.dict_val);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -416,7 +422,8 @@ glusterd_mgmt_v3_initiate_lockdown (glusterd_op_t op, dict_t *dict,
/* Trying to acquire multiple mgmt_v3 locks on local node */
ret = glusterd_multiple_mgmt_v3_lock (dict, MY_UUID);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_LOCK_GET_FAIL,
"Failed to acquire mgmt_v3 locks on localhost");
goto out;
}
@@ -460,12 +467,13 @@ glusterd_mgmt_v3_initiate_lockdown (glusterd_op_t op, dict_t *dict,
ret = args.op_ret;
- gf_log (this->name, GF_LOG_DEBUG, "Sent lock op req for %s "
+ gf_msg_debug (this->name, 0, "Sent lock op req for %s "
"to %d peers. Returning %d", gd_op_list[op], peer_cnt, ret);
out:
if (ret) {
if (*op_errstr)
- gf_log (this->name, GF_LOG_ERROR, "%s",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_LOCK_GET_FAIL, "%s",
*op_errstr);
if (volname)
@@ -503,7 +511,8 @@ glusterd_pre_validate_aggr_rsp_dict (glusterd_op_t op,
case GD_OP_SNAP:
ret = glusterd_snap_pre_validate_use_rsp_dict (aggr, rsp);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PRE_VALIDATION_FAIL,
"Failed to aggregate prevalidate "
"response dictionaries.");
goto out;
@@ -511,7 +520,8 @@ glusterd_pre_validate_aggr_rsp_dict (glusterd_op_t op,
break;
default:
ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Invalid op (%s)",
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "Invalid op (%s)",
gd_op_list[op]);
break;
@@ -583,7 +593,8 @@ gd_mgmt_v3_pre_validate_cbk_fn (struct rpc_req *req, struct iovec *iov,
pthread_mutex_unlock (&args->lock_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RESP_AGGR_FAIL, "%s",
"Failed to aggregate response from "
" node/brick");
if (!rsp.op_ret)
@@ -657,7 +668,7 @@ gd_mgmt_v3_pre_validate_req (glusterd_op_t op, dict_t *op_ctx,
(xdrproc_t) xdr_gd1_mgmt_v3_pre_val_req);
out:
GF_FREE (req.dict.dict_val);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -685,7 +696,8 @@ glusterd_mgmt_v3_pre_validate (glusterd_op_t op, dict_t *req_dict,
rsp_dict = dict_new ();
if (!rsp_dict) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_CREATE_FAIL,
"Failed to create response dictionary");
goto out;
}
@@ -695,7 +707,8 @@ glusterd_mgmt_v3_pre_validate (glusterd_op_t op, dict_t *req_dict,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PRE_VALIDATION_FAIL,
"Pre Validation failed for "
"operation %s on local node",
gd_op_list[op]);
@@ -716,7 +729,8 @@ glusterd_mgmt_v3_pre_validate (glusterd_op_t op, dict_t *req_dict,
ret = glusterd_pre_validate_aggr_rsp_dict (op, req_dict,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PRE_VALIDATION_FAIL, "%s",
"Failed to aggregate response from "
" node/brick");
goto out;
@@ -758,7 +772,8 @@ glusterd_mgmt_v3_pre_validate (glusterd_op_t op, dict_t *req_dict,
gd_synctask_barrier_wait((&args), peer_cnt);
if (args.op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PRE_VALIDATION_FAIL,
"Pre Validation failed on peers");
if (args.errstr)
@@ -767,7 +782,7 @@ glusterd_mgmt_v3_pre_validate (glusterd_op_t op, dict_t *req_dict,
ret = args.op_ret;
- gf_log (this->name, GF_LOG_DEBUG, "Sent pre valaidation req for %s "
+ gf_msg_debug (this->name, 0, "Sent pre valaidation req for %s "
"to %d peers. Returning %d", gd_op_list[op], peer_cnt, ret);
out:
return ret;
@@ -912,7 +927,7 @@ gd_mgmt_v3_brick_op_req (glusterd_op_t op, dict_t *op_ctx,
(xdrproc_t) xdr_gd1_mgmt_v3_brick_op_req);
out:
GF_FREE (req.dict.dict_val);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -939,7 +954,8 @@ glusterd_mgmt_v3_brick_op (glusterd_op_t op, dict_t *req_dict, char **op_errstr,
rsp_dict = dict_new ();
if (!rsp_dict) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_CREATE_FAIL,
"Failed to create response dictionary");
goto out;
}
@@ -949,7 +965,8 @@ glusterd_mgmt_v3_brick_op (glusterd_op_t op, dict_t *req_dict, char **op_errstr,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_OP_FAIL,
"Brick ops failed for "
"operation %s on local node",
gd_op_list[op]);
@@ -1003,7 +1020,8 @@ glusterd_mgmt_v3_brick_op (glusterd_op_t op, dict_t *req_dict, char **op_errstr,
gd_synctask_barrier_wait((&args), peer_cnt);
if (args.op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_OP_FAIL,
"Brick ops failed on peers");
if (args.errstr)
@@ -1012,7 +1030,7 @@ glusterd_mgmt_v3_brick_op (glusterd_op_t op, dict_t *req_dict, char **op_errstr,
ret = args.op_ret;
- gf_log (this->name, GF_LOG_DEBUG, "Sent brick op req for %s "
+ gf_msg_debug (this->name, 0, "Sent brick op req for %s "
"to %d peers. Returning %d", gd_op_list[op], peer_cnt, ret);
out:
return ret;
@@ -1081,7 +1099,8 @@ gd_mgmt_v3_commit_cbk_fn (struct rpc_req *req, struct iovec *iov,
pthread_mutex_unlock (&args->lock_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RESP_AGGR_FAIL, "%s",
"Failed to aggregate response from "
" node/brick");
if (!rsp.op_ret)
@@ -1152,7 +1171,7 @@ gd_mgmt_v3_commit_req (glusterd_op_t op, dict_t *op_ctx,
(xdrproc_t) xdr_gd1_mgmt_v3_commit_req);
out:
GF_FREE (req.dict.dict_val);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -1180,7 +1199,8 @@ glusterd_mgmt_v3_commit (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
rsp_dict = dict_new ();
if (!rsp_dict) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_CREATE_FAIL,
"Failed to create response dictionary");
goto out;
}
@@ -1190,7 +1210,8 @@ glusterd_mgmt_v3_commit (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_COMMIT_OP_FAIL,
"Commit failed for "
"operation %s on local node",
gd_op_list[op]);
@@ -1211,7 +1232,8 @@ glusterd_mgmt_v3_commit (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
ret = glusterd_syncop_aggr_rsp_dict (op, op_ctx,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RESP_AGGR_FAIL, "%s",
"Failed to aggregate response from "
" node/brick");
goto out;
@@ -1253,7 +1275,8 @@ glusterd_mgmt_v3_commit (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
gd_synctask_barrier_wait((&args), peer_cnt);
if (args.op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_COMMIT_OP_FAIL,
"Commit failed on peers");
if (args.errstr)
@@ -1262,7 +1285,7 @@ glusterd_mgmt_v3_commit (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
ret = args.op_ret;
- gf_log (this->name, GF_LOG_DEBUG, "Sent commit req for %s to %d "
+ gf_msg_debug (this->name, 0, "Sent commit req for %s to %d "
"peers. Returning %d", gd_op_list[op], peer_cnt, ret);
out:
return ret;
@@ -1371,7 +1394,7 @@ gd_mgmt_v3_post_validate_req (glusterd_op_t op, int32_t op_ret, dict_t *op_ctx,
(xdrproc_t) xdr_gd1_mgmt_v3_post_val_req);
out:
GF_FREE (req.dict.dict_val);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -1400,7 +1423,8 @@ glusterd_mgmt_v3_post_validate (glusterd_op_t op, int32_t op_ret, dict_t *dict,
rsp_dict = dict_new ();
if (!rsp_dict) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_CREATE_FAIL,
"Failed to create response dictionary");
goto out;
}
@@ -1413,7 +1437,8 @@ glusterd_mgmt_v3_post_validate (glusterd_op_t op, int32_t op_ret, dict_t *dict,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_POST_VALIDATION_FAIL,
"Post Validation failed for "
"operation %s on local node",
gd_op_list[op]);
@@ -1467,7 +1492,8 @@ glusterd_mgmt_v3_post_validate (glusterd_op_t op, int32_t op_ret, dict_t *dict,
gd_synctask_barrier_wait((&args), peer_cnt);
if (args.op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_POST_VALIDATION_FAIL,
"Post Validation failed on peers");
if (args.errstr)
@@ -1476,7 +1502,7 @@ glusterd_mgmt_v3_post_validate (glusterd_op_t op, int32_t op_ret, dict_t *dict,
ret = args.op_ret;
- gf_log (this->name, GF_LOG_DEBUG, "Sent post valaidation req for %s "
+ gf_msg_debug (this->name, 0, "Sent post valaidation req for %s "
"to %d peers. Returning %d", gd_op_list[op], peer_cnt, ret);
out:
return ret;
@@ -1580,7 +1606,7 @@ gd_mgmt_v3_unlock (glusterd_op_t op, dict_t *op_ctx,
(xdrproc_t) xdr_gd1_mgmt_v3_unlock_req);
out:
GF_FREE (req.dict.dict_val);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -1644,7 +1670,8 @@ glusterd_mgmt_v3_release_peer_locks (glusterd_op_t op, dict_t *dict,
gd_synctask_barrier_wait((&args), peer_cnt);
if (args.op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_UNLOCK_FAIL,
"Unlock failed on peers");
if (!op_ret && args.errstr)
@@ -1653,7 +1680,7 @@ glusterd_mgmt_v3_release_peer_locks (glusterd_op_t op, dict_t *dict,
ret = args.op_ret;
- gf_log (this->name, GF_LOG_DEBUG, "Sent unlock op req for %s "
+ gf_msg_debug (this->name, 0, "Sent unlock op req for %s "
"to %d peers. Returning %d", gd_op_list[op], peer_cnt, ret);
out:
@@ -1690,7 +1717,6 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
* processor.
*/
-
/* Save the MY_UUID as the originator_uuid. This originator_uuid
* will be used by is_origin_glusterd() to determine if a node
* is the originator node for a command. */
@@ -1705,7 +1731,8 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = dict_set_bin (dict, "originator_uuid",
originator_uuid, sizeof (uuid_t));
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
"Failed to set originator_uuid.");
goto out;
}
@@ -1713,7 +1740,8 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
/* Marking the operation as complete synctasked */
ret = dict_set_int32 (dict, "is_synctasked", _gf_true);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
"Failed to set synctasked flag.");
goto out;
}
@@ -1722,7 +1750,8 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
* the unlock and the volname in the dict might be removed */
tmp_dict = dict_new();
if (!tmp_dict) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to create dict");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_CREATE_FAIL, "Unable to create dict");
goto out;
}
dict_copy (dict, tmp_dict);
@@ -1731,14 +1760,17 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_initiate_lockdown (op, dict, &op_errstr,
&is_acquired, txn_generation);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "mgmt_v3 lockdown failed.");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_LOCKDOWN_FAIL,
+ "mgmt_v3 lockdown failed.");
goto out;
}
/* BUILD PAYLOAD */
ret = glusterd_mgmt_v3_build_payload (&req_dict, &op_errstr, dict, op);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, LOGSTR_BUILD_PAYLOAD,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_PAYLOAD_BUILD_FAIL, LOGSTR_BUILD_PAYLOAD,
gd_op_list[op]);
if (op_errstr == NULL)
gf_asprintf (&op_errstr, OPERRSTR_BUILD_PAYLOAD);
@@ -1749,7 +1781,8 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_pre_validate (op, req_dict, &op_errstr,
txn_generation);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Pre Validation Failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PRE_VALIDATION_FAIL, "Pre Validation Failed");
goto out;
}
@@ -1757,7 +1790,8 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_commit (op, dict, req_dict, &op_errstr,
txn_generation);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Commit Op Failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_COMMIT_OP_FAIL, "Commit Op Failed");
goto out;
}
@@ -1769,7 +1803,8 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_post_validate (op, 0, dict, req_dict, &op_errstr,
txn_generation);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Post Validation Failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_POST_VALIDATION_FAIL, "Post Validation Failed");
goto out;
}
@@ -1786,7 +1821,8 @@ out:
/* Trying to release multiple mgmt_v3 locks */
ret = glusterd_multiple_mgmt_v3_unlock (tmp_dict, MY_UUID);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_UNLOCK_FAIL,
"Failed to release mgmt_v3 locks on localhost");
op_ret = ret;
}
@@ -1829,21 +1865,24 @@ glusterd_set_barrier_value (dict_t *dict, char *option)
*/
ret = dict_get_str (dict, "volname1", &volname);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Volname not present in "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Volname not present in "
"dict");
goto out;
}
ret = glusterd_volinfo_find (volname, &vol);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Volume %s not found ",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_NOT_FOUND, "Volume %s not found ",
volname);
goto out;
}
ret = dict_set_dynstr_with_alloc (dict, "barrier", option);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set barrier op "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to set barrier op "
"in request dictionary");
goto out;
}
@@ -1851,7 +1890,8 @@ glusterd_set_barrier_value (dict_t *dict, char *option)
ret = dict_set_dynstr_with_alloc (vol->dict, "features.barrier",
option);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set barrier op "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to set barrier op "
"in volume option dict");
goto out;
}
@@ -1860,14 +1900,16 @@ glusterd_set_barrier_value (dict_t *dict, char *option)
ret = glusterd_create_volfiles (vol);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to create volfiles");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLFILE_CREATE_FAIL,
+ "Failed to create volfiles");
goto out;
}
ret = glusterd_store_volinfo (vol, GLUSTERD_VOLINFO_VER_AC_INCREMENT);
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -1917,7 +1959,8 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = dict_set_bin (dict, "originator_uuid",
originator_uuid, sizeof (uuid_t));
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
"Failed to set originator_uuid.");
goto out;
}
@@ -1925,7 +1968,8 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
/* Marking the operation as complete synctasked */
ret = dict_set_int32 (dict, "is_synctasked", _gf_true);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
"Failed to set synctasked flag.");
goto out;
}
@@ -1934,7 +1978,8 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
* the unlock and the volname in the dict might be removed */
tmp_dict = dict_new();
if (!tmp_dict) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to create dict");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_CREATE_FAIL, "Unable to create dict");
goto out;
}
dict_copy (dict, tmp_dict);
@@ -1943,14 +1988,17 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_initiate_lockdown (op, dict, &op_errstr,
&is_acquired, txn_generation);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "mgmt_v3 lockdown failed.");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_LOCKDOWN_FAIL,
+ "mgmt_v3 lockdown failed.");
goto out;
}
/* BUILD PAYLOAD */
ret = glusterd_mgmt_v3_build_payload (&req_dict, &op_errstr, dict, op);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, LOGSTR_BUILD_PAYLOAD,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_PAYLOAD_BUILD_FAIL, LOGSTR_BUILD_PAYLOAD,
gd_op_list[op]);
if (op_errstr == NULL)
gf_asprintf (&op_errstr, OPERRSTR_BUILD_PAYLOAD);
@@ -1961,15 +2009,16 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_pre_validate (op, req_dict, &op_errstr,
txn_generation);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Pre Validation Failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PRE_VALIDATION_FAIL, "Pre Validation Failed");
goto out;
}
/* quorum check of the volume is done here */
ret = glusterd_snap_quorum_check (req_dict, _gf_false, &op_errstr);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
- "Volume quorum check failed");
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_QUORUM_CHECK_FAIL, "Volume quorum check failed");
goto out;
}
@@ -1978,7 +2027,8 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
*/
ret = dict_set_dynstr_with_alloc (req_dict, "operation-type", "pre");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to set "
"operation-type in dictionary");
goto out;
}
@@ -1986,7 +2036,8 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_brick_op (op, req_dict, &op_errstr,
txn_generation);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Brick Ops Failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_OP_FAIL, "Brick Ops Failed");
goto unbarrier;
}
@@ -2010,14 +2061,16 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
*/
ret = dict_set_int32 (req_dict, "cleanup", 1);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "failed to set dict");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "failed to set dict");
goto unbarrier;
}
ret = glusterd_mgmt_v3_commit (op, dict, req_dict, &op_errstr,
txn_generation);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Commit Op Failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_COMMIT_OP_FAIL, "Commit Op Failed");
/* If the main op fails, we should save the error string.
Because, op_errstr will be used for unbarrier and
unlock ops also. We might lose the actual error that
@@ -2035,7 +2088,8 @@ unbarrier:
*/
ret = dict_set_dynstr_with_alloc (req_dict, "operation-type", "post");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to set "
"operation-type in dictionary");
goto out;
}
@@ -2044,7 +2098,8 @@ unbarrier:
txn_generation);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Brick Ops Failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_OP_FAIL, "Brick Ops Failed");
goto out;
}
@@ -2053,7 +2108,8 @@ unbarrier:
//quorum check of the snapshot volume
ret = glusterd_snap_quorum_check (dict, _gf_true, &op_errstr);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_QUORUM_CHECK_FAIL,
"Snapshot Volume quorum check failed");
goto out;
}
@@ -2071,7 +2127,8 @@ out:
ret = glusterd_mgmt_v3_post_validate (op, op_ret, dict, req_dict,
&op_errstr, txn_generation);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Post Validation Failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PRE_VALIDATION_FAIL, "Post Validation Failed");
op_ret = -1;
}
@@ -2097,7 +2154,8 @@ out:
/* Trying to release multiple mgmt_v3 locks */
ret = glusterd_multiple_mgmt_v3_unlock (tmp_dict, MY_UUID);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MGMTV3_UNLOCK_FAIL,
"Failed to release mgmt_v3 locks on localhost");
op_ret = ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c
index d6088a398fa..53092d35dbe 100644
--- a/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c
@@ -78,18 +78,19 @@ glusterd_proc_stop (glusterd_proc_t *proc, int sig, int flags)
if (!gf_is_service_running (proc->pidfile, &pid)) {
ret = 0;
- gf_log (this->name, GF_LOG_INFO, "%s already stopped",
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_ALREADY_STOPPED, "%s already stopped",
proc->name);
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "Stopping %s daemon running in pid: "
+ gf_msg_debug (this->name, 0, "Stopping %s daemon running in pid: "
"%d", proc->name, pid);
ret = kill (pid, sig);
if (ret) {
switch (errno) {
case ESRCH:
- gf_log (this->name, GF_LOG_DEBUG, "%s is already "
+ gf_msg_debug (this->name, 0, "%s is already "
"stopped", proc->name);
ret = 0;
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
index af4272231d2..1a68afb56f2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
@@ -25,7 +25,8 @@ glusterd_svc_create_rundir (char *rundir)
ret = mkdir (rundir, 0777);
if ((ret == -1) && (EEXIST != errno)) {
- gf_log (THIS->name, GF_LOG_ERROR, "Unable to create rundir %s",
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ GD_MSG_CREATE_DIR_FAILED, "Unable to create rundir %s",
rundir);
}
return ret;
@@ -112,7 +113,7 @@ glusterd_svc_init_common (glusterd_svc_t *svc,
goto out;
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -173,7 +174,8 @@ glusterd_svc_start (glusterd_svc_t *svc, int flags, dict_t *cmdline)
ret = access (svc->proc.volfile, F_OK);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Volfile %s is not present",
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLFILE_NOT_FOUND, "Volfile %s is not present",
svc->proc.volfile);
goto out;
}
@@ -201,7 +203,7 @@ glusterd_svc_start (glusterd_svc_t *svc, int flags, dict_t *cmdline)
if (cmdline)
dict_foreach (cmdline, svc_add_args, (void *) &runner);
- gf_log (this->name, GF_LOG_DEBUG, "Starting %s service", svc->name);
+ gf_msg_debug (this->name, 0, "Starting %s service", svc->name);
if (flags == PROC_START_NO_WAIT) {
ret = runner_run_nowait (&runner);
@@ -214,7 +216,7 @@ glusterd_svc_start (glusterd_svc_t *svc, int flags, dict_t *cmdline)
}
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -233,7 +235,7 @@ int glusterd_svc_stop (glusterd_svc_t *svc, int sig)
(void) glusterd_unlink_file ((char *)svc->conn.sockpath);
}
out:
- gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (THIS->name, 0, "Returning %d", ret);
return ret;
}
@@ -309,13 +311,14 @@ glusterd_svc_common_rpc_notify (glusterd_conn_t *conn,
/* Get the parent onject i.e. svc using list_entry macro */
svc = cds_list_entry (conn, glusterd_svc_t, conn);
if (!svc) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get the service");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SVC_GET_FAIL, "Failed to get the service");
return -1;
}
switch (event) {
case RPC_CLNT_CONNECT:
- gf_log (this->name, GF_LOG_DEBUG, "%s has connected with "
+ gf_msg_debug (this->name, 0, "%s has connected with "
"glusterd.", svc->name);
svc->online = _gf_true;
break;
@@ -330,7 +333,7 @@ glusterd_svc_common_rpc_notify (glusterd_conn_t *conn,
break;
default:
- gf_log (this->name, GF_LOG_TRACE,
+ gf_msg_trace (this->name, 0,
"got some other RPC event %d", event);
break;
}