summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2010-09-18 03:31:56 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-18 07:02:03 -0700
commit5c297be9612f76dad6f970092fb6762b4ee4844a (patch)
treef65290e7f12e8d6913f3f3b8d3ffa8dc4cd06618 /xlators/protocol
parentfaa817ea9cb119c7f65fce24f03a172fa4b4ada1 (diff)
Glusterd: gluster volume set <volume> <option> <value>
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')
-rw-r--r--xlators/protocol/client/src/client.c74
-rw-r--r--xlators/protocol/server/src/server.c37
2 files changed, 111 insertions, 0 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 4220afc6d66..e3e143d58b2 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -1751,6 +1751,80 @@ out:
}
int
+reconfigure (xlator_t *this, dict_t *options)
+{
+ int ret = 0;
+ int timeout_ret=0;
+ int ping_timeout;
+ int frame_timeout;
+ clnt_conf_t *conf = NULL;
+
+
+ conf = this->private;
+
+ timeout_ret = dict_get_int32 (options, "frame-timeout",
+ &frame_timeout);
+ if (timeout_ret == 0) {
+ if (frame_timeout < 5 ) {
+ gf_log (this->name, GF_LOG_ERROR, "Reconfiguration"
+ "'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;
+ }
+
+ if (frame_timeout > 3600 ) {
+ gf_log (this->name, GF_LOG_ERROR, "Reconfiguration"
+ "'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;
+ }
+
+
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring otion frame-timeout to %d",
+ frame_timeout);
+
+ conf->rpc_conf.rpc_timeout = frame_timeout;
+ }
+
+ timeout_ret = dict_get_int32 (options, "ping-timeout",
+ &ping_timeout);
+ if (timeout_ret == 0) {
+
+ if (frame_timeout < 5 ) {
+ gf_log (this->name, GF_LOG_WARNING, "Reconfiguration"
+ "'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;
+ }
+
+ if (frame_timeout > 1013 ) {
+ gf_log (this->name, GF_LOG_WARNING, "Reconfiguration"
+ "'option frame-timeout %d failed , Max value"
+ "can be 1013, Defaulting to old value (%d)"
+ , frame_timeout, conf->opt.ping_timeout);
+ ret = -1;
+ goto out;
+ }
+
+ gf_log (this->name, GF_LOG_DEBUG, "Reconfiguring "
+ "'option ping-timeout' to %d", ping_timeout);
+ conf->opt.ping_timeout = ping_timeout;
+ }
+
+out:
+ return ret;
+
+
+}
+
+int
init (xlator_t *this)
{
int ret = -1;
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 5d1f3aabea8..58a57acee1f 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -457,6 +457,43 @@ mem_acct_init (xlator_t *this)
}
int
+reconfigure (xlator_t *this, dict_t *options)
+{
+
+ server_conf_t *conf =NULL;
+ int inode_lru_limit;
+ gf_boolean_t trace;
+ data_t *data;
+ int ret;
+
+ conf = this->private;
+
+ if (dict_get_int32 ( options, "inode-lru-limit", &inode_lru_limit) == 0){
+ conf->inode_lru_limit = inode_lru_limit;
+ gf_log (this->name, GF_LOG_TRACE, "Reconfigured inode-lru-limit"
+ " to %d", conf->inode_lru_limit);
+ }
+
+ data = dict_get (options, "trace");
+ if (data) {
+ ret = gf_string2boolean (data->data, &trace);
+ if (ret != 0) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "'trace' takes on only boolean values. "
+ "Neglecting option");
+ return -1;
+ }
+ conf->trace = trace;
+ gf_log (this->name, GF_LOG_TRACE, "Reconfigured trace"
+ " to %d", conf->trace);
+
+ }
+
+ return 0;
+
+}
+
+int
init (xlator_t *this)
{
int32_t ret = -1;