summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorPranith K <pranithk@gluster.com>2010-10-29 03:39:56 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-10-29 03:42:19 -0700
commit9c29312628af743f16badb4bc820cbd31f2a9488 (patch)
treebcf25aa7bdd7f60be49370f6555e2eaa61572965 /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parentc1b80f0f590e2d7448b890b57e80f4a1b2e39a03 (diff)
cli,mgmt/glusterd: fsm log implementation
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1966 (Unnecessarily verbose logs at the default log level) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1966
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 93eeb38d5..bc9cb330b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -87,7 +87,7 @@ static char *glusterd_op_sm_event_names[] = {
};
char*
-glusterd_op_sm_state_name_get (glusterd_op_sm_state_t state)
+glusterd_op_sm_state_name_get (int state)
{
if (state < 0 || state >= GD_OP_STATE_MAX)
return glusterd_op_sm_state_names[GD_OP_STATE_MAX];
@@ -95,7 +95,7 @@ glusterd_op_sm_state_name_get (glusterd_op_sm_state_t state)
}
char*
-glusterd_op_sm_event_name_get (glusterd_op_sm_event_type_t event)
+glusterd_op_sm_event_name_get (int event)
{
if (event < 0 || event >= GD_OP_EVENT_MAX)
return glusterd_op_sm_event_names[GD_OP_EVENT_MAX];
@@ -4772,15 +4772,19 @@ glusterd_op_sm_transition_state (glusterd_op_info_t *opinfo,
glusterd_op_sm_t *state,
glusterd_op_sm_event_type_t event_type)
{
+ glusterd_conf_t *conf = NULL;
GF_ASSERT (state);
GF_ASSERT (opinfo);
- gf_log ("", GF_LOG_NORMAL, "Transitioning from '%s' to '%s' due to "
- "event '%s'",
- glusterd_op_sm_state_name_get (opinfo->state.state),
- glusterd_op_sm_state_name_get (state[event_type].next_state),
- glusterd_op_sm_event_name_get (event_type));
+ conf = THIS->private;
+ GF_ASSERT (conf);
+
+ (void) glusterd_sm_tr_log_transition_add (&conf->op_sm_log,
+ opinfo->state.state,
+ state[event_type].next_state,
+ event_type);
+
opinfo->state.state = state[event_type].next_state;
return 0;
}
@@ -5100,7 +5104,7 @@ glusterd_op_sm_inject_event (glusterd_op_sm_event_type_t event_type,
event->ctx = ctx;
- gf_log ("glusterd", GF_LOG_NORMAL, "Enqueuing event: '%s'",
+ gf_log ("glusterd", GF_LOG_DEBUG, "Enqueuing event: '%s'",
glusterd_op_sm_event_name_get (event->event));
list_add_tail (&event->list, &gd_op_sm_queue);
@@ -5148,7 +5152,7 @@ glusterd_op_sm ()
list_del_init (&event->list);
event_type = event->event;
- gf_log ("", GF_LOG_NORMAL, "Dequeued event of type: '%s'",
+ gf_log ("", GF_LOG_DEBUG, "Dequeued event of type: '%s'",
glusterd_op_sm_event_name_get(event_type));
state = glusterd_op_state_table[opinfo.state.state];