From 089ae1b7299f2d30a7b56da0c700f42d7a0341d7 Mon Sep 17 00:00:00 2001 From: Junaid Date: Thu, 23 Jun 2011 03:19:15 +0000 Subject: mgmt/glusterd: Make glusterd aware of sys-log-level options. There are two options: * brick-sys-log-level * client-sys-log-level Which set the log-level on brick and client respectively. Uset gluster volume set -sys-log-level value to set the option. Signed-off-by: Junaid Signed-off-by: Anand Avati BUG: 3044 (provide option to set syslog loglevel through CLI) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3044 --- xlators/mgmt/glusterd/src/glusterd-volgen.c | 32 +++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index aa16128f7cf..250d9b26c2a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -122,8 +122,10 @@ static struct volopt_map_entry glusterd_volopt_map[] = { {VKEY_DIAG_LAT_MEASUREMENT, "debug/io-stats", "latency-measurement", "off", NO_DOC, 0 }, {"diagnostics.dump-fd-stats", "debug/io-stats", NULL, NULL, NO_DOC, 0 }, {VKEY_DIAG_CNT_FOP_HITS, "debug/io-stats", "count-fop-hits", "off", NO_DOC, 0 }, - {"diagnostics.brick-log-level", "debug/io-stats", "!log-level", NULL, DOC, 0}, - {"diagnostics.client-log-level", "debug/io-stats", "!log-level", NULL, DOC, 0}, + {"diagnostics.brick-log-level", "debug/io-stats", "!log-level", NULL, DOC, 0}, + {"diagnostics.client-log-level", "debug/io-stats", "!log-level", NULL, DOC, 0}, + {"diagnostics.brick-sys-log-level", "debug/io-stats", "!sys-log-level", NULL, DOC, 0}, + {"diagnostics.client-sys-log-level", "debug/io-stats", "!sys-log-level", NULL, DOC, 0}, {"performance.cache-max-file-size", "performance/io-cache", "max-file-size", NULL, DOC, 0}, {"performance.cache-min-file-size", "performance/io-cache", "min-file-size", NULL, DOC, 0}, @@ -1286,6 +1288,26 @@ server_check_marker_off (volgen_graph_t *graph, struct volopt_map_entry *vme, } +static int +sys_loglevel_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, "!sys-log-level") != 0 || + !strstr (vme->key, role)) + return 0; + + memcpy (&vme2, vme, sizeof (vme2)); + vme2.option = "sys-log-level"; + + return basic_option_handler (graph, &vme2, NULL); +} + static int volgen_graph_set_xl_options (volgen_graph_t *graph, dict_t *dict) { @@ -1335,6 +1357,9 @@ server_spec_option_handler (volgen_graph_t *graph, if (!ret) ret = loglevel_option_handler (graph, vme, "brick"); + if (!ret) + ret = sys_loglevel_option_handler (graph, vme, "brick"); + return ret; } @@ -1699,6 +1724,9 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, ret = volgen_graph_set_options_generic (graph, set_dict, "client", &loglevel_option_handler); + if (!ret) + ret = volgen_graph_set_options_generic (graph, set_dict, "client", + &sys_loglevel_option_handler); return ret; } -- cgit