diff options
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handshake.c | 265 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-locks.c | 105 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-mountbroker.c | 8 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-syncop.c | 114 | 
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 f1712685dcb..52678745d8f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handshake.c +++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c @@ -26,6 +26,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" @@ -75,20 +76,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;          } @@ -110,14 +116,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; @@ -128,9 +136,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;                  } @@ -187,7 +196,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;                  } @@ -224,7 +234,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; @@ -252,7 +263,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;                  } @@ -371,7 +383,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;          } @@ -379,7 +392,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;          } @@ -387,7 +401,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;          } @@ -395,13 +410,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; @@ -439,7 +454,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; @@ -456,7 +472,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); @@ -472,7 +489,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; @@ -481,7 +499,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; @@ -491,7 +511,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; @@ -504,7 +526,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 */ @@ -512,7 +535,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; @@ -525,7 +549,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 @@ -537,7 +562,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); @@ -548,7 +574,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; @@ -556,7 +583,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); @@ -615,8 +643,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); @@ -647,7 +676,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;                  } @@ -683,7 +713,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, @@ -738,7 +769,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;          } @@ -778,7 +810,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; @@ -786,7 +819,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; @@ -808,11 +842,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; @@ -872,14 +907,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); @@ -887,7 +925,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; @@ -925,7 +964,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, @@ -939,7 +979,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); @@ -1000,7 +1041,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; @@ -1048,7 +1090,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; @@ -1056,7 +1099,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; @@ -1064,7 +1108,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; @@ -1132,7 +1177,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; @@ -1147,12 +1193,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; @@ -1200,13 +1249,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; @@ -1216,7 +1267,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; @@ -1229,7 +1281,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; @@ -1237,7 +1290,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;          } @@ -1266,7 +1320,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; @@ -1337,7 +1392,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;          } @@ -1354,7 +1410,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; @@ -1367,7 +1424,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; @@ -1384,7 +1442,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; @@ -1513,7 +1572,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;          } @@ -1521,7 +1581,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;          } @@ -1530,7 +1591,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;          } @@ -1546,13 +1608,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;  } @@ -1598,7 +1661,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;  } @@ -1623,7 +1686,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; @@ -1632,7 +1695,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;          } @@ -1640,7 +1704,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;          } @@ -1650,7 +1715,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;          } @@ -1670,7 +1736,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);          } @@ -1728,7 +1795,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;          } @@ -1737,7 +1804,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;          } @@ -1746,7 +1814,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;          } @@ -1757,7 +1826,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; @@ -1767,7 +1837,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; @@ -1779,7 +1850,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;          } @@ -1849,7 +1921,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;          } @@ -1861,7 +1934,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;          } @@ -1908,7 +1981,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); @@ -1918,21 +1991,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, @@ -1990,7 +2066,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;          } @@ -1998,7 +2074,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;          } @@ -2006,20 +2083,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); @@ -2030,14 +2109,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;          } @@ -2049,7 +2131,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);          } @@ -2111,7 +2194,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 bafdc537122..a16e499df68 100644 --- a/xlators/mgmt/glusterd/src/glusterd-locks.c +++ b/xlators/mgmt/glusterd/src/glusterd-locks.c @@ -24,6 +24,7 @@  #include "glusterd-errno.h"  #include "run.h"  #include "syscall.h" +#include "glusterd-messages.h"  #include <signal.h> @@ -113,7 +114,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;          } @@ -126,7 +128,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;  } @@ -150,7 +152,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; @@ -165,7 +167,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; @@ -174,7 +177,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; @@ -182,7 +186,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;  } @@ -216,7 +220,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; @@ -224,7 +229,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, @@ -245,13 +251,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;  } @@ -295,14 +302,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)); @@ -315,7 +324,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;                  } @@ -323,7 +333,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;  } @@ -366,14 +376,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)); @@ -387,7 +399,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;                  } @@ -395,7 +408,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;  } @@ -413,7 +426,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;          } @@ -424,7 +438,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; @@ -433,7 +448,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;  } @@ -451,7 +466,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;          } @@ -463,7 +479,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; @@ -484,14 +501,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;  } @@ -515,7 +533,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;          } @@ -532,17 +551,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;          } @@ -570,7 +590,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); @@ -583,19 +604,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;  } @@ -615,7 +637,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;          } @@ -632,18 +655,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;          } @@ -672,19 +696,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 0a68540ad7c..e837b2fd64d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c +++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c @@ -31,6 +31,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, @@ -217,7 +218,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);          } @@ -670,7 +672,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;          }  | 
