diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2011-08-16 13:10:41 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-08-18 22:42:48 -0700 |
commit | ce0aaba383b97dca52d11c18846a8154d529bf8a (patch) | |
tree | 494673947140ddded481e4532ce6c340eac09446 /xlators/debug/io-stats/src/io-stats.c | |
parent | b7596882b3ceba77bd812d2e5757d9fa3aa0fa17 (diff) |
mgmt/Glusterd: Implementation volume set help/help-xml
Change-Id: I0c54fd1c15550e5e5551e95ed32adb14d8029fab
Reviewed-on: http://review.gluster.com/238
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/debug/io-stats/src/io-stats.c')
-rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 76 |
1 files changed, 68 insertions, 8 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 170cb8c93b8..541ca46bc69 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -157,6 +157,8 @@ struct ios_local { struct timeval unwind_at; }; +struct volume_options options[]; + inline static int is_fop_latency_started (call_frame_t *frame) { @@ -2302,17 +2304,34 @@ io_stats_forget (xlator_t *this, inode_t *inode) } int -iostats_configure_options (xlator_t *this, dict_t *options, +iostats_configure_options (xlator_t *this, dict_t *xl_options, struct ios_conf *conf) { int ret = 0; char *log_str = NULL; + char *def_val = NULL; + gf_boolean_t def_bool = _gf_false; + GF_ASSERT (this); - GF_ASSERT (options); + GF_ASSERT (xl_options); GF_ASSERT (conf); - ret = dict_get_str_boolean (options, "dump-fd-stats", _gf_false); + if (xlator_get_volopt_info (&this->volume_options, "dump-fd-stats", + &def_val, NULL)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + " dump-fd-stats not found"); + ret = -1; + goto out; + } else { + if (gf_string2boolean (def_val, &def_bool)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + "dump-fd-stats corrupt"); + ret = -1; + goto out; + } + } + ret = dict_get_str_boolean (xl_options, "dump-fd-stats", def_bool); if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, "'dump-fd-stats' takes only boolean arguments"); @@ -2324,7 +2343,7 @@ iostats_configure_options (xlator_t *this, dict_t *options, gf_log (this->name, GF_LOG_DEBUG, "disabling dump-fd-stats"); } - ret = dict_get_str_boolean (options, "count-fop-hits", _gf_false); + ret = dict_get_str_boolean (xl_options, "count-fop-hits", _gf_false); if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, "'count-fop-hits' takes only boolean arguments"); @@ -2338,7 +2357,22 @@ iostats_configure_options (xlator_t *this, dict_t *options, "disabling count-fop-hits"); } - ret = dict_get_str_boolean (options, "latency-measurement", 0); + if (xlator_get_volopt_info (&this->volume_options, "latency-measurement", + &def_val, NULL)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + "latency-measurement not found"); + ret = -1; + goto out; + } else { + if (gf_string2boolean (def_val, &def_bool)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + "latency-measurement corrupt"); + ret = -1; + goto out; + } + } + ret = dict_get_str_boolean (xl_options, "latency-measurement", + def_bool); if (ret != -1) { if (conf->measure_latency != ret) { gf_log (this->name, GF_LOG_DEBUG, @@ -2351,7 +2385,7 @@ iostats_configure_options (xlator_t *this, dict_t *options, "'latency-measurement' takes only boolean arguments"); } - ret = dict_get_str (options, "log-level", &log_str); + ret = dict_get_str (xl_options, "log-level", &log_str); if (!ret) { if (!is_gf_log_command(this, "trusted.glusterfs.set-log-level", log_str)) { @@ -2359,7 +2393,11 @@ iostats_configure_options (xlator_t *this, dict_t *options, "changing log-level to %s", log_str); } } - return 0; + ret = 0; + out: + gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + return ret; + } int @@ -2635,9 +2673,15 @@ struct xlator_cbks cbks = { struct volume_options options[] = { { .key = {"dump-fd-stats"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "off", + .description = "If on stats related to file-operations would be " + "tracked inside GlusterFS data-structures." }, { .key = { "latency-measurement" }, .type = GF_OPTION_TYPE_BOOL, + .default_value = "off", + .description = "If on stats related to the latency of each operation " + "would be tracked inside GlusterFS data-structures. " }, { .key = {"count-fop-hits"}, .type = GF_OPTION_TYPE_BOOL, @@ -2647,5 +2691,21 @@ struct volume_options options[] = { .value = { "DEBUG", "WARNING", "ERROR", "INFO", "CRITICAL", "NONE", "TRACE"} }, - { .key = {NULL} }, + + /* These are synthetic entries to assist validation of CLI's * + * volume set command */ + { .key = {"client-log-level"}, + .type = GF_OPTION_TYPE_STR, + .default_value = "INFO", + .description = "Changes the log-level of the clients", + .value = { "DEBUG", "WARNING", "ERROR", "CRITICAL", "NONE", "TRACE"} + }, + { .key = {"brick-log-level"}, + .type = GF_OPTION_TYPE_STR, + .default_value = "INFO", + .description = "Changes the log-level of the bricks", + .value = { "DEBUG", "WARNING", "ERROR", "CRITICAL", "NONE", "TRACE"} + }, + { .key = {NULL} }, + }; |