summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src/client.c
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2010-10-05 07:02:07 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-05 05:47:38 -0700
commit6b74f3ec7b6e0fed2e253df456b067fc27049117 (patch)
treea4f51f043b8d169bf1be46e7b482fca9f3d29d77 /xlators/protocol/client/src/client.c
parent7aec50bdad06665243a16f1ce83a03037bcd5d56 (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/protocol/client/src/client.c')
-rw-r--r--xlators/protocol/client/src/client.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 5cf3b1ea19f..50cb917aacc 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -1782,6 +1782,77 @@ out:
}
int
+validate_options (xlator_t *this, dict_t *options, 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"
+ "'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"
+ "'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);
+
+ }
+
+ 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);
+
+ }
+
+ ret = 0;
+
+out:
+ return ret;
+
+}
+
+int
reconfigure (xlator_t *this, dict_t *options)
{
int ret = 0;