diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2010-10-05 07:02:07 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-05 05:47:38 -0700 |
commit | 6b74f3ec7b6e0fed2e253df456b067fc27049117 (patch) | |
tree | a4f51f043b8d169bf1be46e7b482fca9f3d29d77 /xlators/performance/io-threads/src/io-threads.c | |
parent | 7aec50bdad06665243a16f1ce83a03037bcd5d56 (diff) |
Reply back to CLI on error, by validating each xlator's opts
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1159 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159
Diffstat (limited to 'xlators/performance/io-threads/src/io-threads.c')
-rw-r--r-- | xlators/performance/io-threads/src/io-threads.c | 42 |
1 files changed, 42 insertions, 0 deletions
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; |