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/cluster/dht/src/dht.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'xlators/cluster/dht/src/dht.c') diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index 2c2f1750755..2c8f2e9a224 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -250,6 +250,45 @@ mem_acct_init (xlator_t *this) return ret; } +int +validate_options (xlator_t *this, dict_t *options, char **op_errstr) +{ + char *temp_str = NULL; + gf_boolean_t search_unhashed; + int ret = 0; + + + + + + if (dict_get_str (options, "lookup-unhashed", &temp_str) == 0) { + if (strcasecmp (temp_str, "auto")) { + if (!gf_string2boolean (temp_str, &search_unhashed)) { + gf_log(this->name, GF_LOG_DEBUG, "Validated" + " lookup-unahashed (%s)", + temp_str); + } + else { + gf_log(this->name, GF_LOG_ERROR, "Validation:" + " lookup-unahashed should be boolean," + " not (%s)", + temp_str); + *op_errstr = gf_strdup ("Error, lookup-" + "unhashed be boolean"); + ret = -1; + goto out; + } + + } + } + + + + + +out: + return ret; +} int reconfigure (xlator_t *this, dict_t *options) -- cgit