From 6b74f3ec7b6e0fed2e253df456b067fc27049117 Mon Sep 17 00:00:00 2001 From: Kaushik BV Date: Tue, 5 Oct 2010 07:02:07 +0000 Subject: Reply back to CLI on error, by validating each xlator's opts Signed-off-by: Kaushik BV Signed-off-by: Vijay Bellur BUG: 1159 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159 --- xlators/performance/io-threads/src/io-threads.c | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'xlators/performance/io-threads/src/io-threads.c') diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index b593e90e4..fe3274fc0 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -2084,6 +2084,44 @@ mem_acct_init (xlator_t *this) return ret; } +int +validate_options ( xlator_t *this, dict_t *options, char **op_errstr) +{ + int ret = 0; + int thread_count; + + + if (dict_get (options, "thread-count")) { + thread_count = data_to_int32 (dict_get (options, + "thread-count")); + + if (thread_count < IOT_MIN_THREADS) { + gf_log ("io-threads", GF_LOG_DEBUG, + "volume set thread_count WRONG,it is lesser"); + ret = -1; + *op_errstr = gf_strdup ("LESSER Than min. threads"); + goto out; + } + + if (thread_count > IOT_MAX_THREADS) { + gf_log ("io-threads", GF_LOG_DEBUG, + "volume set thread_count WRONG,it is greater"); + *op_errstr = gf_strdup ("GREATER than max. threads"); + ret = -1; + goto out; + } + + + } + + ret = 0; + +out: + return ret; + + +} + int reconfigure ( xlator_t *this, dict_t *options) @@ -2095,6 +2133,8 @@ reconfigure ( xlator_t *this, dict_t *options) conf = this->private; if (!conf) goto out; + + thread_count = conf->max_count; if (dict_get (options, "thread-count")) { thread_count = data_to_int32 (dict_get (options, @@ -2116,6 +2156,8 @@ reconfigure ( xlator_t *this, dict_t *options) conf->max_count = thread_count; } + else + conf->max_count = thread_count; ret = 0; -- cgit