summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
authorNandaja Varma <nandaja.varma@gmail.com>2015-07-09 11:37:16 +0530
committerAtin Mukherjee <amukherj@redhat.com>2015-07-18 05:08:04 -0700
commitb2673ae923f3e4651f4c642a9b88f5d200a25585 (patch)
treed756b502b6fd7f82feb67d53182f043d8aad02f0 /xlators/mgmt/glusterd/src
parent0ad8bfb028d7916f7940bb48f0df616d164f74de (diff)
glusterd: Porting the left out gf_log_callingfns to new framework
Change-Id: I1b0ad54238895475ddbacc4fffacac8dc6e887fe BUG: 1235538 Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com> Reviewed-on: http://review.gluster.org/11590 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/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-locks.c15
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-messages.h30
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt.c6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c11
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-statedump.c5
5 files changed, 52 insertions, 15 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c
index cbaa92d0bc6..e18bd239b89 100644
--- a/xlators/mgmt/glusterd/src/glusterd-locks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-locks.c
@@ -536,7 +536,8 @@ glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, uint32_t *op_errno,
is_valid = glusterd_mgmt_v3_is_type_valid (type);
if (is_valid != _gf_true) {
- gf_log_callingfn (this->name, GF_LOG_ERROR,
+ gf_msg_callingfn (this->name, GF_LOG_ERROR,
+ EINVAL, GD_MSG_INVALID_ENTRY,
"Invalid entity. Cannot perform locking "
"operation on %s types", type);
ret = -1;
@@ -565,7 +566,8 @@ glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, uint32_t *op_errno,
/* If the lock has already been held for the given volume
* we fail */
if (!gf_uuid_is_null (owner)) {
- gf_log_callingfn (this->name, GF_LOG_WARNING,
+ gf_msg_callingfn (this->name, GF_LOG_WARNING,
+ 0, GD_MSG_LOCK_ALREADY_HELD,
"Lock for %s held by %s",
name, uuid_utoa (owner));
ret = -1;
@@ -640,7 +642,8 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
is_valid = glusterd_mgmt_v3_is_type_valid (type);
if (is_valid != _gf_true) {
- gf_log_callingfn (this->name, GF_LOG_ERROR,
+ gf_msg_callingfn (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY,
"Invalid entity. Cannot perform unlocking "
"operation on %s types", type);
ret = -1;
@@ -668,7 +671,8 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
}
if (gf_uuid_is_null (owner)) {
- gf_log_callingfn (this->name, GF_LOG_WARNING,
+ gf_msg_callingfn (this->name, GF_LOG_WARNING,
+ 0, GD_MSG_LOCK_NOT_HELD,
"Lock for %s %s not held", type, name);
ret = -1;
goto out;
@@ -676,7 +680,8 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
ret = gf_uuid_compare (uuid, owner);
if (ret) {
- gf_log_callingfn (this->name, GF_LOG_WARNING,
+ gf_msg_callingfn (this->name, GF_LOG_WARNING,
+ 0, GD_MSG_LOCK_OWNER_MISMATCH,
"Lock owner mismatch. "
"Lock for %s %s held by %s",
type, name, uuid_utoa (owner));
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
index 3752a05fa04..7b0a8692e1c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-messages.h
+++ b/xlators/mgmt/glusterd/src/glusterd-messages.h
@@ -40,7 +40,7 @@
*/
#define GLUSTERD_COMP_BASE GLFS_MSGID_GLUSTERD
-#define GLFS_NUM_MESSAGES 563
+#define GLFS_NUM_MESSAGES 568
#define GLFS_MSGID_END (GLUSTERD_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
#define glfs_msg_start_x GLFS_COMP_BASE, "Invalid: Start of messages"
@@ -4555,7 +4555,7 @@
* @recommendedaction
*
*/
-#define GD_MSG_SVC_START_SUCCESS (GLUSTERD_COMP_BASE + 564)
+#define GD_MSG_LOCK_OWNER_MISMATCH (GLUSTERD_COMP_BASE + 564)
/*!
* @messageid
@@ -4563,7 +4563,31 @@
* @recommendedaction
*
*/
-#define GD_MSG_SVC_STOP_SUCCESS (GLUSTERD_COMP_BASE + 565)
+#define GD_MSG_LOCK_NOT_HELD (GLUSTERD_COMP_BASE + 565)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_LOCK_ALREADY_HELD (GLUSTERD_COMP_BASE + 566)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_SVC_START_SUCCESS (GLUSTERD_COMP_BASE + 567)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_SVC_STOP_SUCCESS (GLUSTERD_COMP_BASE + 568)
/*------------*/
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index 607d2c57014..326d8681495 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -173,7 +173,8 @@ gd_mgmt_v3_pre_validate_fn (glusterd_op_t op, dict_t *dict,
ret = glusterd_op_stage_replace_brick (dict, op_errstr,
rsp_dict);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_PRE_VALIDATION_FAIL,
"Replace-brick prevalidation failed.");
goto out;
}
@@ -860,7 +861,8 @@ glusterd_mgmt_v3_build_payload (dict_t **req, char **op_errstr, dict_t *dict,
{
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_DICT_GET_FAILED,
"volname is not present in "
"operation ctx");
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index 9c8b2946fc7..4ba7d8d51e9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -57,13 +57,15 @@ glusterd_handle_replicate_replace_brick (glusterd_volinfo_t *volinfo,
ret = sys_lsetxattr (brickinfo->path, GF_AFR_DIRTY, dirty,
sizeof (dirty), 0);
if (ret == -1) {
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to set extended"
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ GD_MSG_SETXATTR_FAIL, "Failed to set extended"
" attribute %s : %s.", GF_AFR_DIRTY, strerror (errno));
goto out;
}
if (mkdtemp (tmpmount) == NULL) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ GD_MSG_DIR_OP_FAILED,
"failed to create a temporary mount directory.");
ret = -1;
goto out;
@@ -94,7 +96,8 @@ glusterd_handle_replicate_replace_brick (glusterd_volinfo_t *volinfo,
brickinfo->brick_id, sizeof (brickinfo->brick_id),
0);
if (ret == -1)
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to set extended"
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ GD_MSG_SETXATTR_FAIL, "Failed to set extended"
" attribute %s : %s", GF_AFR_REPLACE_BRICK,
strerror (errno));
gf_umount_lazy (THIS->name, tmpmount, 1);
@@ -103,7 +106,7 @@ lock:
out:
if (pid)
GF_FREE (pid);
- gf_log ("", GF_LOG_DEBUG, "Returning with ret");
+ gf_msg_debug ("glusterd", 0, "Returning with ret");
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-statedump.c b/xlators/mgmt/glusterd/src/glusterd-statedump.c
index 6ed6d55071a..228adb7292a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-statedump.c
+++ b/xlators/mgmt/glusterd/src/glusterd-statedump.c
@@ -14,6 +14,7 @@
#include "glusterd-quotad-svc.h"
#include "glusterd-nfs-svc.h"
#include "glusterd-locks.h"
+#include "glusterd-messages.h"
static void
glusterd_dump_peer (glusterd_peerinfo_t *peerinfo, char *input_key, int index,
@@ -150,7 +151,9 @@ glusterd_dict_mgmt_v3_lock_statedump (dict_t *dict)
char dump[64*1024] = {0,};
if (!dict) {
- gf_log_callingfn ("glusterd", GF_LOG_WARNING, "dict NULL");
+ gf_msg_callingfn ("glusterd", GF_LOG_WARNING, EINVAL,
+ GD_MSG_DICT_EMPTY,
+ "dict NULL");
goto out;
}
for (trav = dict->members_list; trav; trav = trav->next) {