diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2014-05-03 12:52:44 +0530 |
---|---|---|
committer | Kaushal M <kaushal@redhat.com> | 2014-05-06 21:48:03 -0700 |
commit | 199435aac3be170f6dadd4e88a576cec808ee419 (patch) | |
tree | 6537e12769485fb489af0a53c0629fe92acbaa82 /xlators/mgmt/glusterd/src | |
parent | 451246a58dbbc1ec777f379a6b779be374379abd (diff) |
glusterd : Port glusterd sync log messages to gf_msg API
Change-Id: Ic3ed2c96d8fc3a15fedaa80517a2c79c0c858963
BUG: 1075611
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: http://review.gluster.org/7652
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-messages.h | 26 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rebalance.c | 13 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-sm.c | 4 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 57 |
4 files changed, 67 insertions, 33 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h index 54fd7e2cf7b..c465633c9d9 100644 --- a/xlators/mgmt/glusterd/src/glusterd-messages.h +++ b/xlators/mgmt/glusterd/src/glusterd-messages.h @@ -41,7 +41,7 @@ */ #define GLUSTERD_COMP_BASE GLFS_MSGID_GLUSTERD -#define GLFS_NUM_MESSAGES 7 +#define GLFS_NUM_MESSAGES 18 #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" @@ -61,8 +61,30 @@ #define GD_MSG_REBALANCE_DISCONNECTED (GLUSTERD_COMP_BASE + 7) +/* 4 to 7 is reserved for brick disconnection messages */ + +#define GD_MSG_VOL_CLEANUP_FAIL (GLUSTERD_COMP_BASE + 8) + +#define GD_MSG_VOL_VERS_MISMATCH (GLUSTERD_COMP_BASE + 9) + +#define GD_MSG_CKSUM_VERS_MISMATCH (GLUSTERD_COMP_BASE + 10) + +#define GD_MSG_QUOTA_CONFIG_VERS_MISMATCH (GLUSTERD_COMP_BASE + 11) + +#define GD_MSG_QUOTA_CONFIG_CKSUM_MISMATCH (GLUSTERD_COMP_BASE + 12) + +#define GD_MSG_BRICK_STOP_FAIL (GLUSTERD_COMP_BASE + 13) + +#define GD_MSG_SVC_KILL_FAIL (GLUSTERD_COMP_BASE + 14) + +#define GD_MSG_PID_KILL_FAIL (GLUSTERD_COMP_BASE + 15) + +#define GD_MSG_REBAL_NO_SOCK_FILE (GLUSTERD_COMP_BASE + 16) + +#define GD_MSG_UNIX_OP_BUILD_FAIL (GLUSTERD_COMP_BASE + 17) + +#define GD_MSG_RPC_CREATE_FAIL (GLUSTERD_COMP_BASE + 18) /*------------*/ #define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages" - #endif /* !_GLUSTERD_MESSAGES_H_ */ diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 763ceb74912..cf2272028c6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -29,6 +29,7 @@ #include "glusterd-sm.h" #include "glusterd-op-sm.h" #include "glusterd-utils.h" +#include "glusterd-messages.h" #include "glusterd-store.h" #include "run.h" #include "glusterd-volgen.h" @@ -352,9 +353,9 @@ glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo, priv); ret =sys_stat (sockfile, &buf); if (ret && (ENOENT == errno)) { - gf_log (this->name, GF_LOG_ERROR, "Rebalance " - "sockfile %s does not exist.", - sockfile); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_REBAL_NO_SOCK_FILE, "Rebalance " + "sockfile %s does not exist", sockfile); goto out; } } @@ -367,7 +368,8 @@ glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo, */ ret = rpc_transport_unix_options_build (&options, sockfile, 600); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Unix options build failed"); + gf_msg (THIS->name, GF_LOG_ERROR, 0, GD_MSG_UNIX_OP_BUILD_FAIL, + "Unix options build failed"); goto out; } @@ -377,7 +379,8 @@ glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo, glusterd_defrag_notify, volinfo); synclock_lock (&priv->big_lock); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "RPC create failed"); + gf_msg (THIS->name, GF_LOG_ERROR, 0, GD_MSG_RPC_CREATE_FAIL, + "Glusterd RPC creation failed"); goto out; } ret = 0; diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c index e6ad3433543..6dc35109d85 100644 --- a/xlators/mgmt/glusterd/src/glusterd-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-sm.c @@ -26,6 +26,7 @@ #include "call-stub.h" #include "defaults.h" #include "list.h" +#include "glusterd-messages.h" #include "dict.h" #include "compat.h" #include "compat-errno.h" @@ -618,7 +619,8 @@ glusterd_ac_friend_remove (glusterd_friend_sm_event_t *event, void *ctx) ret = glusterd_friend_remove_cleanup_vols (event->peerinfo->uuid); if (ret) - gf_log (THIS->name, GF_LOG_WARNING, "Volumes cleanup failed"); + gf_msg (THIS->name, GF_LOG_WARNING, 0, GD_MSG_VOL_CLEANUP_FAIL, + "Volumes cleanup failed"); ret = glusterd_friend_cleanup (event->peerinfo); if (ret) { diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index f07d4a0993a..f4121812a9b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -25,6 +25,7 @@ #include "dict.h" #include "xlator.h" #include "logging.h" +#include "glusterd-messages.h" #include "timer.h" #include "defaults.h" #include "compat.h" @@ -1619,8 +1620,10 @@ glusterd_service_stop (const char *service, char *pidfile, int sig, ret = 0; goto out; default: - gf_log (this->name, GF_LOG_ERROR, "Failed to kill %s: %s", - service, strerror (errno)); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_SVC_KILL_FAIL, "Unable to kill %s " + "service, reason:%s", service, + strerror (errno)); } } if (!force_kill) @@ -1630,9 +1633,9 @@ glusterd_service_stop (const char *service, char *pidfile, int sig, if (gf_is_service_running (pidfile, NULL)) { ret = kill (pid, SIGKILL); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Unable to " - "kill pid %d reason: %s", pid, - strerror(errno)); + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_PID_KILL_FAIL, "Unable to kill pid:%d, " + "reason:%s", pid, strerror(errno)); goto out; } } @@ -3114,9 +3117,10 @@ glusterd_compare_friend_volume (dict_t *peer_data, int32_t count, if (version > volinfo->version) { //Mismatch detected ret = 0; - gf_log (this->name, GF_LOG_ERROR, "Version of volume %s differ." - "local version = %d, remote version = %d on peer %s", - volinfo->volname, volinfo->version, version, hostname); + gf_msg (this->name, GF_LOG_INFO, 0, GD_MSG_VOL_VERS_MISMATCH, + "Version of volume %s differ. local version = %d, " + "remote version = %d on peer %s", volinfo->volname, + volinfo->version, version, hostname); *status = GLUSTERD_VOL_COMP_UPDATE_REQ; goto out; } else if (version < volinfo->version) { @@ -3134,9 +3138,10 @@ glusterd_compare_friend_volume (dict_t *peer_data, int32_t count, if (cksum != volinfo->cksum) { ret = 0; - gf_log (this->name, GF_LOG_ERROR, "Cksums of volume %s differ." - " local cksum = %u, remote cksum = %u on peer %s", - volinfo->volname, volinfo->cksum, cksum, hostname); + gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_CKSUM_VERS_MISMATCH, + "Version of Cksums %s differ. local cksum = %u, remote " + "cksum = %u on peer %s", volinfo->volname, + volinfo->cksum, cksum, hostname); *status = GLUSTERD_VOL_COMP_RJT; goto out; } @@ -3153,12 +3158,13 @@ glusterd_compare_friend_volume (dict_t *peer_data, int32_t count, if (quota_version > volinfo->quota_conf_version) { //Mismatch detected ret = 0; - gf_log (this->name, GF_LOG_ERROR, "Quota configuration " - "versions of volume %s differ. " - "local version = %d, remote version = %d " - "on peer %s", volinfo->volname, - volinfo->quota_conf_version, quota_version, - hostname); + gf_msg (this->name, GF_LOG_INFO, 0, + GD_MSG_QUOTA_CONFIG_VERS_MISMATCH, + "Quota configuration versions of volume %s " + "differ. local version = %d, remote version = " + "%d on peer %s", volinfo->volname, + volinfo->quota_conf_version, + quota_version, hostname); *status = GLUSTERD_VOL_COMP_UPDATE_REQ; goto out; } else if (quota_version < volinfo->quota_conf_version) { @@ -3180,12 +3186,12 @@ glusterd_compare_friend_volume (dict_t *peer_data, int32_t count, } else { if (quota_cksum != volinfo->quota_conf_cksum) { ret = 0; - gf_log (this->name, GF_LOG_ERROR, "Cksums of quota " - "configurations of volume %s differ. " - "local cksum = %u, remote cksum = %u on " - "peer %s", volinfo->volname, - volinfo->quota_conf_cksum, quota_cksum, - hostname); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_QUOTA_CONFIG_CKSUM_MISMATCH, "Cksums of " + "quota configuration of volume %s differ. local" + " cksum = %u, remote cksum = %u on peer %s", + volinfo->volname, volinfo->quota_conf_cksum, + quota_cksum, hostname); *status = GLUSTERD_VOL_COMP_RJT; goto out; } @@ -4296,8 +4302,9 @@ glusterd_volinfo_stop_stale_bricks (glusterd_volinfo_t *new_volinfo, ret = glusterd_brick_stop (old_volinfo, old_brickinfo, _gf_false); if (ret) - gf_log ("glusterd", GF_LOG_ERROR, "Failed to " - "stop brick %s:%s", old_brickinfo->hostname, + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_BRICK_STOP_FAIL, "Failed to stop" + " brick %s:%s", old_brickinfo->hostname, old_brickinfo->path); } } |