summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorNandaja Varma <nandaja.varma@gmail.com>2015-03-17 18:03:36 +0530
committerAtin Mukherjee <amukherj@redhat.com>2015-06-13 23:29:32 -0700
commitcdda561c0a1f4c8050f664a444fe8b88d17e3b10 (patch)
treec208745c12fa84c090ac65fdb2286e103fc3ca05 /xlators/mgmt
parent7d8b53d5fc736d340c75e70a69c464b20102bbe7 (diff)
handler, messages/glusterd: Porting to new logging framework
Change-Id: If67230445678dd895d69f18c9982c3f0fda62dbd BUG: 1194640 Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com> Reviewed-on: http://review.gluster.org/9910 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c495
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c149
2 files changed, 428 insertions, 216 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index c52f7596e29..c3bf263c4f1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -119,7 +119,9 @@ glusterd_handle_friend_req (rpcsvc_request_t *req, uuid_t uuid,
(GD_FRIEND_EVENT_RCVD_FRIEND_REQ, &event);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "event generation failed: %d", ret);
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_EVENT_NEW_GET_FAIL,
+ "event generation failed: %d", ret);
goto out;
}
@@ -129,7 +131,8 @@ glusterd_handle_friend_req (rpcsvc_request_t *req, uuid_t uuid,
ctx = GF_CALLOC (1, sizeof (*ctx), gf_gld_mt_friend_req_ctx_t);
if (!ctx) {
- gf_log ("", GF_LOG_ERROR, "Unable to allocate memory");
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Unable to allocate memory");
ret = -1;
goto out;
}
@@ -159,7 +162,9 @@ glusterd_handle_friend_req (rpcsvc_request_t *req, uuid_t uuid,
ret = glusterd_friend_sm_inject_event (event);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR, "Unable to inject event %d, "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_EVENT_INJECT_FAIL,
+ "Unable to inject event %d, "
"ret = %d", event->event, ret);
goto out;
}
@@ -209,7 +214,8 @@ glusterd_handle_unfriend_req (rpcsvc_request_t *req, uuid_t uuid,
peerinfo = glusterd_peerinfo_find (uuid, hostname);
if (peerinfo == NULL) {
- gf_log ("glusterd", GF_LOG_CRITICAL,
+ gf_msg ("glusterd", GF_LOG_CRITICAL, 0,
+ GD_MSG_REQ_FROM_UNKNOWN_PEER,
"Received remove-friend from unknown peer %s",
hostname);
ret = glusterd_xfer_friend_remove_resp (req, hostname,
@@ -221,7 +227,9 @@ glusterd_handle_unfriend_req (rpcsvc_request_t *req, uuid_t uuid,
(GD_FRIEND_EVENT_RCVD_REMOVE_FRIEND, &event);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "event generation failed: %d", ret);
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_EVENT_NEW_GET_FAIL,
+ "event generation failed: %d", ret);
goto out;
}
@@ -231,7 +239,8 @@ glusterd_handle_unfriend_req (rpcsvc_request_t *req, uuid_t uuid,
ctx = GF_CALLOC (1, sizeof (*ctx), gf_gld_mt_friend_req_ctx_t);
if (!ctx) {
- gf_log ("", GF_LOG_ERROR, "Unable to allocate memory");
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Unable to allocate memory");
ret = -1;
goto out;
}
@@ -246,7 +255,8 @@ glusterd_handle_unfriend_req (rpcsvc_request_t *req, uuid_t uuid,
ret = glusterd_friend_sm_inject_event (event);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR, "Unable to inject event %d, "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_EVENT_INJECT_FAIL, "Unable to inject event %d, "
"ret = %d", event->event, ret);
goto out;
}
@@ -648,7 +658,8 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
* op state machine. */
ret = glusterd_generate_txn_id (dict, &txn_id);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_IDGEN_FAIL,
"Failed to generate transaction id");
goto out;
}
@@ -658,7 +669,8 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
* is the originator node for a command. */
ret = glusterd_set_originator_uuid (dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_UUID_SET_FAIL,
"Failed to set originator_uuid.");
goto out;
}
@@ -667,7 +679,8 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
if (priv->op_version < GD_OP_VERSION_3_6_0) {
ret = glusterd_lock (MY_UUID);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_GLUSTERD_LOCK_FAIL,
"Unable to acquire lock on localhost, ret: %d",
ret);
snprintf (err_str, err_len,
@@ -680,7 +693,7 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
* not be held */
ret = dict_get_str (dict, "volname", &tmp);
if (ret) {
- gf_log ("", GF_LOG_INFO,
+ gf_log (this->name, GF_LOG_INFO,
"No Volume name present. "
"Locks not being held.");
goto local_locking_done;
@@ -696,7 +709,8 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
ret = glusterd_mgmt_v3_lock (volname, MY_UUID, &op_errno,
"vol");
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", volname);
snprintf (err_str, err_len,
"Another transaction is in progress for %s. "
@@ -706,7 +720,7 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
}
locked = 1;
- gf_log (this->name, GF_LOG_DEBUG, "Acquired lock on localhost");
+ gf_msg_debug (this->name, 0, "Acquired lock on localhost");
local_locking_done:
/* If no volname is given as a part of the command, locks will
@@ -723,7 +737,8 @@ local_locking_done:
ret = glusterd_set_txn_opinfo (txn_id, &txn_op_info);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
"Unable to set transaction's opinfo");
if (ctx)
dict_unref (ctx);
@@ -732,7 +747,8 @@ local_locking_done:
ret = glusterd_op_sm_inject_event (event_type, txn_id, ctx);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to acquire cluster"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_EVENT_INJECT_FAIL, "Failed to acquire cluster"
" lock.");
goto out;
}
@@ -747,7 +763,8 @@ out:
ret = glusterd_mgmt_v3_unlock (volname, MY_UUID,
"vol");
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",
volname);
ret = -1;
@@ -757,7 +774,7 @@ out:
if (volname)
GF_FREE (volname);
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -785,20 +802,22 @@ __glusterd_handle_cluster_lock (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &lock_req,
(xdrproc_t)xdr_gd1_mgmt_cluster_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 LOCK from uuid: %s",
+ gf_msg_debug (this->name, 0, "Received LOCK from uuid: %s",
uuid_utoa (lock_req.uuid));
rcu_read_lock ();
ret = (glusterd_peerinfo_find_by_uuid (lock_req.uuid) == NULL);
rcu_read_unlock ();
if (ret) {
- 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;
@@ -818,7 +837,8 @@ __glusterd_handle_cluster_lock (rpcsvc_request_t *req)
op_ctx = dict_new ();
if (!op_ctx) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ GD_MSG_DICT_CREATE_FAIL,
"Unable to set new dict");
goto out;
}
@@ -827,7 +847,8 @@ __glusterd_handle_cluster_lock (rpcsvc_request_t *req)
ret = glusterd_set_txn_opinfo (txn_id, &txn_op_info);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
"Unable to set transaction's opinfo");
dict_unref (txn_op_info.op_ctx);
goto out;
@@ -835,11 +856,12 @@ __glusterd_handle_cluster_lock (rpcsvc_request_t *req)
ret = glusterd_op_sm_inject_event (GD_OP_EVENT_LOCK, txn_id, ctx);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_EVENT_INJECT_FAIL,
"Failed to inject event GD_OP_EVENT_LOCK");
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
glusterd_friend_sm ();
glusterd_op_sm ();
@@ -871,7 +893,7 @@ glusterd_req_ctx_create (rpcsvc_request_t *rpc_req,
GF_ASSERT (this);
gf_uuid_unparse (uuid, str);
- gf_log (this->name, GF_LOG_DEBUG, "Received op from uuid %s", str);
+ gf_msg_debug (this->name, 0, "Received op from uuid %s", str);
dict = dict_new ();
if (!dict)
@@ -886,7 +908,8 @@ glusterd_req_ctx_create (rpcsvc_request_t *rpc_req,
req_ctx->op = op;
ret = dict_unserialize (buf_val, buf_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;
}
@@ -927,7 +950,8 @@ __glusterd_handle_stage_op (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &op_req,
(xdrproc_t)xdr_gd1_mgmt_stage_op_req);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to decode stage "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode stage "
"request received from peer");
req->rpc_err = GARBAGE_ARGS;
goto out;
@@ -937,19 +961,21 @@ __glusterd_handle_stage_op (rpcsvc_request_t *req)
op_req.buf.buf_val, op_req.buf.buf_len,
gf_gld_mt_op_stage_ctx_t, &req_ctx);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to create req_ctx");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_CTX_CREATE_FAIL, "Failed to create req_ctx");
goto out;
}
ret = dict_get_bin (req_ctx->dict, "transaction_id", (void **)&txn_id);
- gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s",
+ gf_msg_debug (this->name, 0, "transaction ID = %s",
uuid_utoa (*txn_id));
rcu_read_lock ();
ret = (glusterd_peerinfo_find_by_uuid (op_req.uuid) == NULL);
rcu_read_unlock ();
if (ret) {
- 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;
@@ -961,7 +987,7 @@ __glusterd_handle_stage_op (rpcsvc_request_t *req)
* phase where the transaction opinfos are created, won't be called. */
ret = glusterd_get_txn_opinfo (txn_id, &txn_op_info);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"No transaction's opinfo set");
state.state = GD_OP_STATE_LOCKED;
@@ -970,7 +996,8 @@ __glusterd_handle_stage_op (rpcsvc_request_t *req)
ret = glusterd_set_txn_opinfo (txn_id, &txn_op_info);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_SET_FAIL,
"Unable to set transaction's opinfo");
dict_unref (req_ctx->dict);
goto out;
@@ -980,7 +1007,8 @@ __glusterd_handle_stage_op (rpcsvc_request_t *req)
ret = glusterd_op_sm_inject_event (GD_OP_EVENT_STAGE_OP,
txn_id, req_ctx);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_EVENT_INJECT_FAIL,
"Failed to inject event GD_OP_EVENT_STAGE_OP");
out:
@@ -1018,7 +1046,8 @@ __glusterd_handle_commit_op (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &op_req,
(xdrproc_t)xdr_gd1_mgmt_commit_op_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;
@@ -1028,7 +1057,8 @@ __glusterd_handle_commit_op (rpcsvc_request_t *req)
ret = (glusterd_peerinfo_find_by_uuid (op_req.uuid) == NULL);
rcu_read_unlock ();
if (ret) {
- 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;
@@ -1044,7 +1074,7 @@ __glusterd_handle_commit_op (rpcsvc_request_t *req)
goto out;
ret = dict_get_bin (req_ctx->dict, "transaction_id", (void **)&txn_id);
- gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s",
+ gf_msg_debug (this->name, 0, "transaction ID = %s",
uuid_utoa (*txn_id));
ret = glusterd_op_sm_inject_event (GD_OP_EVENT_COMMIT_OP,
@@ -1083,7 +1113,8 @@ __glusterd_handle_cli_probe (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
//failed to decode msg;
- gf_log ("", GF_LOG_ERROR, "xdr decoding error");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "xdr decoding error");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -1094,7 +1125,8 @@ __glusterd_handle_cli_probe (rpcsvc_request_t *req)
ret = dict_unserialize (cli_req.dict.dict_val,
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");
goto out;
}
@@ -1102,13 +1134,16 @@ __glusterd_handle_cli_probe (rpcsvc_request_t *req)
ret = dict_get_str (dict, "hostname", &hostname);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get hostname");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_HOSTNAME_NOTFOUND_IN_DICT,
+ "Failed to get hostname");
goto out;
}
ret = dict_get_int32 (dict, "port", &port);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get port");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PORT_NOTFOUND_IN_DICT, "Failed to get port");
goto out;
}
@@ -1128,7 +1163,7 @@ __glusterd_handle_cli_probe (rpcsvc_request_t *req)
if (dict_get_str(this->options,"transport.socket.bind-address",
&bind_name) == 0) {
- gf_log ("glusterd", GF_LOG_DEBUG,
+ gf_msg_debug ("glusterd", 0,
"only checking probe address vs. bind address");
ret = gf_is_same_address (bind_name, hostname);
}
@@ -1150,7 +1185,7 @@ __glusterd_handle_cli_probe (rpcsvc_request_t *req)
rcu_read_unlock ();
if (ret) {
- gf_log ("glusterd", GF_LOG_DEBUG, "Probe host %s port %d "
+ gf_msg_debug ("glusterd", 0, "Probe host %s port %d "
"already a peer", hostname, port);
glusterd_xfer_cli_probe_resp (req, 0, GF_PROBE_FRIEND, NULL,
hostname, port, dict);
@@ -1214,6 +1249,9 @@ __glusterd_handle_cli_deprobe (rpcsvc_request_t *req)
(xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received from cli");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -1224,7 +1262,8 @@ __glusterd_handle_cli_deprobe (rpcsvc_request_t *req)
ret = dict_unserialize (cli_req.dict.dict_val,
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");
goto out;
}
@@ -1234,18 +1273,22 @@ __glusterd_handle_cli_deprobe (rpcsvc_request_t *req)
ret = dict_get_str (dict, "hostname", &hostname);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get hostname");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_HOSTNAME_NOTFOUND_IN_DICT,
+ "Failed to get hostname");
goto out;
}
ret = dict_get_int32 (dict, "port", &port);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get port");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PORT_NOTFOUND_IN_DICT, "Failed to get port");
goto out;
}
ret = dict_get_int32 (dict, "flags", &flags);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get flags");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_FLAGS_NOTFOUND_IN_DICT, "Failed to get flags");
goto out;
}
@@ -1338,6 +1381,9 @@ __glusterd_handle_cli_list_friends (rpcsvc_request_t *req)
(xdrproc_t)xdr_gf1_cli_peer_list_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received from cli");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -1352,7 +1398,8 @@ __glusterd_handle_cli_list_friends (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
goto out;
@@ -1393,6 +1440,9 @@ __glusterd_handle_cli_get_volume (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received from cli");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -1407,7 +1457,8 @@ __glusterd_handle_cli_get_volume (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
goto out;
@@ -1418,7 +1469,8 @@ __glusterd_handle_cli_get_volume (rpcsvc_request_t *req)
ret = dict_get_int32 (dict, "flags", &flags);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "failed to get flags");
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_FLAGS_NOTFOUND_IN_DICT, "failed to get flags");
goto out;
}
@@ -1462,11 +1514,14 @@ __glusterd_handle_cli_uuid_reset (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received from cli");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
- gf_log ("glusterd", GF_LOG_DEBUG, "Received uuid reset req");
+ gf_msg_debug ("glusterd", 0, "Received uuid reset req");
if (cli_req.dict.dict_len) {
/* Unserialize the dictionary */
@@ -1476,7 +1531,8 @@ __glusterd_handle_cli_uuid_reset (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
snprintf (msg_str, sizeof (msg_str), "Unable to decode "
@@ -1496,7 +1552,8 @@ __glusterd_handle_cli_uuid_reset (rpcsvc_request_t *req)
snprintf (msg_str, sizeof (msg_str), "volumes are already "
"present in the cluster. Resetting uuid is not "
"allowed");
- gf_log (this->name, GF_LOG_WARNING, "%s", msg_str);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_VOLS_ALREADY_PRESENT, "%s", msg_str);
goto out;
}
@@ -1505,7 +1562,8 @@ __glusterd_handle_cli_uuid_reset (rpcsvc_request_t *req)
snprintf (msg_str, sizeof (msg_str),"trusted storage pool "
"has been already formed. Please detach this peer "
"from the pool and reset its uuid.");
- gf_log (this->name, GF_LOG_WARNING, "%s", msg_str);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_TSP_ALREADY_FORMED, "%s", msg_str);
goto out;
}
@@ -1515,7 +1573,8 @@ __glusterd_handle_cli_uuid_reset (rpcsvc_request_t *req)
if (!gf_uuid_compare (uuid, MY_UUID)) {
snprintf (msg_str, sizeof (msg_str), "old uuid and the new uuid"
" are same. Try gluster peer reset again");
- gf_log (this->name, GF_LOG_ERROR, "%s", msg_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_UUIDS_SAME_RETRY, "%s", msg_str);
ret = -1;
goto out;
}
@@ -1566,11 +1625,14 @@ __glusterd_handle_cli_uuid_get (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received from cli");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
- gf_log ("glusterd", GF_LOG_DEBUG, "Received uuid get req");
+ gf_msg_debug ("glusterd", 0, "Received uuid get req");
if (cli_req.dict.dict_len) {
dict = dict_new ();
@@ -1583,7 +1645,8 @@ __glusterd_handle_cli_uuid_get (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
snprintf (msg_str, sizeof (msg_str), "Unable to decode "
@@ -1605,7 +1668,8 @@ __glusterd_handle_cli_uuid_get (rpcsvc_request_t *req)
uuid_utoa_r (MY_UUID, uuid_str);
ret = dict_set_str (rsp_dict, "uuid", uuid_str);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set uuid in "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to set uuid in "
"dictionary.");
goto out;
}
@@ -1613,7 +1677,9 @@ __glusterd_handle_cli_uuid_get (rpcsvc_request_t *req)
ret = dict_allocate_and_serialize (rsp_dict, &rsp.dict.dict_val,
&rsp.dict.dict_len);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to serialize "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SERL_LENGTH_GET_FAIL,
+ "Failed to serialize "
"dictionary.");
goto out;
}
@@ -1743,7 +1809,8 @@ __glusterd_handle_ganesha_cmd (rpcsvc_request_t *req)
if (ret < 0) {
snprintf (err_str, sizeof (err_str), "Failed to decode "
"request received from cli");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "%s", err_str);
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -1760,7 +1827,8 @@ __glusterd_handle_ganesha_cmd (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
snprintf (err_str, sizeof (err_str), "Unable to decode "
@@ -1816,7 +1884,8 @@ __glusterd_handle_reset_volume (rpcsvc_request_t *req)
if (ret < 0) {
snprintf (err_str, sizeof (err_str), "Failed to decode request "
"received from cli");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "%s", err_str);
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -1829,8 +1898,9 @@ __glusterd_handle_reset_volume (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "failed to "
- "unserialize req-buffer to dictionary");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL, "failed to "
+ "unserialize req-buffer to dictionary");
snprintf (err_str, sizeof (err_str), "Unable to decode "
"the command");
goto out;
@@ -1843,10 +1913,11 @@ __glusterd_handle_reset_volume (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Failed to get volume "
"name");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLNAME_NOTFOUND_IN_DICT, "%s", err_str);
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "Received volume reset request for "
+ gf_msg_debug (this->name, 0, "Received volume reset request for "
"volume %s", volname);
ret = glusterd_op_begin_synctask (req, GD_OP_RESET_VOLUME, dict);
@@ -1894,7 +1965,8 @@ __glusterd_handle_set_volume (rpcsvc_request_t *req)
if (ret < 0) {
snprintf (err_str, sizeof (err_str), "Failed to decode "
"request received from cli");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "%s", err_str);
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -1907,7 +1979,8 @@ __glusterd_handle_set_volume (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
snprintf (err_str, sizeof (err_str), "Unable to decode "
@@ -1922,7 +1995,8 @@ __glusterd_handle_set_volume (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Failed to get volume "
"name while handling volume set command");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "%s", err_str);
goto out;
}
@@ -1937,7 +2011,8 @@ __glusterd_handle_set_volume (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Failed to get key while"
" handling volume set for %s", volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "%s", err_str);
goto out;
}
@@ -1945,10 +2020,11 @@ __glusterd_handle_set_volume (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Failed to get value while"
" handling volume set for %s", volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "%s", err_str);
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "Received volume set request for "
+ gf_msg_debug (this->name, 0, "Received volume set request for "
"volume %s", volname);
ret = glusterd_op_begin_synctask (req, GD_OP_SET_VOLUME, dict);
@@ -1996,6 +2072,9 @@ __glusterd_handle_sync_volume (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "%s", "Failed to decode "
+ "request received from cli");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -2008,7 +2087,8 @@ __glusterd_handle_sync_volume (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ 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 "
@@ -2022,7 +2102,8 @@ __glusterd_handle_sync_volume (rpcsvc_request_t *req)
ret = dict_get_str (dict, "hostname", &hostname);
if (ret) {
snprintf (msg, sizeof (msg), "Failed to get hostname");
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_HOSTNAME_NOTFOUND_IN_DICT, "%s", msg);
goto out;
}
@@ -2032,7 +2113,8 @@ __glusterd_handle_sync_volume (rpcsvc_request_t *req)
if (ret) {
snprintf (msg, sizeof (msg), "Failed to get volume name"
" or flags");
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_FLAGS_NOTFOUND_IN_DICT, "%s", msg);
goto out;
}
}
@@ -2044,7 +2126,8 @@ __glusterd_handle_sync_volume (rpcsvc_request_t *req)
ret = -1;
snprintf (msg, sizeof (msg), "sync from localhost"
" not allowed");
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SYNC_FROM_LOCALHOST_UNALLOWED, "%s", msg);
goto out;
}
@@ -2092,7 +2175,7 @@ glusterd_fsm_log_send_resp (rpcsvc_request_t *req, int op_ret,
(xdrproc_t)xdr_gf1_cli_fsm_log_rsp);
GF_FREE (rsp.fsm_log.fsm_log_val);
- gf_log ("glusterd", GF_LOG_DEBUG, "Responded, ret: %d", ret);
+ gf_msg_debug ("glusterd", 0, "Responded, ret: %d", ret);
return 0;
}
@@ -2115,6 +2198,9 @@ __glusterd_handle_fsm_log (rpcsvc_request_t *req)
(xdrproc_t)xdr_gf1_cli_fsm_log_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received from client.");
req->rpc_err = GARBAGE_ARGS;
snprintf (msg, sizeof (msg), "Garbage request");
goto out;
@@ -2178,7 +2264,7 @@ glusterd_op_lock_send_resp (rpcsvc_request_t *req, int32_t status)
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_cluster_lock_rsp);
- gf_log (THIS->name, GF_LOG_DEBUG, "Responded to lock, ret: %d", ret);
+ gf_msg_debug (THIS->name, 0, "Responded to lock, ret: %d", ret);
return 0;
}
@@ -2197,7 +2283,7 @@ glusterd_op_unlock_send_resp (rpcsvc_request_t *req, int32_t status)
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_cluster_unlock_rsp);
- gf_log (THIS->name, GF_LOG_DEBUG, "Responded to unlock, ret: %d", ret);
+ gf_msg_debug (THIS->name, 0, "Responded to unlock, ret: %d", ret);
return ret;
}
@@ -2221,7 +2307,7 @@ glusterd_op_mgmt_v3_lock_send_resp (rpcsvc_request_t *req, uuid_t *txn_id,
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_v3_lock_rsp);
- gf_log (THIS->name, GF_LOG_DEBUG, "Responded to mgmt_v3 lock, ret: %d",
+ gf_msg_debug (THIS->name, 0, "Responded to mgmt_v3 lock, ret: %d",
ret);
return ret;
@@ -2246,7 +2332,7 @@ glusterd_op_mgmt_v3_unlock_send_resp (rpcsvc_request_t *req, uuid_t *txn_id,
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_v3_unlock_rsp);
- gf_log (THIS->name, GF_LOG_DEBUG, "Responded to mgmt_v3 unlock, ret: %d",
+ gf_msg_debug (THIS->name, 0, "Responded to mgmt_v3 unlock, ret: %d",
ret);
return ret;
@@ -2273,21 +2359,23 @@ __glusterd_handle_cluster_unlock (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &unlock_req,
(xdrproc_t)xdr_gd1_mgmt_cluster_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,
+ gf_msg_debug (this->name, 0,
"Received UNLOCK from uuid: %s", uuid_utoa (unlock_req.uuid));
rcu_read_lock ();
ret = (glusterd_peerinfo_find_by_uuid (unlock_req.uuid) == NULL);
rcu_read_unlock ();
if (ret) {
- 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 (unlock_req.uuid));
ret = -1;
@@ -2298,6 +2386,8 @@ __glusterd_handle_cluster_unlock (rpcsvc_request_t *req)
if (!ctx) {
//respond here
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "No memory.");
return -1;
}
gf_uuid_copy (ctx->uuid, unlock_req.uuid);
@@ -2344,7 +2434,8 @@ glusterd_op_stage_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");
return ret;
}
@@ -2352,7 +2443,7 @@ glusterd_op_stage_send_resp (rpcsvc_request_t *req,
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_stage_op_rsp);
- gf_log (this->name, GF_LOG_DEBUG, "Responded to stage, ret: %d", ret);
+ gf_msg_debug (this->name, 0, "Responded to stage, ret: %d", ret);
GF_FREE (rsp.dict.dict_val);
return ret;
@@ -2383,7 +2474,8 @@ glusterd_op_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;
}
@@ -2393,7 +2485,7 @@ glusterd_op_commit_send_resp (rpcsvc_request_t *req,
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_commit_op_rsp);
- 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);
out:
GF_FREE (rsp.dict.dict_val);
@@ -2412,6 +2504,9 @@ __glusterd_handle_incoming_friend_req (rpcsvc_request_t *req)
(xdrproc_t)xdr_gd1_mgmt_friend_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received from friend");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -2458,6 +2553,9 @@ __glusterd_handle_incoming_unfriend_req (rpcsvc_request_t *req)
(xdrproc_t)xdr_gd1_mgmt_friend_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received.");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -2468,7 +2566,9 @@ __glusterd_handle_incoming_unfriend_req (rpcsvc_request_t *req)
ret = glusterd_remote_hostname_get (req, remote_hostname,
sizeof (remote_hostname));
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to get the remote hostname");
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_HOSTNAME_RESOLVE_FAIL,
+ "Unable to get the remote hostname");
goto out;
}
ret = glusterd_handle_unfriend_req (req, friend_req.uuid,
@@ -2507,7 +2607,7 @@ glusterd_handle_friend_update_delete (dict_t *dict)
ret = glusterd_friend_remove (NULL, hostname);
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -2522,7 +2622,8 @@ glusterd_peer_hostname_update (glusterd_peerinfo_t *peerinfo,
ret = gd_add_address_to_peer (peerinfo, hostname);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_HOSTNAME_ADD_TO_PEERLIST_FAIL,
"Couldn't add address to the peer info");
goto out;
}
@@ -2530,7 +2631,7 @@ glusterd_peer_hostname_update (glusterd_peerinfo_t *peerinfo,
if (store_update)
ret = glusterd_store_peerinfo (peerinfo);
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (THIS->name, 0, "Returning %d", ret);
return ret;
}
@@ -2563,6 +2664,9 @@ __glusterd_handle_friend_update (rpcsvc_request_t *req)
(xdrproc_t)xdr_gd1_mgmt_friend_update);
if (ret < 0) {
//failed to decode msg;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -2574,7 +2678,9 @@ __glusterd_handle_friend_update (rpcsvc_request_t *req)
}
rcu_read_unlock ();
if (ret) {
- gf_log ("", GF_LOG_CRITICAL, "Received friend update request "
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ GD_MSG_REQ_FROM_UNKNOWN_PEER,
+ "Received friend update request "
"from unknown peer %s", uuid_utoa (friend_req.uuid));
goto out;
}
@@ -2590,7 +2696,8 @@ __glusterd_handle_friend_update (rpcsvc_request_t *req)
friend_req.friends.friends_len,
&dict);
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
goto out;
@@ -2640,7 +2747,8 @@ __glusterd_handle_friend_update (rpcsvc_request_t *req)
peerinfo = gd_peerinfo_from_dict (dict, key);
if (peerinfo == NULL) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEERINFO_CREATE_FAIL,
"Could not create peerinfo from dict "
"for prefix %s", key);
goto unlock;
@@ -2661,7 +2769,9 @@ __glusterd_handle_friend_update (rpcsvc_request_t *req)
ret = gd_update_peerinfo_from_dict (peerinfo, dict,
key);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEER_INFO_UPDATE_FAIL,
+ "Failed to "
"update peer %s", peerinfo->hostname);
}
}
@@ -2721,6 +2831,9 @@ __glusterd_handle_probe_query (rpcsvc_request_t *req)
(xdrproc_t)xdr_gd1_mgmt_probe_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode probe "
+ "request");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -2740,7 +2853,8 @@ __glusterd_handle_probe_query (rpcsvc_request_t *req)
* sending the error.
*/
if (!gf_uuid_compare (probe_req.uuid, MY_UUID)) {
- gf_log (THIS->name, GF_LOG_ERROR, "Peer uuid %s is same as "
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_UUIDS_SAME_RETRY, "Peer uuid %s is same as "
"local uuid. Please check the uuid of both the peers "
"from %s/%s", uuid_utoa (probe_req.uuid),
GLUSTERD_DEFAULT_WORKDIR, GLUSTERD_INFO_FILE);
@@ -2753,7 +2867,9 @@ __glusterd_handle_probe_query (rpcsvc_request_t *req)
ret = glusterd_remote_hostname_get (req, remote_hostname,
sizeof (remote_hostname));
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to get the remote hostname");
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_HOSTNAME_RESOLVE_FAIL,
+ "Unable to get the remote hostname");
goto out;
}
@@ -2770,7 +2886,9 @@ __glusterd_handle_probe_query (rpcsvc_request_t *req)
GD_FRIEND_STATE_PROBE_RCVD,
NULL, &peerinfo, 0, &args);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Failed to add peer %s",
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_PEER_ADD_FAIL,
+ "Failed to add peer %s",
remote_hostname);
rsp.op_errno = GF_PROBE_ADD_FAILED;
}
@@ -2824,6 +2942,9 @@ __glusterd_handle_cli_profile_volume (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received from cli");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -2840,7 +2961,8 @@ __glusterd_handle_cli_profile_volume (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get volume "
"name");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLNAME_NOTFOUND_IN_DICT, "%s", err_str);
goto out;
}
@@ -2849,7 +2971,8 @@ __glusterd_handle_cli_profile_volume (rpcsvc_request_t *req)
ret = dict_get_int32 (dict, "op", &op);
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get operation");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "%s", err_str);
goto out;
}
@@ -2869,7 +2992,7 @@ out:
dict, err_str);
}
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -2928,6 +3051,9 @@ __glusterd_handle_mount (rpcsvc_request_t *req)
(xdrproc_t)xdr_gf1_cli_mount_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode mount "
+ "request received");
req->rpc_err = GARBAGE_ARGS;
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
@@ -2944,7 +3070,8 @@ __glusterd_handle_mount (rpcsvc_request_t *req)
mnt_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
rsp.op_ret = -1;
@@ -3009,6 +3136,9 @@ __glusterd_handle_umount (rpcsvc_request_t *req)
(xdrproc_t)xdr_gf1_cli_umount_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode umount"
+ "request");
req->rpc_err = GARBAGE_ARGS;
rsp.op_ret = -1;
goto out;
@@ -3102,15 +3232,15 @@ glusterd_friend_remove (uuid_t uuid, char *hostname)
ret = glusterd_friend_remove_cleanup_vols (peerinfo->uuid);
if (ret)
- gf_log (THIS->name, GF_LOG_WARNING, "Volumes cleanup failed");
-
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ GD_MSG_VOL_CLEANUP_FAIL, "Volumes cleanup failed");
rcu_read_unlock ();
/* Giving up the critical section here as glusterd_peerinfo_cleanup must
* be called from outside a critical section
*/
ret = glusterd_peerinfo_cleanup (peerinfo);
out:
- gf_log ("", GF_LOG_DEBUG, "returning %d", ret);
+ gf_msg_debug (THIS->name, 0, "returning %d", ret);
return ret;
}
@@ -3146,7 +3276,7 @@ out:
}
}
- gf_log (this->name, GF_LOG_DEBUG, "returning %d", ret);
+ gf_msg_debug (this->name, 0, "returning %d", ret);
return ret;
}
@@ -3200,7 +3330,8 @@ glusterd_transport_inet_options_build (dict_t **options, const char *hostname,
*/
ret = dict_set_int32 (dict, "frame-timeout", 600);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
"Failed to set frame-timeout");
goto out;
}
@@ -3213,7 +3344,7 @@ glusterd_transport_inet_options_build (dict_t **options, const char *hostname,
time, timeout);
*options = dict;
out:
- gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -3267,7 +3398,9 @@ glusterd_friend_rpc_create (xlator_t *this, glusterd_peerinfo_t *peerinfo,
ret = glusterd_rpc_create (&peerinfo->rpc, options,
glusterd_peer_rpc_notify, peerctx);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "failed to create rpc for"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RPC_CREATE_FAIL,
+ "failed to create rpc for"
" peer %s", peerinfo->hostname);
goto out;
}
@@ -3321,7 +3454,8 @@ glusterd_friend_add (const char *hoststr, int port,
ret = glusterd_friend_rpc_create (this, *friend, args);
}
else {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEERINFO_CREATE_FAIL,
"Failed to store peerinfo");
}
}
@@ -3374,7 +3508,8 @@ glusterd_friend_add_from_peerinfo (glusterd_peerinfo_t *friend,
ret = glusterd_friend_rpc_create (this, friend, args);
}
else {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEERINFO_CREATE_FAIL,
"Failed to store peerinfo");
}
}
@@ -3442,7 +3577,7 @@ glusterd_probe_begin (rpcsvc_request_t *req, const char *hoststr, int port,
out:
rcu_read_unlock ();
- gf_log ("", GF_LOG_DEBUG, "returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "returning %d", ret);
return ret;
}
@@ -3484,8 +3619,9 @@ glusterd_deprobe_begin (rpcsvc_request_t *req, const char *hoststr, int port,
(GD_FRIEND_EVENT_INIT_REMOVE_FRIEND, &event);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR,
- "Unable to get new event");
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_EVENT_NEW_GET_FAIL,
+ "Unable to get new event");
goto out;
}
@@ -3508,7 +3644,8 @@ glusterd_deprobe_begin (rpcsvc_request_t *req, const char *hoststr, int port,
ret = glusterd_friend_sm_inject_event (event);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR, "Unable to inject event %d, "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_EVENT_INJECT_FAIL, "Unable to inject event %d, "
"ret = %d", event->event, ret);
goto out;
}
@@ -3691,7 +3828,8 @@ glusterd_xfer_cli_probe_resp (rpcsvc_request_t *req, int32_t op_ret,
if (dict) {
ret = dict_get_str (dict, "cmd-str", &cmd_str);
if (ret)
- gf_log (this->name, GF_LOG_ERROR, "Failed to get "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_CMDSTR_NOTFOUND_IN_DICT, "Failed to get "
"command string");
}
@@ -3709,7 +3847,7 @@ glusterd_xfer_cli_probe_resp (rpcsvc_request_t *req, int32_t op_ret,
if (dict)
dict_unref (dict);
- gf_log (this->name, GF_LOG_DEBUG, "Responded to CLI, ret: %d",ret);
+ gf_msg_debug (this->name, 0, "Responded to CLI, ret: %d", ret);
return ret;
}
@@ -3786,7 +3924,8 @@ glusterd_xfer_cli_deprobe_resp (rpcsvc_request_t *req, int32_t op_ret,
if (dict) {
ret = dict_get_str (dict, "cmd-str", &cmd_str);
if (ret)
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to get "
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_CMDSTR_NOTFOUND_IN_DICT, "Failed to get "
"command string");
}
@@ -3802,7 +3941,7 @@ glusterd_xfer_cli_deprobe_resp (rpcsvc_request_t *req, int32_t op_ret,
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_cli_rsp);
- gf_log (THIS->name, GF_LOG_DEBUG, "Responded to CLI, ret: %d",ret);
+ gf_msg_debug (THIS->name, 0, "Responded to CLI, ret: %d", ret);
return ret;
}
@@ -3824,7 +3963,8 @@ glusterd_list_friends (rpcsvc_request_t *req, dict_t *dict, int32_t flags)
friends = dict_new ();
if (!friends) {
- gf_log ("", GF_LOG_WARNING, "Out of Memory");
+ gf_msg (THIS->name, GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Out of Memory");
goto out;
}
@@ -3906,7 +4046,8 @@ glusterd_get_volumes (rpcsvc_request_t *req, dict_t *dict, int32_t flags)
volumes = dict_new ();
if (!volumes) {
- gf_log ("", GF_LOG_WARNING, "Out of Memory");
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Out of Memory");
goto out;
}
@@ -4019,6 +4160,9 @@ __glusterd_handle_status_volume (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received from cli");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -4030,7 +4174,8 @@ __glusterd_handle_status_volume (rpcsvc_request_t *req)
ret = dict_unserialize (cli_req.dict.dict_val,
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 buffer");
snprintf (err_str, sizeof (err_str), "Unable to decode "
"the command");
@@ -4048,7 +4193,8 @@ __glusterd_handle_status_volume (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get "
"volume name");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_NOT_FOUND, "%s", err_str);
goto out;
}
gf_log (this->name, GF_LOG_INFO,
@@ -4135,6 +4281,9 @@ __glusterd_handle_cli_clearlocks_volume (rpcsvc_request_t *req)
ret = -1;
ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received from cli");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -4146,7 +4295,8 @@ __glusterd_handle_cli_clearlocks_volume (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to unserialize req-buffer to"
" dictionary");
snprintf (err_str, sizeof (err_str), "unable to decode "
@@ -4156,7 +4306,8 @@ __glusterd_handle_cli_clearlocks_volume (rpcsvc_request_t *req)
} else {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Empty cli request.");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_CLI_REQ_EMPTY, "Empty cli request.");
goto out;
}
@@ -4164,7 +4315,8 @@ __glusterd_handle_cli_clearlocks_volume (rpcsvc_request_t *req)
if (ret) {
snprintf (err_str, sizeof (err_str), "Unable to get volume "
"name");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLNAME_NOTFOUND_IN_DICT, "%s", err_str);
goto out;
}
@@ -4214,7 +4366,8 @@ get_volinfo_from_brickid (char *brickid, glusterd_volinfo_t **volinfo)
volid_str = brickid_dup;
brick = strchr (brickid_dup, ':');
if (!brick) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_NOT_FOUND,
"Invalid brickid");
goto out;
}
@@ -4227,7 +4380,8 @@ get_volinfo_from_brickid (char *brickid, glusterd_volinfo_t **volinfo)
/* Check if it is a snapshot volume */
ret = glusterd_snap_volinfo_find_by_volume_id (volid, volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_VOLINFO_GET_FAIL,
"Failed to find volinfo");
goto out;
}
@@ -4254,6 +4408,9 @@ __glusterd_handle_barrier (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received from cli");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -4271,14 +4428,17 @@ __glusterd_handle_barrier (rpcsvc_request_t *req)
ret = dict_unserialize (cli_req.dict.dict_val, cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to unserialize "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL, "Failed to unserialize "
"request dictionary.");
goto out;
}
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Volname not present in "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLNAME_NOTFOUND_IN_DICT,
+ "Volname not present in "
"dict");
goto out;
}
@@ -4333,7 +4493,8 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict)
if (ret) {
snprintf (err_str, sizeof (err_str), "Failed to get volume "
"name while handling get volume option command");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLNAME_NOTFOUND_IN_DICT, "%s", err_str);
goto out;
}
@@ -4341,17 +4502,19 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict)
if (ret) {
snprintf (err_str, sizeof (err_str), "Failed to get key "
"while handling get volume option for %s", volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "%s", err_str);
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "Received get volume opt request for "
+ gf_msg_debug (this->name, 0, "Received get volume opt request for "
"volume %s", volname);
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
snprintf (err_str, sizeof(err_str),
FMTSTR_CHECK_VOL_EXISTS, volname);
- gf_log (this->name, GF_LOG_ERROR, FMTSTR_CHECK_VOL_EXISTS,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_NOT_FOUND, FMTSTR_CHECK_VOL_EXISTS,
volname);
goto out;
}
@@ -4360,7 +4523,8 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict)
if (!exists) {
snprintf (err_str, sizeof (err_str), "Option "
"with name: %s does not exist", key);
- gf_log (this->name, GF_LOG_ERROR, "%s",
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_UNKNOWN_KEY, "%s",
err_str);
if (key_fixed)
snprintf (err_str + ret,
@@ -4378,7 +4542,8 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict)
sprintf (dict_key, "key%d", count);
ret = dict_set_str(dict, dict_key, key);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to "
"set %s in dictionary", key);
goto out;
}
@@ -4386,7 +4551,8 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict)
sprintf (op_version_buff, "%d", priv->op_version);
ret = dict_set_str (dict, dict_key, op_version_buff);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to "
"set value for key %s in dictionary",
key);
goto out;
@@ -4396,7 +4562,8 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict)
sprintf (dict_key, "key%d", count);
ret = dict_set_str(dict, dict_key, key);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to "
"set %s in dictionary", key);
goto out;
}
@@ -4407,7 +4574,8 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict)
else
ret = dict_set_str(dict, dict_key,"Disabled");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to "
"set value for key %s in dictionary",
key);
goto out;
@@ -4417,7 +4585,8 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict)
sprintf (dict_key, "key%d", count);
ret = dict_set_str(dict, dict_key, key);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to "
"set %s in dictionary", key);
goto out;
}
@@ -4434,7 +4603,8 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict)
ret = dict_set_str(dict, dict_key,"none");
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to "
"set value for key %s in dictionary",
key);
goto out;
@@ -4459,7 +4629,8 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict)
*/
ret = dict_set_int32 (dict, "count", 1);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set count "
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to set count "
"value in the dictionary");
goto out;
}
@@ -4513,7 +4684,8 @@ __glusterd_handle_get_vol_opt (rpcsvc_request_t *req)
if (ret < 0) {
snprintf (err_str, sizeof (err_str), "Failed to decode "
"request received from cli");
- gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "%s", err_str);
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -4526,7 +4698,8 @@ __glusterd_handle_get_vol_opt (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"failed to "
"unserialize req-buffer to dictionary");
snprintf (err_str, sizeof (err_str), "Unable to decode "
@@ -4631,7 +4804,8 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
brickinfo->path);
ret = get_volinfo_from_brickid (brickid, &volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_GET_FAIL,
"Failed to get volinfo from "
"brickid(%s)", brickid);
goto out;
@@ -4640,7 +4814,8 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
ret = glusterd_brick_stop (volinfo, brickinfo,
_gf_false);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_STOP_FAIL,
"Unable to stop %s:%s",
brickinfo->hostname, brickinfo->path);
goto out;
@@ -4648,7 +4823,7 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
break;
}
- gf_log (this->name, GF_LOG_DEBUG, "Connected to %s:%s",
+ gf_msg_debug (this->name, 0, "Connected to %s:%s",
brickinfo->hostname, brickinfo->path);
glusterd_set_brick_status (brickinfo, GF_BRICK_STARTED);
ret = default_notify (this, GF_EVENT_CHILD_UP, NULL);
@@ -4670,7 +4845,7 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
mydata = NULL;
break;
default:
- gf_log (this->name, GF_LOG_TRACE,
+ gf_msg_trace (this->name, 0,
"got some other RPC event %d", event);
break;
}
@@ -4702,7 +4877,7 @@ glusterd_friend_remove_notify (glusterd_peerctx_t *peerctx)
rcu_read_lock ();
peerinfo = glusterd_peerinfo_find_by_generation (peerctx->peerinfo_gen);
if (!peerinfo) {
- gf_log (THIS->name, GF_LOG_DEBUG, "Could not find peer %s(%s). "
+ gf_msg_debug (THIS->name, 0, "Could not find peer %s(%s). "
"Peer could have been deleted.", peerctx->peername,
uuid_utoa (peerctx->peerid));
ret = 0;
@@ -4717,7 +4892,8 @@ glusterd_friend_remove_notify (glusterd_peerctx_t *peerctx)
&new_event);
if (!ret) {
if (!req) {
- gf_log (THIS->name, GF_LOG_WARNING,
+ gf_msg (THIS->name, GF_LOG_WARNING, 0,
+ GD_MSG_EVENT_NEW_GET_FAIL,
"Unable to find the request for responding "
"to User (%s)", peerinfo->hostname);
goto out;
@@ -4732,7 +4908,8 @@ glusterd_friend_remove_notify (glusterd_peerctx_t *peerctx)
ret = glusterd_friend_sm_inject_event (new_event);
} else {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_EVENT_INJECT_FAIL,
"Unable to create event for removing peer %s",
peerinfo->hostname);
}
@@ -4776,7 +4953,8 @@ __glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata,
/* Peerinfo should be available at this point. Not finding it
* means that something terrible has happened
*/
- gf_log (THIS->name, GF_LOG_CRITICAL, "Could not find peer "
+ gf_msg (THIS->name, GF_LOG_CRITICAL, ENOENT,
+ GD_MSG_PEER_NOT_FOUND, "Could not find peer "
"%s(%s)", peerctx->peername, uuid_utoa (peerctx->peerid));
ret = -1;
goto out;
@@ -4786,7 +4964,7 @@ __glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata,
case RPC_CLNT_CONNECT:
{
rpc_clnt_set_connected (&rpc->conn);
- gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_CONNECT");
+ gf_msg_debug (this->name, 0, "got RPC_CLNT_CONNECT");
peerinfo->connected = 1;
peerinfo->quorum_action = _gf_true;
peerinfo->generation = uatomic_add_return
@@ -4795,7 +4973,9 @@ __glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata,
ret = glusterd_peer_dump_version (this, rpc, peerctx);
if (ret)
- gf_log ("", GF_LOG_ERROR, "glusterd handshake failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_HANDSHAKE_FAILED,
+ "glusterd handshake failed");
break;
}
@@ -4824,8 +5004,9 @@ __glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata,
peerinfo->uuid,
"vol");
if (ret)
- gf_log (this->name,
- GF_LOG_TRACE,
+ gf_msg (this->name,
+ GF_LOG_WARNING, 0,
+ GD_MSG_MGMTV3_UNLOCK_FAIL,
"Lock not released "
"for %s",
volinfo->volname);
@@ -4855,7 +5036,7 @@ __glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata,
}
default:
- gf_log (this->name, GF_LOG_TRACE,
+ gf_msg_trace (this->name, 0,
"got some other RPC event %d", event);
ret = 0;
break;
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index 63d8fc66132..59113cbe104 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -20,6 +20,7 @@
#include "glusterd-svc-helper.h"
#include "glusterd-nfs-svc.h"
#include "glusterd-volgen.h"
+#include "glusterd-messages.h"
#include "run.h"
#include "syscall.h"
@@ -53,6 +54,9 @@ __glusterd_handle_replace_brick (rpcsvc_request_t *req)
ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
//failed to decode msg;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "Failed to decode "
+ "request received from cli");
req->rpc_err = GARBAGE_ARGS;
goto out;
}
@@ -67,7 +71,8 @@ __glusterd_handle_replace_brick (rpcsvc_request_t *req)
cli_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ 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 "
@@ -79,13 +84,14 @@ __glusterd_handle_replace_brick (rpcsvc_request_t *req)
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
snprintf (msg, sizeof (msg), "Could not get volume name");
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "%s", msg);
goto out;
}
ret = dict_get_int32 (dict, "operation", &op);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"dict_get on operation failed");
snprintf (msg, sizeof (msg), "Could not get operation");
goto out;
@@ -95,21 +101,23 @@ __glusterd_handle_replace_brick (rpcsvc_request_t *req)
if (ret) {
snprintf (msg, sizeof (msg), "Failed to get src brick");
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "%s", msg);
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"src brick=%s", src_brick);
ret = dict_get_str (dict, "dst-brick", &dst_brick);
if (ret) {
snprintf (msg, sizeof (msg), "Failed to get dest brick");
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "%s", msg);
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "dst brick=%s", dst_brick);
+ gf_msg_debug (this->name, 0, "dst brick=%s", dst_brick);
gf_log (this->name, GF_LOG_INFO, "Received replace brick commit-force "
"request operation");
@@ -193,31 +201,34 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
ret = dict_get_str (dict, "src-brick", &src_brick);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get src brick");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to get src brick");
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "src brick=%s", src_brick);
+ gf_msg_debug (this->name, 0, "src brick=%s", src_brick);
ret = dict_get_str (dict, "dst-brick", &dst_brick);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get dest brick");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to get dest brick");
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "dst brick=%s", dst_brick);
+ gf_msg_debug (this->name, 0, "dst brick=%s", dst_brick);
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, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to get volume name");
goto out;
}
ret = dict_get_str (dict, "operation", &replace_op);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"dict get on replace-brick operation failed");
goto out;
}
@@ -250,7 +261,8 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
!glusterd_is_valid_volfpath (volname, dst_brick)) {
snprintf (msg, sizeof (msg), "brick path %s is too "
"long.", dst_brick);
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRKPATH_TOO_LONG, "%s", msg);
*op_errstr = gf_strdup (msg);
ret = -1;
@@ -268,7 +280,8 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
if (glusterd_is_defrag_on(volinfo)) {
snprintf (msg, sizeof(msg), "Volume name %s rebalance is in "
"progress. Please retry after completion", volname);
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OIP_RETRY_LATER, "%s", msg);
*op_errstr = gf_strdup (msg);
ret = -1;
goto out;
@@ -294,7 +307,8 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
if (ctx) {
if (!glusterd_is_fuse_available ()) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to open /dev/"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RB_CMD_FAIL, "Unable to open /dev/"
"fuse (%s), replace-brick command failed",
strerror (errno));
snprintf (msg, sizeof(msg), "Fuse unavailable\n "
@@ -306,13 +320,13 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
}
if (gf_is_local_addr (src_brickinfo->hostname)) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"I AM THE SOURCE HOST");
if (src_brickinfo->port && rsp_dict) {
ret = dict_set_int32 (rsp_dict, "src-brick-port",
src_brickinfo->port);
if (ret) {
- gf_log ("", GF_LOG_DEBUG,
+ gf_msg_debug ("", 0,
"Could not set src-brick-port=%d",
src_brickinfo->port);
}
@@ -326,14 +340,16 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
dup_dstbrick = gf_strdup (dst_brick);
if (!dup_dstbrick) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Memory allocation failed");
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Memory allocation failed");
goto out;
}
host = strtok_r (dup_dstbrick, ":", &savetok);
path = strtok_r (NULL, ":", &savetok);
if (!host || !path) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BAD_FORMAT,
"dst brick %s is not of form <HOSTNAME>:<export-dir>",
dst_brick);
ret = -1;
@@ -365,7 +381,8 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
*op_errstr = gf_strdup ("Incorrect source or "
"destination brick");
if (*op_errstr)
- gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_BRICK_NOT_FOUND, "%s", *op_errstr);
goto out;
}
@@ -413,7 +430,8 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
dst_brickinfo->hostname,
dst_brickinfo->mount_dir);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_MOUNTDIR_GET_FAIL,
"Failed to get brick mount_dir");
goto out;
}
@@ -421,14 +439,16 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
ret = dict_set_dynstr_with_alloc (rsp_dict, "brick1.mount_dir",
dst_brickinfo->mount_dir);
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 brick1.mount_dir");
goto out;
}
ret = dict_set_int32 (rsp_dict, "brick_count", 1);
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 local_brick_count");
goto out;
}
@@ -438,7 +458,7 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
out:
GF_FREE (dup_dstbrick);
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -542,7 +562,6 @@ rb_update_dstbrick_port (glusterd_brickinfo_t *dst_brickinfo, dict_t *rsp_dict,
if (!dict_ret)
dst_brickinfo->port = dst_port;
-
if (gf_is_local_addr (dst_brickinfo->hostname)) {
gf_log ("", GF_LOG_INFO,
"adding dst-brick port no");
@@ -616,7 +635,8 @@ glusterd_op_perform_replace_brick (glusterd_volinfo_t *volinfo,
if (conf->op_version >= GD_OP_VERSION_3_6_0) {
ret = dict_get_str (dict, "brick1.mount_dir", &brick_mount_dir);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_BRICK_MOUNTDIR_GET_FAIL,
"brick1.mount_dir not present");
goto out;
}
@@ -673,43 +693,47 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
ret = dict_get_str (dict, "src-brick", &src_brick);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get src brick");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to get src brick");
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "src brick=%s", src_brick);
+ gf_msg_debug (this->name, 0, "src brick=%s", src_brick);
ret = dict_get_str (dict, "dst-brick", &dst_brick);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get dst brick");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to get dst brick");
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "dst brick=%s", dst_brick);
+ gf_msg_debug (this->name, 0, "dst brick=%s", dst_brick);
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, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to get volume name");
goto out;
}
ret = dict_get_str (dict, "operation", &replace_op);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"dict_get on operation failed");
goto out;
}
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to allocate memory");
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Unable to allocate memory");
goto out;
}
ret = glusterd_volume_brickinfo_get_by_brick (src_brick, volinfo,
&src_brickinfo);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Unable to get src-brickinfo");
goto out;
}
@@ -717,14 +741,15 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
ret = glusterd_get_rb_dst_brickinfo (volinfo, &dst_brickinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RB_BRICKINFO_GET_FAIL, "Unable to get "
"replace brick destination brickinfo");
goto out;
}
ret = glusterd_resolve_brick (dst_brickinfo);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Unable to resolve dst-brickinfo");
goto out;
}
@@ -738,7 +763,8 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
if (is_origin_glusterd (dict)) {
ctx = glusterd_op_get_ctx();
if (!ctx) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OPCTX_GET_FAIL, "Failed to "
"get op_ctx");
ret = -1;
goto out;
@@ -758,7 +784,8 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
gf_log (this->name, GF_LOG_DEBUG, "I AM THE DESTINATION HOST");
ret = rb_kill_destination_brick (volinfo, dst_brickinfo);
if (ret) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ GD_MSG_BRK_CLEANUP_FAIL,
"Unable to cleanup dst brick");
goto out;
}
@@ -773,7 +800,8 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
ret = glusterd_op_perform_replace_brick (volinfo, src_brick,
dst_brick, dict);
if (ret) {
- gf_log (this->name, GF_LOG_CRITICAL, "Unable to add dst-brick: "
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ GD_MSG_BRICK_ADD_FAIL, "Unable to add dst-brick: "
"%s to volume: %s", dst_brick, volinfo->volname);
(void) glusterd_svcs_manager (volinfo);
goto out;
@@ -783,7 +811,8 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
ret = glusterd_svcs_manager (volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ GD_MSG_NFS_VOL_FILE_GEN_FAIL,
"Failed to generate nfs volume file");
}
@@ -797,7 +826,8 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
ret = glusterd_store_volinfo (volinfo,
GLUSTERD_VOLINFO_VER_AC_INCREMENT);
if (ret)
- gf_log (this->name, GF_LOG_ERROR, "Couldn't store"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RBOP_STATE_STORE_FAIL, "Couldn't store"
" replace brick operation's state");
out:
@@ -833,73 +863,74 @@ glusterd_do_replace_brick (void *data)
if (priv->timer) {
gf_timer_call_cancel (THIS->ctx, priv->timer);
priv->timer = NULL;
- gf_log ("", GF_LOG_DEBUG,
+ gf_msg_debug ("", 0,
"Cancelling timer thread");
}
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Replace brick operation detected");
ret = dict_get_bin (dict, "transaction_id", (void **)&txn_id);
- gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s",
+ gf_msg_debug (this->name, 0, "transaction ID = %s",
uuid_utoa (*txn_id));
ret = dict_get_str (dict, "src-brick", &src_brick);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to get src brick");
+ gf_msg ("", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to get src brick");
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"src brick=%s", src_brick);
ret = dict_get_str (dict, "dst-brick", &dst_brick);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to get dst brick");
+ gf_msg ("", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to get dst brick");
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"dst brick=%s", dst_brick);
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to find volinfo");
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_VOLINFO_GET_FAIL, "Unable to find volinfo");
goto out;
}
ret = glusterd_volume_brickinfo_get_by_brick (src_brick, volinfo,
&src_brickinfo);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG, "Unable to get "
- "src-brickinfo");
+ gf_msg_debug (this->name, 0, "Unable to get src-brickinfo");
goto out;
}
ret = glusterd_get_rb_dst_brickinfo (volinfo, &dst_brickinfo);
if (!dst_brickinfo) {
- gf_log (this->name, GF_LOG_DEBUG, "Unable to get "
- "dst-brickinfo");
+ gf_msg_debug (this->name, 0, "Unable to get dst-brickinfo");
goto out;
}
ret = glusterd_resolve_brick (dst_brickinfo);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG, "Unable to resolve "
- "dst-brickinfo");
+ gf_msg_debug (this->name, 0, "Unable to resolve dst-brickinfo");
goto out;
}
ret = dict_get_int32 (dict, "src-brick-port", &src_port);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get "
- "src-brick port");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to get src-brick port");
goto out;
}
ret = dict_get_int32 (dict, "dst-brick-port", &dst_port);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to get dst-brick port");
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_GET_FAILED, "Unable to get dst-brick port");
}
dst_brickinfo->port = dst_port;