diff options
| author | Junaid <junaid@gluster.com> | 2011-06-23 03:19:15 +0000 | 
|---|---|---|
| committer | Anand Avati <avati@gluster.com> | 2011-07-11 23:19:23 -0700 | 
| commit | 089ae1b7299f2d30a7b56da0c700f42d7a0341d7 (patch) | |
| tree | 1bd3328ae194b682b682250961dd817439459d6e /xlators/mgmt | |
| parent | ae5f7c2c1d88cee0029c555f2416fe7c998cc1c2 (diff) | |
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 <volname> <brick|client>-sys-log-level value
to set the option.
Signed-off-by: Junaid <junaid@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 3044 (provide option to set syslog loglevel through CLI)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3044
Diffstat (limited to 'xlators/mgmt')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 32 | 
1 files 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}, @@ -1287,6 +1289,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)  {          int32_t   ret               = -1; @@ -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;  }  | 
