diff options
author | Gaurav <gaurav@gluster.com> | 2011-03-23 00:50:17 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2011-03-23 04:55:29 -0700 |
commit | 9bd4f25b6b0ea8103324b685fcc21525a29849a8 (patch) | |
tree | 7b0e0b875934521dea0c6fdd3412ac61972a527e /xlators/cluster/dht | |
parent | 6f6c817314a2a867be996c2ad6d9a1337617ded4 (diff) |
CLI : Validate options farmework.
Signed-off-by: Gaurav <gaurav@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 2064 (NFS options are removed upon glusterd restart)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2064
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r-- | xlators/cluster/dht/src/dht.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index 61c43a8d604..c9b77d64428 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -258,36 +258,33 @@ mem_acct_init (xlator_t *this) out: return ret; } + int -validate_options (xlator_t *this, dict_t *options, char **op_errstr) +validate_options (xlator_t *this, char **op_errstr) { - char *temp_str = NULL; - gf_boolean_t search_unhashed; - int ret = 0; - - GF_VALIDATE_OR_GOTO ("dht", this, out); - GF_VALIDATE_OR_GOTO ("dht", options, out); + int ret = 0; + volume_opt_list_t *vol_opt = NULL; + volume_opt_list_t *tmp; + + if (!this) { + gf_log (this->name, GF_LOG_DEBUG, "'this' not a valid ptr"); + ret =-1; + goto out; + } - 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; - } + if (list_empty (&this->volume_options)) + goto out; - } + vol_opt = list_entry (this->volume_options.next, + volume_opt_list_t, list); + list_for_each_entry_safe (vol_opt, tmp, &this->volume_options, list) { + ret = validate_xlator_volume_options_attacherr (this, + vol_opt->given_opt, + op_errstr); } out: + return ret; } |