From f02499e16624f29ac2be5531f1c4c298a12f33a8 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Mon, 4 Oct 2010 06:47:35 +0000 Subject: Add log-level option to command volume set log-level option to set brick's log-level client-log-level to set client's log-level Signed-off-by: shishir gowda Signed-off-by: Vijay Bellur BUG: 1789 (add log-level options to volume set) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1789 --- xlators/debug/io-stats/src/io-stats.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'xlators/debug/io-stats') diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index bf513184025..0fdefd1e201 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -20,6 +20,7 @@ #ifndef _CONFIG_H #define _CONFIG_H #include "config.h" +#include "xlator.h" #endif /** @@ -1549,6 +1550,8 @@ reconfigure (xlator_t *this, dict_t *options) struct ios_conf *conf = NULL; char *str = NULL; int ret = 0; + char *log_str = NULL; + glusterfs_ctx_t *ctx = NULL; if (!this || !this->private) return -1; @@ -1579,6 +1582,21 @@ reconfigure (xlator_t *this, dict_t *options) } conf->measure_latency = ret; } + ctx = glusterfs_ctx_get (); + if (!ctx) + return -1; + + if (ctx->cmd_args.brick_name) + ret = dict_get_str (options, "log-level", &log_str); + else + ret = dict_get_str (options, "client-log-level", &log_str); + + if (!ret) { + if (!is_gf_log_command(this, "trusted.glusterfs*set-log-level", log_str)) { + gf_log (this->name, GF_LOG_DEBUG, + "changing log-level to %s", log_str); + } + } return 0; } @@ -1737,5 +1755,11 @@ struct volume_options options[] = { { .key = { "latency-measurement" }, .type = GF_OPTION_TYPE_BOOL, }, + { .key = {"log-level"}, + .type = GF_OPTION_TYPE_STR, + }, + { .key = {"client-log-level"}, + .type = GF_OPTION_TYPE_STR, + }, { .key = {NULL} }, }; -- cgit