diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2014-02-07 11:02:10 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-04-30 23:52:28 -0700 |
commit | 630d46d714a233919664c035f2c5c48c028777e8 (patch) | |
tree | e7e79b240e23fde447989a4e1adc625b1858d17d /xlators/mgmt/glusterd/src/glusterd-volgen.c | |
parent | f63fbca7540a4c9ce090e1ed5941ed8777ff6316 (diff) |
logging: Introduce suppression of repetitive log messages
Change-Id: I8efa08cc9832ad509fba65a88bb0cddbaf056404
BUG: 1075611
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/7475
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 6ce38e91b5b..197e4b9ecdb 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1366,6 +1366,46 @@ log_format_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme, } static int +log_buf_size_option_handler (volgen_graph_t *graph, + struct volopt_map_entry *vme, + void *param) +{ + char *role = NULL; + struct volopt_map_entry vme2 = {0,}; + + role = (char *) param; + + if (strcmp (vme->option, "!log-buf-size") != 0 || + !strstr (vme->key, role)) + return 0; + + memcpy (&vme2, vme, sizeof (vme2)); + vme2.option = "log-buf-size"; + + return basic_option_handler (graph, &vme2, NULL); +} + +static int +log_flush_timeout_option_handler (volgen_graph_t *graph, + struct volopt_map_entry *vme, + void *param) +{ + char *role = NULL; + struct volopt_map_entry vme2 = {0,}; + + role = (char *) param; + + if (strcmp (vme->option, "!log-flush-timeout") != 0 || + !strstr (vme->key, role)) + return 0; + + memcpy (&vme2, vme, sizeof (vme2)); + vme2.option = "log-flush-timeout"; + + return basic_option_handler (graph, &vme2, NULL); +} + +static int volgen_graph_set_xl_options (volgen_graph_t *graph, dict_t *dict) { int32_t ret = -1; @@ -1423,6 +1463,12 @@ server_spec_option_handler (volgen_graph_t *graph, if (!ret) ret = log_format_option_handler (graph, vme, "brick"); + if (!ret) + ret = log_buf_size_option_handler (graph, vme, "brick"); + + if (!ret) + ret = log_flush_timeout_option_handler (graph, vme, "brick"); + return ret; } @@ -2780,6 +2826,18 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, gf_log (this->name, GF_LOG_WARNING, "changing client log format" " failed"); + ret = volgen_graph_set_options_generic (graph, set_dict, "client", + &log_buf_size_option_handler); + if (ret) + gf_log (this->name, GF_LOG_WARNING, "Failed to change " + "log-buf-size option"); + + ret = volgen_graph_set_options_generic (graph, set_dict, "client", + &log_flush_timeout_option_handler); + if (ret) + gf_log (this->name, GF_LOG_WARNING, "Failed to change " + "log-flush-timeout option"); + out: return ret; } @@ -3139,7 +3197,23 @@ build_shd_graph (volgen_graph_t *graph, dict_t *mod_dict) &log_format_option_handler); if (ret) gf_log (this->name, GF_LOG_WARNING, "changing log " - "format level of self-heal daemon failed"); + "format of self-heal daemon failed"); + + ret = volgen_graph_set_options_generic (graph, set_dict, + "client", + &log_buf_size_option_handler); + if (ret) + gf_log (this->name, GF_LOG_WARNING, "changing " + "log-buf-size for self-heal daemon failed"); + + ret = volgen_graph_set_options_generic (graph, set_dict, + "client", + &log_flush_timeout_option_handler); + if (ret) + gf_log (this->name, GF_LOG_WARNING, "changing " + "log-flush-timeout for self-heal daemon " + "failed"); + ret = dict_reset (set_dict); if (ret) |