summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src
diff options
context:
space:
mode:
authorGaurav <gaurav@gluster.com>2011-03-23 00:50:17 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-23 04:55:29 -0700
commit9bd4f25b6b0ea8103324b685fcc21525a29849a8 (patch)
tree7b0e0b875934521dea0c6fdd3412ac61972a527e /xlators/protocol/client/src
parent6f6c817314a2a867be996c2ad6d9a1337617ded4 (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/protocol/client/src')
-rw-r--r--xlators/protocol/client/src/client.c79
1 files changed, 17 insertions, 62 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 3082656f4d5..22394f59fcd 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -2076,72 +2076,31 @@ out:
}
int
-validate_options (xlator_t *this, dict_t *options, char **op_errstr)
+validate_options (xlator_t *this, char **op_errstr)
{
- int ret = 0;
- int timeout_ret=0;
- int ping_timeout;
- int frame_timeout;
-
-
- timeout_ret = dict_get_int32 (options, "frame-timeout",
- &frame_timeout);
- if (timeout_ret == 0) {
- if (frame_timeout < 5 ) {
- gf_log (this->name, GF_LOG_WARNING, "validation of "
- "'option frame-timeout %d failed, min value"
- " can be 5", frame_timeout);
- *op_errstr = gf_strdup ("Error, Min Value 5");
- ret = -1;
- goto out;
- }
-
- if (frame_timeout > 86400 ) {
- gf_log (this->name, GF_LOG_WARNING, "reconfiguration of"
- " 'option frame-timeout %d failed , max value "
- "can be 86400", frame_timeout );
- *op_errstr = gf_strdup ("Error, Max Value 86400");
- ret = -1;
- goto out;
- }
-
-
- gf_log (this->name, GF_LOG_DEBUG,
- "validation otion frame-timeout to %d",
- frame_timeout);
+ 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;
}
- timeout_ret = dict_get_int32 (options, "ping-timeout",
- &ping_timeout);
- if (timeout_ret == 0) {
-
- if (ping_timeout < 5 ) {
- gf_log (this->name, GF_LOG_WARNING, "Reconfiguration"
- " 'option ping-timeout %d failed , Min value"
- " can be 5", ping_timeout);
- *op_errstr = gf_strdup ("Error, Min Value 5");
- ret = -1;
- goto out;
- }
-
- if (ping_timeout > 1013 ) {
- gf_log (this->name, GF_LOG_WARNING, "Reconfiguration"
- " 'option frame-timeout %d failed , Max value"
- " can be 1013,", frame_timeout);
- *op_errstr = gf_strdup ("Error, Max Value 1013");
- ret = -1;
- goto out;
- }
-
- gf_log (this->name, GF_LOG_DEBUG, "Validated "
- "'option ping-timeout' to %d", ping_timeout);
+ 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);
}
- ret = 0;
-
out:
+
return ret;
}
@@ -2169,7 +2128,6 @@ reconfigure (xlator_t *this, dict_t *options)
"'option frame-timeout %d failed , Min value"
" can be 5, Defaulting to old value (%d)"
, frame_timeout, conf->rpc_conf.rpc_timeout);
- ret = -1;
goto out;
}
@@ -2178,7 +2136,6 @@ reconfigure (xlator_t *this, dict_t *options)
"'option frame-timeout %d failed , Max value"
"can be 3600, Defaulting to old value (%d)"
, frame_timeout, conf->rpc_conf.rpc_timeout);
- ret = -1;
goto out;
}
@@ -2201,7 +2158,6 @@ reconfigure (xlator_t *this, dict_t *options)
"'option ping-timeout %d failed , Min value"
" can be 5, Defaulting to old value (%d)"
, ping_timeout, conf->opt.ping_timeout);
- ret = -1;
goto out;
}
@@ -2210,7 +2166,6 @@ reconfigure (xlator_t *this, dict_t *options)
"'option ping-timeout %d failed , Max value"
"can be 1013, Defaulting to old value (%d)"
, ping_timeout, conf->opt.ping_timeout);
- ret = -1;
goto out;
}