summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorNandaja Varma <nandaja.varma@gmail.com>2015-03-12 16:55:20 +0530
committerAtin Mukherjee <amukherj@redhat.com>2015-06-14 23:55:59 -0700
commit40795d95697068a0beb52364b97818dc80e49440 (patch)
treed276ec63dfa8ab197110550ef8f3f77c7a61a5d4 /xlators/mgmt
parent2ae034374ce449c54b1b4ae8350401371db1d8d3 (diff)
handshake,locks,mountbroker,syncop/glusterd:New logging framework
Change-Id: If491a6945b7a0afa10165ff9f9874a244aece36f BUG: 1194640 Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com> Reviewed-on: http://review.gluster.org/9864 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c265
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-locks.c105
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mountbroker.c8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c114
4 files changed, 318 insertions, 174 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index 0cb92abca16..52df83f426c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -21,6 +21,7 @@
#include "glusterd-svc-mgmt.h"
#include "glusterd-snapd-svc-helper.h"
#include "glusterd-quotad-svc.h"
+#include "glusterd-messages.h"
#include "glusterfs3.h"
#include "protocol-common.h"
@@ -70,20 +71,25 @@ get_snap_volname_and_volinfo (const char *volpath, char **volname,
strtok_r (str_token, "/", &save_ptr);
snapname = strtok_r(NULL, "/", &save_ptr);
if (!snapname) {
- gf_log(this->name, GF_LOG_ERROR, "Invalid path: %s", volpath);
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY,
+ "Invalid path: %s", volpath);
goto out;
}
volname_token = strtok_r(NULL, "/", &save_ptr);
if (!volname_token) {
- gf_log(this->name, GF_LOG_ERROR, "Invalid path: %s", volpath);
+ gf_msg (this->name, GF_LOG_ERROR,
+ EINVAL, GD_MSG_INVALID_ENTRY,
+ "Invalid path: %s", volpath);
goto out;
}
snap = glusterd_find_snap_by_name (snapname);
if (!snap) {
- gf_log(this->name, GF_LOG_ERROR, "Failed to "
- "fetch snap %s", snapname);
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_SNAP_NOT_FOUND, "Failed to "
+ "fetch snap %s", snapname);
goto out;
}
@@ -105,14 +111,16 @@ get_snap_volname_and_volinfo (const char *volpath, char **volname,
/* Split the volume name */
vol = strtok_r (volname_token, ".", &save_ptr);
if (!vol) {
- gf_log(this->name, GF_LOG_ERROR, "Invalid "
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "Invalid "
"volname (%s)", volname_token);
goto out;
}
ret = glusterd_snap_volinfo_find (vol, snap, volinfo);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg(this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAP_INFO_FAIL, "Failed to "
"fetch snap volume from volname (%s)",
vol);
goto out;
@@ -123,9 +131,10 @@ get_snap_volname_and_volinfo (const char *volpath, char **volname,
ret = glusterd_snap_volinfo_find_from_parent_volname (
volname_token, snap, volinfo);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR, "Failed to "
- "fetch snap volume from parent "
- "volname (%s)", volname_token);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAP_INFO_FAIL, "Failed to "
+ "fetch snap volume from parent "
+ "volname (%s)", volname_token);
goto out;
}
@@ -182,7 +191,8 @@ build_volfile_path (char *volume_id, char *path,
ret = glusterd_volinfo_find (volid_ptr, &volinfo);
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_GET_FAIL,
"Couldn't find volinfo");
goto out;
}
@@ -219,7 +229,8 @@ build_volfile_path (char *volume_id, char *path,
ret = get_snap_volname_and_volinfo (volid_ptr, &volname,
&volinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get snap"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAP_INFO_FAIL, "Failed to get snap"
" volinfo from path (%s)", volume_id);
ret = -1;
goto out;
@@ -247,7 +258,8 @@ build_volfile_path (char *volume_id, char *path,
ret = glusterd_volinfo_find (volid_ptr, &volinfo);
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_GET_FAIL,
"Couldn't find volinfo");
goto out;
}
@@ -366,7 +378,8 @@ glusterd_get_args_from_dict (gf_getspec_req *args, peer_info_t *peerinfo,
ret = dict_unserialize (args->xdata.xdata_val,
args->xdata.xdata_len, &dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"Failed to unserialize request dictionary");
goto out;
}
@@ -374,7 +387,8 @@ glusterd_get_args_from_dict (gf_getspec_req *args, peer_info_t *peerinfo,
ret = dict_get_int32 (dict, "min-op-version",
&client_min_op_version);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED,
"Failed to get client-min-op-version");
goto out;
}
@@ -382,7 +396,8 @@ glusterd_get_args_from_dict (gf_getspec_req *args, peer_info_t *peerinfo,
ret = dict_get_int32 (dict, "max-op-version",
&client_max_op_version);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED,
"Failed to get client-max-op-version");
goto out;
}
@@ -390,13 +405,13 @@ glusterd_get_args_from_dict (gf_getspec_req *args, peer_info_t *peerinfo,
ret = dict_get_str (dict, "brick_name",
brick_name);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"No brick name present");
ret = 0;
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "brick_name = %s", *brick_name);
+ gf_msg_debug (this->name, 0, "brick_name = %s", *brick_name);
out:
peerinfo->max_op_version = client_max_op_version;
peerinfo->min_op_version = client_min_op_version;
@@ -434,7 +449,8 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
/* Find the snap-object */
snap = glusterd_find_snap_by_id (snap_uuid);
if (!snap) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAP_NOT_FOUND,
"Unable to find the snap with snap_uuid %s",
missed_snapinfo->snap_uuid);
ret = -1;
@@ -451,7 +467,8 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
}
if (!snap_vol) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_NOT_FOUND,
"Unable to find the snap_vol(%s) "
"for snap(%s)", snap_opinfo->snap_vol_id,
snap->snapname);
@@ -467,7 +484,8 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
}
if (brickinfo->snap_status != -1) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAP_STATUS_NOT_PENDING,
"The snap status of the missed "
"brick(%s) is not pending", brickinfo->path);
goto out;
@@ -476,7 +494,9 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
/* Fetch the device path */
device = glusterd_get_brick_mount_device (snap_opinfo->brick_path);
if (!device) {
- gf_log (this->name, GF_LOG_ERROR, "Getting device name for the"
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_GET_INFO_FAIL,
+ "Getting device name for the"
"brick %s:%s failed", brickinfo->hostname,
snap_opinfo->brick_path);
ret = -1;
@@ -486,7 +506,9 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
device = glusterd_build_snap_device_path (device, snap_vol->volname,
snap_opinfo->brick_num - 1);
if (!device) {
- gf_log (this->name, GF_LOG_ERROR, "cannot copy the snapshot "
+ gf_msg (this->name, GF_LOG_ERROR, ENXIO,
+ GD_MSG_SNAP_DEVICE_NAME_GET_FAIL,
+ "cannot copy the snapshot "
"device name (volname: %s, snapname: %s)",
snap_vol->volname, snap->snapname);
ret = -1;
@@ -499,7 +521,8 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
* snap volinfo. */
ret = glusterd_update_mntopts (snap_opinfo->brick_path, brickinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to update "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRK_MOUNTOPTS_FAIL, "Failed to update "
"mount options for %s brick", brickinfo->path);
/* We should not fail snapshot operation if we fail to get
* the file-system type */
@@ -507,7 +530,8 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
ret = glusterd_take_lvm_snapshot (brickinfo, snap_opinfo->brick_path);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAPSHOT_OP_FAILED,
"Failed to take snapshot of %s",
snap_opinfo->brick_path);
goto out;
@@ -520,7 +544,8 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
*/
ret = glusterd_update_fs_label (brickinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to update "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_SET_INFO_FAIL, "Failed to update "
"file-system label for %s brick", brickinfo->path);
/* Failing to update label should not cause snapshot failure.
* Currently label is updated only for XFS and ext2/ext3/ext4
@@ -532,7 +557,8 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
ret = glusterd_snap_brick_create (snap_vol, brickinfo,
snap_opinfo->brick_num - 1);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_CREATION_FAIL, "Failed to "
" create and mount the brick(%s) for the snap %s",
snap_opinfo->brick_path,
snap_vol->snapshot->snapname);
@@ -543,7 +569,8 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
ret = glusterd_store_volinfo (snap_vol,
GLUSTERD_VOLINFO_VER_AC_NONE);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to store snapshot "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_STORE_FAIL, "Failed to store snapshot "
"volinfo (%s) for snap %s", snap_vol->volname,
snap->snapname);
goto out;
@@ -551,7 +578,8 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
ret = glusterd_brick_start (snap_vol, brickinfo, _gf_false);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "starting the "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_BRICK_DISCONNECTED, "starting the "
"brick %s:%s for the snap %s failed",
brickinfo->hostname, brickinfo->path,
snap->snapname);
@@ -610,8 +638,9 @@ glusterd_take_missing_brick_snapshots (char *brick_name)
(missed_snapinfo,
snap_opinfo);
if (ret) {
- gf_log (this->name,
- GF_LOG_ERROR,
+ gf_msg (this->name,
+ GF_LOG_ERROR, 0,
+ GD_MSG_MISSED_SNAP_CREATE_FAIL,
"Failed to create "
"missed snap for %s",
brick_name);
@@ -642,7 +671,8 @@ glusterd_take_missing_brick_snapshots (char *brick_name)
if (update_list == _gf_true) {
ret = glusterd_store_update_missed_snaps ();
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MISSED_SNAP_LIST_STORE_FAIL,
"Failed to update missed_snaps_list");
goto out;
}
@@ -678,7 +708,8 @@ _client_supports_volume (peer_info_t *peerinfo, int32_t *op_errno)
(peerinfo->max_op_version < volinfo->client_op_version))) {
ret = _gf_false;
*op_errno = ENOTSUP;
- gf_log ("glusterd", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, ENOTSUP,
+ GD_MSG_UNSUPPORTED_VERSION,
"Client %s (%d -> %d) doesn't support required "
"op-version (%d). Rejecting volfile request.",
peerinfo->identifier, peerinfo->min_op_version,
@@ -733,7 +764,8 @@ __server_getspec (rpcsvc_request_t *req)
ret = glusterd_get_args_from_dict (&args, peerinfo, &brick_name);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED,
"Failed to get args from dict");
goto fail;
}
@@ -773,7 +805,8 @@ __server_getspec (rpcsvc_request_t *req)
/* to allocate the proper buffer to hold the file data */
ret = stat (filename, &stbuf);
if (ret < 0){
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_FILE_OP_FAILED,
"Unable to stat %s (%s)",
filename, strerror (errno));
goto fail;
@@ -781,7 +814,8 @@ __server_getspec (rpcsvc_request_t *req)
spec_fd = open (filename, O_RDONLY);
if (spec_fd < 0) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, errno,
+ GD_MSG_FILE_OP_FAILED,
"Unable to open %s (%s)",
filename, strerror (errno));
goto fail;
@@ -803,11 +837,12 @@ __server_getspec (rpcsvc_request_t *req)
}
if (brick_name) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Look for missing snap creates for %s", brick_name);
op_ret = glusterd_take_missing_brick_snapshots (brick_name);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MISSED_SNAP_CREATE_FAIL,
"Failed to take missing brick snapshots");
ret = -1;
goto fail;
@@ -867,14 +902,17 @@ __server_event_notify (rpcsvc_request_t *req)
ret = dict_unserialize (args.dict.dict_val,
args.dict.dict_len, &dict);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Failed to unserialize req");
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
+ "Failed to unserialize req");
goto fail;
}
}
switch (args.op) {
case GF_EN_DEFRAG_STATUS:
- gf_log ("", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_DEFRAG_STATUS_UPDATED,
"received defrag status updated");
if (dict) {
glusterd_defrag_event_notify_handle (dict);
@@ -882,7 +920,8 @@ __server_event_notify (rpcsvc_request_t *req)
}
break;
default:
- gf_log ("", GF_LOG_ERROR, "Unknown op received in event "
+ gf_msg ("glusterd", GF_LOG_ERROR, EINVAL,
+ GD_MSG_OP_UNSUPPORTED, "Unknown op received in event "
"notify");
ret = -1;
break;
@@ -920,7 +959,8 @@ gd_validate_cluster_op_version (xlator_t *this, int cluster_op_version,
conf = this->private;
if (cluster_op_version > GD_OP_VERSION_MAX) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_VERSION_MISMATCH,
"operating version %d is more than the maximum "
"supported (%d) on the machine (as per peer request "
"from %s)", cluster_op_version, GD_OP_VERSION_MAX,
@@ -934,7 +974,8 @@ gd_validate_cluster_op_version (xlator_t *this, int cluster_op_version,
*/
if ((cluster_op_version < conf->op_version) &&
!cds_list_empty (&conf->volumes)) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_VERS_ADJUST_FAIL,
"cannot reduce operating version to %d from current "
"version %d as volumes exist (as per peer request from "
"%s)", cluster_op_version, conf->op_version, peerid);
@@ -995,7 +1036,8 @@ gd_validate_mgmt_hndsk_req (rpcsvc_request_t *req, dict_t *dict)
rcu_read_unlock ();
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Rejecting management "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_HANDSHAKE_REQ_REJECTED, "Rejecting management "
"handshake request from unknown peer %s",
req->trans->peerinfo.identifier);
return _gf_false;
@@ -1043,7 +1085,8 @@ __glusterd_mgmt_hndsk_versions (rpcsvc_request_t *req)
ret = dict_set_int32 (dict, GD_OP_VERSION_KEY, conf->op_version);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_DICT_SET_FAILED,
"failed to set operating version");
rsp.op_ret = ret;
goto out;
@@ -1051,7 +1094,8 @@ __glusterd_mgmt_hndsk_versions (rpcsvc_request_t *req)
ret = dict_set_int32 (dict, GD_MIN_OP_VERSION_KEY, GD_OP_VERSION_MIN);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_DICT_SET_FAILED,
"failed to set %s", GD_MIN_OP_VERSION_KEY);
rsp.op_ret = ret;
goto out;
@@ -1059,7 +1103,8 @@ __glusterd_mgmt_hndsk_versions (rpcsvc_request_t *req)
ret = dict_set_int32 (dict, GD_MAX_OP_VERSION_KEY, GD_OP_VERSION_MAX);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_DICT_SET_FAILED,
"failed to set %s", GD_MAX_OP_VERSION_KEY);
rsp.op_ret = ret;
goto out;
@@ -1127,7 +1172,8 @@ __glusterd_mgmt_hndsk_versions_ack (rpcsvc_request_t *req)
ret = dict_get_int32 (clnt_dict, GD_OP_VERSION_KEY, &peer_op_version);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_DICT_GET_FAILED,
"failed to get the op-version key peer=%s",
req->trans->peerinfo.identifier);
goto out;
@@ -1142,12 +1188,15 @@ __glusterd_mgmt_hndsk_versions_ack (rpcsvc_request_t *req)
/* As this is ACK from the Cluster for the versions supported,
can set the op-version of 'this' glusterd to the one
received. */
- gf_log (this->name, GF_LOG_INFO, "using the op-version %d",
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_VERS_INFO, "using the op-version %d",
peer_op_version);
conf->op_version = peer_op_version;
ret = glusterd_store_global_info (this);
if (ret)
- gf_log (this->name, GF_LOG_ERROR, "Failed to store op-version");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_GLOBAL_OP_VERSION_SET_FAIL,
+ "Failed to store op-version");
out:
rsp.op_ret = ret;
@@ -1195,13 +1244,15 @@ __server_get_volume_info (rpcsvc_request_t *req)
req->rpc_err = GARBAGE_ARGS;
goto out;
}
- gf_log ("glusterd", GF_LOG_INFO, "Received get volume info req");
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_VOL_INFO_REQ_RECVD, "Received get volume info req");
if (vol_info_req.dict.dict_len) {
/* Unserialize the dictionary */
dict = dict_new ();
if (!dict) {
- gf_log ("", GF_LOG_WARNING, "Out of Memory");
+ gf_msg ("glusterd", GF_LOG_WARNING, ENOMEM,
+ GD_MSG_NO_MEMORY, "Out of Memory");
op_errno = ENOMEM;
ret = -1;
goto out;
@@ -1211,7 +1262,8 @@ __server_get_volume_info (rpcsvc_request_t *req)
vol_info_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");
op_errno = -ret;
@@ -1224,7 +1276,8 @@ __server_get_volume_info (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, -ret,
+ GD_MSG_DICT_GET_FAILED, "failed to get flags");
op_errno = -ret;
ret = -1;
goto out;
@@ -1232,7 +1285,8 @@ __server_get_volume_info (rpcsvc_request_t *req)
if (!flags) {
/* Nothing to query about. Just return success */
- gf_log (THIS->name, GF_LOG_ERROR, "No flags set");
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_NO_FLAG_SET, "No flags set");
ret = 0;
goto out;
}
@@ -1261,7 +1315,8 @@ __server_get_volume_info (rpcsvc_request_t *req)
dict_rsp = dict_new ();
if (!dict_rsp) {
- gf_log ("", GF_LOG_WARNING, "Out of Memory");
+ gf_msg ("glusterd", GF_LOG_WARNING, ENOMEM,
+ GD_MSG_NO_MEMORY, "Out of Memory");
op_errno = ENOMEM;
ret = -1;
goto out;
@@ -1332,7 +1387,8 @@ __server_get_snap_info (rpcsvc_request_t *req)
(xdrproc_t)xdr_gf_getsnap_name_uuid_req);
if (ret < 0) {
req->rpc_err = GARBAGE_ARGS;
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL,
"Failed to decode management handshake response");
goto out;
}
@@ -1349,7 +1405,8 @@ __server_get_snap_info (rpcsvc_request_t *req)
snap_info_req.dict.dict_len,
&dict);
if (ret < 0) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, EINVAL,
+ GD_MSG_DICT_UNSERIALIZE_FAIL,
"Failed to unserialize dictionary");
op_errno = EINVAL;
ret = -1;
@@ -1362,7 +1419,8 @@ __server_get_snap_info (rpcsvc_request_t *req)
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
op_errno = EINVAL;
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, EINVAL,
+ GD_MSG_DICT_GET_FAILED,
"Failed to retrieve volname");
ret = -1;
goto out;
@@ -1379,7 +1437,8 @@ __server_get_snap_info (rpcsvc_request_t *req)
&snap_info_rsp);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR,
+ gf_msg ("glusterd", GF_LOG_ERROR, EINVAL,
+ GD_MSG_VOL_NOT_FOUND,
"Error getting snapshot volume names and uuids : %s",
volname);
op_errno = EINVAL;
@@ -1508,7 +1567,8 @@ glusterd_event_connected_inject (glusterd_peerctx_t *peerctx)
(GD_FRIEND_EVENT_CONNECTED, &event);
if (ret) {
- gf_log ("", 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;
}
@@ -1516,7 +1576,8 @@ glusterd_event_connected_inject (glusterd_peerctx_t *peerctx)
if (!ctx) {
ret = -1;
- gf_log ("", GF_LOG_ERROR, "Memory not available");
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Memory not available");
goto out;
}
@@ -1525,7 +1586,8 @@ glusterd_event_connected_inject (glusterd_peerctx_t *peerctx)
peerinfo = glusterd_peerinfo_find_by_generation (peerctx->peerinfo_gen);
if (!peerinfo) {
ret = -1;
- gf_log (THIS->name, GF_LOG_ERROR, "Could not find peer %s(%s)",
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEER_NOT_FOUND, "Could not find peer %s(%s)",
peerctx->peername, uuid_utoa (peerctx->peerid));
goto unlock;
}
@@ -1541,13 +1603,14 @@ glusterd_event_connected_inject (glusterd_peerctx_t *peerctx)
ret = glusterd_friend_sm_inject_event (event);
if (ret)
- gf_log ("glusterd", GF_LOG_ERROR, "Unable to inject "
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_EVENT_INJECT_FAIL, "Unable to inject "
"EVENT_CONNECTED ret = %d", ret);
unlock:
rcu_read_unlock ();
out:
- gf_log ("", GF_LOG_DEBUG, "returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "returning %d", ret);
return ret;
}
@@ -1593,7 +1656,7 @@ gd_validate_peer_op_version (xlator_t *this, glusterd_peerinfo_t *peerinfo,
ret = 0;
out:
- gf_log (this->name , GF_LOG_DEBUG, "Peer %s %s", peerinfo->hostname,
+ gf_msg_debug (this->name , 0, "Peer %s %s", peerinfo->hostname,
((ret < 0) ? "rejected" : "accepted"));
return ret;
}
@@ -1618,7 +1681,7 @@ __glusterd_mgmt_hndsk_version_ack_cbk (struct rpc_req *req, struct iovec *iov,
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)",
peerctx->peername, uuid_utoa (peerctx->peerid));
ret = -1;
goto out;
@@ -1627,7 +1690,8 @@ __glusterd_mgmt_hndsk_version_ack_cbk (struct rpc_req *req, struct iovec *iov,
if (-1 == req->rpc_status) {
snprintf (msg, sizeof (msg),
"Error through RPC layer, retry again later");
- gf_log ("", GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RPC_LAYER_ERROR, "%s", msg);
peerctx->errstr = gf_strdup (msg);
goto out;
}
@@ -1635,7 +1699,8 @@ __glusterd_mgmt_hndsk_version_ack_cbk (struct rpc_req *req, struct iovec *iov,
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_mgmt_hndsk_rsp);
if (ret < 0) {
snprintf (msg, sizeof (msg), "Failed to decode XDR");
- gf_log ("", GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "%s", msg);
peerctx->errstr = gf_strdup (msg);
goto out;
}
@@ -1645,7 +1710,8 @@ __glusterd_mgmt_hndsk_version_ack_cbk (struct rpc_req *req, struct iovec *iov,
ret = -1;
snprintf (msg, sizeof (msg),
"Failed to get handshake ack from remote server");
- gf_log (frame->this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (frame->this->name, GF_LOG_ERROR, 0,
+ GD_MSG_NO_HANDSHAKE_ACK, "%s", msg);
peerctx->errstr = gf_strdup (msg);
goto out;
}
@@ -1665,7 +1731,8 @@ __glusterd_mgmt_hndsk_version_ack_cbk (struct rpc_req *req, struct iovec *iov,
} else if (GD_MODE_SWITCH_ON == peerctx->args.mode) {
peerctx->args.mode = GD_MODE_ON;
} else {
- gf_log (this->name, GF_LOG_WARNING, "unknown mode %d",
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_UNKNOWN_MODE, "unknown mode %d",
peerctx->args.mode);
}
@@ -1723,7 +1790,7 @@ __glusterd_mgmt_hndsk_version_cbk (struct rpc_req *req, struct iovec *iov,
peerinfo = glusterd_peerinfo_find_by_generation (peerctx->peerinfo_gen);
if (!peerinfo) {
ret = -1;
- 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)",
peerctx->peername, uuid_utoa (peerctx->peerid));
goto out;
}
@@ -1732,7 +1799,8 @@ __glusterd_mgmt_hndsk_version_cbk (struct rpc_req *req, struct iovec *iov,
ret = -1;
snprintf (msg, sizeof (msg),
"Error through RPC layer, retry again later");
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RPC_LAYER_ERROR, "%s", msg);
peerctx->errstr = gf_strdup (msg);
goto out;
}
@@ -1741,7 +1809,8 @@ __glusterd_mgmt_hndsk_version_cbk (struct rpc_req *req, struct iovec *iov,
if (ret < 0) {
snprintf (msg, sizeof (msg), "Failed to decode management "
"handshake response");
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "%s", msg);
peerctx->errstr = gf_strdup (msg);
goto out;
}
@@ -1752,7 +1821,8 @@ __glusterd_mgmt_hndsk_version_cbk (struct rpc_req *req, struct iovec *iov,
op_errno = rsp.op_errno;
if (-1 == rsp.op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ GD_MSG_VERS_GET_FAIL,
"failed to get the 'versions' from peer (%s)",
req->conn->trans->peerinfo.identifier);
goto out;
@@ -1762,7 +1832,8 @@ __glusterd_mgmt_hndsk_version_cbk (struct rpc_req *req, struct iovec *iov,
ret = gd_validate_peer_op_version (this, peerinfo, dict,
&peerctx->errstr);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_OP_VERSION_MISMATCH,
"failed to validate the operating version of peer (%s)",
peerinfo->hostname);
goto out;
@@ -1774,7 +1845,8 @@ __glusterd_mgmt_hndsk_version_cbk (struct rpc_req *req, struct iovec *iov,
ret = dict_set_int32 (rsp_dict, GD_OP_VERSION_KEY, conf->op_version);
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 operating version in dict");
goto out;
}
@@ -1844,7 +1916,8 @@ glusterd_mgmt_handshake (xlator_t *this, glusterd_peerctx_t *peerctx)
ret = dict_set_dynstr (req_dict, GD_PEER_ID_KEY,
gf_strdup (uuid_utoa (MY_UUID)));
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
"failed to set peer ID in dict");
goto out;
}
@@ -1856,7 +1929,7 @@ glusterd_mgmt_handshake (xlator_t *this, glusterd_peerctx_t *peerctx)
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)",
peerctx->peername, uuid_utoa (peerctx->peerid));
goto unlock;
}
@@ -1903,7 +1976,7 @@ glusterd_set_clnt_mgmt_program (glusterd_peerinfo_t *peerinfo,
}
if (ret) {
- gf_log ("", GF_LOG_DEBUG,
+ gf_msg_debug ("glusterd", 0,
"%s (%"PRId64":%"PRId64") not supported",
trav->progname, trav->prognum,
trav->progver);
@@ -1913,21 +1986,24 @@ glusterd_set_clnt_mgmt_program (glusterd_peerinfo_t *peerinfo,
}
if (peerinfo->mgmt) {
- gf_log ("", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_VERS_INFO,
"Using Program %s, Num (%d), Version (%d)",
peerinfo->mgmt->progname, peerinfo->mgmt->prognum,
peerinfo->mgmt->progver);
}
if (peerinfo->peer) {
- gf_log ("", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_VERS_INFO,
"Using Program %s, Num (%d), Version (%d)",
peerinfo->peer->progname, peerinfo->peer->prognum,
peerinfo->peer->progver);
}
if (peerinfo->mgmt_v3) {
- gf_log ("", GF_LOG_INFO,
+ gf_msg ("glusterd", GF_LOG_INFO, 0,
+ GD_MSG_VERS_INFO,
"Using Program %s, Num (%d), Version (%d)",
peerinfo->mgmt_v3->progname,
peerinfo->mgmt_v3->prognum,
@@ -1985,7 +2061,7 @@ __glusterd_peer_dump_version_cbk (struct rpc_req *req, struct iovec *iov,
peerinfo = glusterd_peerinfo_find_by_generation (peerctx->peerinfo_gen);
if (!peerinfo) {
- gf_log (this->name, GF_LOG_DEBUG, "Couldn't find peer %s(%s)",
+ gf_msg_debug (this->name, 0, "Couldn't find peer %s(%s)",
peerctx->peername, uuid_utoa (peerctx->peerid));
goto out;
}
@@ -1993,7 +2069,8 @@ __glusterd_peer_dump_version_cbk (struct rpc_req *req, struct iovec *iov,
if (-1 == req->rpc_status) {
snprintf (msg, sizeof (msg),
"Error through RPC layer, retry again later");
- gf_log ("", GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RPC_LAYER_ERROR, "%s", msg);
peerctx->errstr = gf_strdup (msg);
goto out;
}
@@ -2001,20 +2078,22 @@ __glusterd_peer_dump_version_cbk (struct rpc_req *req, struct iovec *iov,
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_dump_rsp);
if (ret < 0) {
snprintf (msg, sizeof (msg), "Failed to decode XDR");
- gf_log ("", GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_REQ_DECODE_FAIL, "%s", msg);
peerctx->errstr = gf_strdup (msg);
goto out;
}
if (-1 == rsp.op_ret) {
snprintf (msg, sizeof (msg),
"Failed to get the 'versions' from remote server");
- gf_log (frame->this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (frame->this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VERS_GET_FAIL, "%s", msg);
peerctx->errstr = gf_strdup (msg);
goto out;
}
if (_mgmt_hndsk_prog_present (rsp.prog)) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Proceeding to op-version handshake with peer %s",
peerinfo->hostname);
ret = glusterd_mgmt_handshake (this, peerctx);
@@ -2025,14 +2104,17 @@ __glusterd_peer_dump_version_cbk (struct rpc_req *req, struct iovec *iov,
"Peer %s does not support required op-version",
peerinfo->hostname);
peerctx->errstr = gf_strdup (msg);
- gf_log (this->name, GF_LOG_ERROR, "%s", msg);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VERSION_UNSUPPORTED, "%s", msg);
goto out;
}
/* Make sure we assign the proper program to peer */
ret = glusterd_set_clnt_mgmt_program (peerinfo, rsp.prog);
if (ret) {
- gf_log ("", GF_LOG_WARNING, "failed to set the mgmt program");
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_MGMT_PGM_SET_FAIL,
+ "failed to set the mgmt program");
goto out;
}
@@ -2044,7 +2126,8 @@ __glusterd_peer_dump_version_cbk (struct rpc_req *req, struct iovec *iov,
} else if (GD_MODE_SWITCH_ON == peerctx->args.mode) {
peerctx->args.mode = GD_MODE_ON;
} else {
- gf_log ("", GF_LOG_WARNING, "unknown mode %d",
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_UNKNOWN_MODE, "unknown mode %d",
peerctx->args.mode);
}
@@ -2106,7 +2189,7 @@ glusterd_peer_dump_version (xlator_t *this, struct rpc_clnt *rpc,
peerinfo = glusterd_peerinfo_find_by_generation (peerctx->peerinfo_gen);
if (!peerinfo) {
- gf_log (this->name, GF_LOG_DEBUG, "Couldn't find peer %s(%s)",
+ gf_msg_debug (this->name, 0, "Couldn't find peer %s(%s)",
peerctx->peername, uuid_utoa (peerctx->peerid));
goto unlock;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c
index 5a4e00f6774..cbaa92d0bc6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-locks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-locks.c
@@ -19,6 +19,7 @@
#include "glusterd-errno.h"
#include "run.h"
#include "syscall.h"
+#include "glusterd-messages.h"
#include <signal.h>
@@ -108,7 +109,8 @@ glusterd_get_mgmt_v3_lock_owner (char *key, uuid_t *uuid)
GF_ASSERT (priv);
if (!key || !uuid) {
- gf_log (this->name, GF_LOG_ERROR, "key or uuid is null.");
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "key or uuid is null.");
ret = -1;
goto out;
}
@@ -121,7 +123,7 @@ glusterd_get_mgmt_v3_lock_owner (char *key, uuid_t *uuid)
ret = 0;
out:
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -145,7 +147,7 @@ glusterd_release_multiple_locks_per_entity (dict_t *dict, uuid_t uuid,
GF_ASSERT (type);
if (locked_count == 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"No %s locked as part of this transaction",
type);
goto out;
@@ -160,7 +162,8 @@ glusterd_release_multiple_locks_per_entity (dict_t *dict, uuid_t uuid,
* as key in the dict snapname2 */
ret = dict_get_str (dict, name_buf, &name);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED,
"Unable to get %s locked_count = %d",
name_buf, locked_count);
op_ret = ret;
@@ -169,7 +172,8 @@ glusterd_release_multiple_locks_per_entity (dict_t *dict, uuid_t uuid,
ret = glusterd_mgmt_v3_unlock (name, uuid, type);
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 lock for %s.",
name);
op_ret = ret;
@@ -177,7 +181,7 @@ glusterd_release_multiple_locks_per_entity (dict_t *dict, uuid_t uuid,
}
out:
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", op_ret);
+ gf_msg_trace (this->name, 0, "Returning %d", op_ret);
return op_ret;
}
@@ -211,7 +215,8 @@ glusterd_acquire_multiple_locks_per_entity (dict_t *dict, uuid_t uuid,
* as key in the dict snapname2 */
ret = dict_get_str (dict, name_buf, &name);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED,
"Unable to get %s count = %d",
name_buf, count);
break;
@@ -219,7 +224,8 @@ glusterd_acquire_multiple_locks_per_entity (dict_t *dict, uuid_t uuid,
ret = glusterd_mgmt_v3_lock (name, uuid, op_errno, type);
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 lock for %s %s "
"on behalf of %s. Reversing "
"this transaction", type, name,
@@ -240,13 +246,14 @@ glusterd_acquire_multiple_locks_per_entity (dict_t *dict, uuid_t uuid,
locked_count,
type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MULTIPLE_LOCK_RELEASE_FAIL,
"Failed to release multiple %s locks",
type);
}
ret = -1;
out:
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -290,14 +297,16 @@ glusterd_mgmt_v3_unlock_entity (dict_t *dict, uuid_t uuid, char *type,
type);
ret = dict_get_str (dict, name_buf, &name);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED,
"Unable to fetch %sname", type);
goto out;
}
ret = glusterd_mgmt_v3_unlock (name, uuid, type);
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 lock for %s %s "
"on behalf of %s.", type, name,
uuid_utoa(uuid));
@@ -310,7 +319,8 @@ glusterd_mgmt_v3_unlock_entity (dict_t *dict, uuid_t uuid, char *type,
count,
type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MULTIPLE_LOCK_RELEASE_FAIL,
"Failed to release all %s locks", type);
goto out;
}
@@ -318,7 +328,7 @@ glusterd_mgmt_v3_unlock_entity (dict_t *dict, uuid_t uuid, char *type,
ret = 0;
out:
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -361,14 +371,16 @@ glusterd_mgmt_v3_lock_entity (dict_t *dict, uuid_t uuid, uint32_t *op_errno,
type);
ret = dict_get_str (dict, name_buf, &name);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED,
"Unable to fetch %sname", type);
goto out;
}
ret = glusterd_mgmt_v3_lock (name, uuid, op_errno, type);
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 lock for %s %s "
"on behalf of %s.", type, name,
uuid_utoa(uuid));
@@ -382,7 +394,8 @@ glusterd_mgmt_v3_lock_entity (dict_t *dict, uuid_t uuid, uint32_t *op_errno,
count,
type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MULTIPLE_LOCK_ACQUIRE_FAIL,
"Failed to acquire all %s locks", type);
goto out;
}
@@ -390,7 +403,7 @@ glusterd_mgmt_v3_lock_entity (dict_t *dict, uuid_t uuid, uint32_t *op_errno,
ret = 0;
out:
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -408,7 +421,8 @@ glusterd_multiple_mgmt_v3_unlock (dict_t *dict, uuid_t uuid)
GF_ASSERT(this);
if (!dict) {
- gf_log (this->name, GF_LOG_ERROR, "dict is null.");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_EMPTY, "dict is null.");
ret = -1;
goto out;
}
@@ -419,7 +433,8 @@ glusterd_multiple_mgmt_v3_unlock (dict_t *dict, uuid_t uuid)
valid_types[i].type,
valid_types[i].default_value);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MULTIPLE_LOCK_RELEASE_FAIL,
"Unable to unlock all %s",
valid_types[i].type);
op_ret = ret;
@@ -428,7 +443,7 @@ glusterd_multiple_mgmt_v3_unlock (dict_t *dict, uuid_t uuid)
ret = op_ret;
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -446,7 +461,8 @@ glusterd_multiple_mgmt_v3_lock (dict_t *dict, uuid_t uuid, uint32_t *op_errno)
GF_ASSERT(this);
if (!dict) {
- gf_log (this->name, GF_LOG_ERROR, "dict is null.");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_EMPTY, "dict is null.");
ret = -1;
goto out;
}
@@ -458,7 +474,8 @@ glusterd_multiple_mgmt_v3_lock (dict_t *dict, uuid_t uuid, uint32_t *op_errno)
valid_types[i].type,
valid_types[i].default_value);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MULTIPLE_LOCK_ACQUIRE_FAIL,
"Unable to lock all %s",
valid_types[i].type);
break;
@@ -479,14 +496,15 @@ glusterd_multiple_mgmt_v3_lock (dict_t *dict, uuid_t uuid, uint32_t *op_errno)
valid_types[i].type,
valid_types[i].default_value);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_MULTIPLE_LOCK_RELEASE_FAIL,
"Unable to unlock all %s",
valid_types[i].type);
}
}
ret = -1;
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -510,7 +528,8 @@ glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, uint32_t *op_errno,
GF_ASSERT (priv);
if (!name || !type) {
- gf_log (this->name, GF_LOG_ERROR, "name or type is null.");
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "name or type is null.");
ret = -1;
goto out;
}
@@ -527,17 +546,18 @@ glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, uint32_t *op_errno,
ret = snprintf (key, sizeof(key), "%s_%s", name, type);
if (ret != strlen(name) + 1 + strlen(type)) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Unable to create key");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_CREATE_KEY_FAIL, "Unable to create key");
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Trying to acquire lock of %s %s for %s as %s",
type, name, uuid_utoa (uuid), key);
ret = glusterd_get_mgmt_v3_lock_owner (key, &owner);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Unable to get mgmt_v3 lock owner");
goto out;
}
@@ -565,7 +585,8 @@ glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, uint32_t *op_errno,
ret = dict_set_bin (priv->mgmt_v3_lock, key, lock_obj,
sizeof(glusterd_mgmt_v3_lock_obj));
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
"Unable to set lock owner in mgmt_v3 lock");
if (lock_obj)
GF_FREE (lock_obj);
@@ -578,19 +599,20 @@ glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, uint32_t *op_errno,
name, type);
ret = dict_set_dynstr_with_alloc (priv->mgmt_v3_lock, key, bt);
if (ret)
- gf_log (this->name, GF_LOG_WARNING, "Failed to save "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to save "
"the back trace for lock %s-%s granted to %s",
name, type, uuid_utoa (uuid));
ret = 0;
}
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Lock for %s %s successfully held by %s",
type, name, uuid_utoa (uuid));
ret = 0;
out:
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -610,7 +632,8 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
GF_ASSERT (priv);
if (!name || !type) {
- gf_log (this->name, GF_LOG_ERROR, "name is null.");
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "name is null.");
ret = -1;
goto out;
}
@@ -627,18 +650,19 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
ret = snprintf (key, sizeof(key), "%s_%s",
name, type);
if (ret != strlen(name) + 1 + strlen(type)) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to create key");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_CREATE_KEY_FAIL, "Unable to create key");
ret = -1;
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Trying to release lock of %s %s for %s as %s",
type, name, uuid_utoa (uuid), key);
ret = glusterd_get_mgmt_v3_lock_owner (key, &owner);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Unable to get mgmt_v3 lock owner");
goto out;
}
@@ -667,19 +691,20 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
type);
if (ret != strlen ("debug.last-success-bt-") + strlen (name) +
strlen (type) + 1) {
- gf_log (this->name, GF_LOG_ERROR, "Unable to create backtrace "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_CREATE_KEY_FAIL, "Unable to create backtrace "
"key");
ret = -1;
goto out;
}
dict_del (priv->mgmt_v3_lock, key);
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Lock for %s %s successfully released",
type, name);
ret = 0;
out:
- 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-mountbroker.c b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
index 839637d8a13..4ed2fb7035d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
@@ -27,6 +27,7 @@
#include "common-utils.h"
#include "glusterd-mountbroker.h"
#include "glusterd-op-sm.h"
+#include "glusterd-messages.h"
static int
seq_dict_foreach (dict_t *dict,
@@ -213,7 +214,8 @@ parse_mount_pattern_desc (gf_mount_spec_t *mspec, char *pdesc)
out:
if (ret == SYNTAX_ERR) {
- gf_log ("", GF_LOG_ERROR, "cannot parse mount patterns %s",
+ gf_msg ("glusterd", GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "cannot parse mount patterns %s",
pdesc);
}
@@ -666,7 +668,9 @@ glusterd_do_mount (char *label, dict_t *argdict, char **path, int *op_errno)
if (*op_errno) {
ret = -1;
- gf_log ("", GF_LOG_WARNING, "unsuccessful mount request (%s)",
+ gf_msg (this->name, GF_LOG_WARNING, *op_errno,
+ GD_MSG_MOUNT_REQ_FAIL,
+ "unsuccessful mount request (%s)",
strerror (*op_errno));
if (mtptemp) {
*cookieswitch = '/';
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index da12cba39da..37daa9d1e8f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -109,7 +109,8 @@ gd_collate_errors (struct syncargs *args, int op_ret, int op_errno,
"%s", op_err);
err_str[len] = '\0';
- gf_log ("", GF_LOG_ERROR, "%s", op_err);
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_MGMT_OP_FAIL, "%s", op_err);
args->errstr = gf_strdup (err_str);
}
@@ -237,7 +238,8 @@ glusterd_syncop_aggr_rsp_dict (glusterd_op_t op, dict_t *aggr, dict_t *rsp)
case GD_OP_START_VOLUME:
ret = glusterd_aggr_brick_mount_dirs (aggr, rsp);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_MOUNDIRS_AGGR_FAIL, "Failed to "
"aggregate brick mount dirs");
goto out;
}
@@ -418,7 +420,7 @@ gd_syncop_mgmt_v3_lock (glusterd_op_t op, dict_t *op_ctx,
(xdrproc_t)
xdr_gd1_mgmt_v3_lock_req);
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -517,7 +519,7 @@ gd_syncop_mgmt_v3_unlock (dict_t *op_ctx, glusterd_peerinfo_t *peerinfo,
(xdrproc_t)
xdr_gd1_mgmt_v3_unlock_req);
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
return ret;
}
@@ -766,7 +768,8 @@ _gd_syncop_stage_op_cbk (struct rpc_req *req, struct iovec *iov,
rcu_read_unlock ();
if (ret) {
ret = -1;
- gf_log (this->name, GF_LOG_CRITICAL, "Staging response "
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ GD_MSG_RESP_FROM_UNKNOWN_PEER, "Staging response "
"for 'Volume %s' received from unknown "
"peer: %s", gd_op_list[rsp.op],
uuid_utoa (rsp.uuid));
@@ -782,7 +785,8 @@ _gd_syncop_stage_op_cbk (struct rpc_req *req, struct iovec *iov,
ret = glusterd_syncop_aggr_rsp_dict (rsp.op, args->dict,
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");
}
@@ -963,7 +967,8 @@ gd_syncop_mgmt_brick_op (struct rpc_clnt *rpc, glusterd_pending_node_t *pnode,
if (GD_OP_STATUS_VOLUME == op) {
ret = dict_set_int32 (args.dict, "index", pnode->index);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
"Error setting index on brick status"
" rsp dict");
args.op_ret = -1;
@@ -1042,7 +1047,8 @@ _gd_syncop_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
rcu_read_unlock ();
if (ret) {
ret = -1;
- gf_log (this->name, GF_LOG_CRITICAL, "Commit response "
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ GD_MSG_RESP_FROM_UNKNOWN_PEER, "Commit response "
"for 'Volume %s' received from unknown "
"peer: %s", gd_op_list[rsp.op],
uuid_utoa (rsp.uuid));
@@ -1053,7 +1059,8 @@ _gd_syncop_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
if (rsp.op == GD_OP_QUOTA) {
ret = dict_get_int32 (args->dict, "type", &type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Failed to get "
"opcode");
goto out;
}
@@ -1065,7 +1072,8 @@ _gd_syncop_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
ret = glusterd_syncop_aggr_rsp_dict (rsp.op, args->dict,
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");
}
@@ -1193,7 +1201,8 @@ gd_lock_op_phase (glusterd_conf_t *conf, glusterd_op_t op, dict_t *op_ctx,
if (ret == -1)
*op_errstr = NULL;
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEER_LOCK_FAIL,
"Failed to acquire lock");
}
@@ -1201,7 +1210,7 @@ gd_lock_op_phase (glusterd_conf_t *conf, glusterd_op_t op, dict_t *op_ctx,
ret = args.op_ret;
- gf_log (this->name, GF_LOG_DEBUG, "Sent lock op req for 'Volume %s' "
+ gf_msg_debug (this->name, 0, "Sent lock op req for 'Volume %s' "
"to %d peers. Returning %d", gd_op_list[op], peer_cnt, ret);
out:
return ret;
@@ -1257,7 +1266,8 @@ gd_stage_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
op == GD_OP_START_VOLUME)) {
ret = glusterd_syncop_aggr_rsp_dict (op, aggr_dict, 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;
}
@@ -1267,7 +1277,8 @@ gd_stage_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
stage_done:
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, LOGSTR_STAGE_FAIL,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VALIDATE_FAILED, LOGSTR_STAGE_FAIL,
gd_op_list[op], hostname, (*op_errstr) ? ":" : " ",
(*op_errstr) ? *op_errstr : " ");
if (*op_errstr == NULL)
@@ -1306,7 +1317,7 @@ stage_done:
}
- gf_log (this->name, GF_LOG_DEBUG, "Sent stage op req for 'Volume %s' "
+ gf_msg_debug (this->name, 0, "Sent stage op req for 'Volume %s' "
"to %d peers", gd_op_list[op], peer_cnt);
gd_synctask_barrier_wait((&args), peer_cnt);
@@ -1323,7 +1334,8 @@ out:
ret = glusterd_validate_and_set_gfid (op_ctx, req_dict,
op_errstr);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_GFID_VALIDATE_SET_FAIL,
"Failed to validate and set gfid");
}
@@ -1368,7 +1380,8 @@ gd_commit_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
if (op == GD_OP_QUOTA) {
ret = dict_get_int32 (op_ctx, "type", &type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Failed to get "
"opcode");
goto out;
}
@@ -1381,9 +1394,11 @@ gd_commit_op_phase (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", "Failed to aggregate "
- "response from node/brick");
- goto out;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RESP_AGGR_FAIL, "%s",
+ "Failed to aggregate "
+ "response from node/brick");
+ goto out;
}
}
@@ -1392,7 +1407,8 @@ gd_commit_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
commit_done:
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, LOGSTR_COMMIT_FAIL,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_COMMIT_OP_FAIL, LOGSTR_COMMIT_FAIL,
gd_op_list[op], hostname, (*op_errstr) ? ":" : " ",
(*op_errstr) ? *op_errstr : " ");
if (*op_errstr == NULL)
@@ -1438,7 +1454,7 @@ commit_done:
else if (dict_get_str (op_ctx, "errstr", &errstr) == 0)
*op_errstr = gf_strdup (errstr);
- gf_log (this->name, GF_LOG_DEBUG, "Sent commit op req for 'Volume %s' "
+ gf_msg_debug (this->name, 0, "Sent commit op req for 'Volume %s' "
"to %d peers", gd_op_list[op], peer_cnt);
out:
if (!ret)
@@ -1547,10 +1563,11 @@ gd_unlock_op_phase (glusterd_conf_t *conf, glusterd_op_t op, int *op_ret,
ret = args.op_ret;
- gf_log (this->name, GF_LOG_DEBUG, "Sent unlock op req for 'Volume %s' "
+ gf_msg_debug (this->name, 0, "Sent unlock op req for 'Volume %s' "
"to %d peers. Returning %d", gd_op_list[op], peer_cnt, ret);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to unlock "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEER_UNLOCK_FAIL, "Failed to unlock "
"on some peer(s)");
}
@@ -1574,7 +1591,8 @@ out:
ret = glusterd_mgmt_v3_unlock (volname, MY_UUID,
type);
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);
}
@@ -1631,8 +1649,9 @@ gd_brick_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
ret = glusterd_op_bricks_select (op, req_dict, op_errstr, &selected,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s",
- (*op_errstr)? *op_errstr: "Brick op failed. Check "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_OP_FAIL, "%s",
+ (*op_errstr) ? *op_errstr : "Brick op failed. Check "
"glusterd log file for more details.");
goto out;
}
@@ -1657,7 +1676,8 @@ gd_brick_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
}
ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Brick Op failed "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_RPC_FAILURE, "Brick Op failed "
"due to rpc failure.");
goto out;
}
@@ -1694,7 +1714,7 @@ out:
if (rsp_dict)
dict_unref (rsp_dict);
- gf_log (this->name, GF_LOG_DEBUG, "Sent op req to %d bricks",
+ gf_msg_debug (this->name, 0, "Sent op req to %d bricks",
brick_count);
return ret;
}
@@ -1726,7 +1746,8 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req)
ret = dict_get_int32 (op_ctx, GD_SYNC_OPCODE_KEY, &tmp_op);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get volume "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Failed to get volume "
"operation");
goto out;
}
@@ -1736,7 +1757,8 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req)
* save it in the dict */
ret = glusterd_generate_txn_id (op_ctx, &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;
}
@@ -1745,16 +1767,18 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req)
glusterd_txn_opinfo_init (&txn_opinfo, NULL, &op, NULL, NULL);
ret = glusterd_set_txn_opinfo (txn_id, &txn_opinfo);
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");
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"Transaction ID : %s", uuid_utoa (*txn_id));
/* Save the MY_UUID as the originator_uuid */
ret = glusterd_set_originator_uuid (op_ctx);
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;
}
@@ -1763,7 +1787,8 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req)
if (conf->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");
gf_asprintf (&op_errstr,
"Another transaction is in progress. "
@@ -1782,7 +1807,8 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req)
* not be held */
ret = dict_get_str (op_ctx, "volname", &tmp);
if (ret) {
- gf_log ("", GF_LOG_DEBUG, "Failed to get volume "
+ gf_msg_debug ("glusterd", 0,
+ "Failed to get volume "
"name");
goto local_locking_done;
} else {
@@ -1797,7 +1823,8 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req)
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);
gf_asprintf (&op_errstr,
"Another transaction is in progress "
@@ -1833,7 +1860,8 @@ local_locking_done:
ret = gd_lock_op_phase (conf, op, op_ctx, &op_errstr, *txn_id,
&txn_opinfo);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PEER_LOCK_FAIL,
"Locking Peers Failed.");
goto out;
}
@@ -1841,7 +1869,9 @@ local_locking_done:
ret = glusterd_op_build_payload (&req_dict, &op_errstr, op_ctx);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, LOGSTR_BUILD_PAYLOAD,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_OP_PAYLOAD_BUILD_FAIL,
+ LOGSTR_BUILD_PAYLOAD,
gd_op_list[op]);
if (op_errstr == NULL)
gf_asprintf (&op_errstr, OPERRSTR_BUILD_PAYLOAD);
@@ -1878,7 +1908,8 @@ out:
/* Clearing the transaction opinfo */
ret = glusterd_clear_txn_opinfo (txn_id);
if (ret)
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_TRANS_OPINFO_CLEAR_FAIL,
"Unable to clear transaction's "
"opinfo for transaction ID : %s",
uuid_utoa (*txn_id));
@@ -1912,7 +1943,8 @@ glusterd_op_begin_synctask (rpcsvc_request_t *req, glusterd_op_t op,
ret = dict_set_int32 (dict, GD_SYNC_OPCODE_KEY, op);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED,
"dict set failed for setting operations");
goto out;
}