summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--cli/src/cli-cmd-parser.c16
-rw-r--r--cli/src/cli-cmd-volume.c36
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c157
-rw-r--r--libglusterfs/src/glusterfs.h2
-rw-r--r--libglusterfs/src/graph.c18
-rw-r--r--libglusterfs/src/xlator.c52
-rw-r--r--libglusterfs/src/xlator.h2
-rw-r--r--xlators/cluster/afr/src/afr.c225
-rw-r--r--xlators/cluster/dht/src/dht.c62
-rw-r--r--xlators/cluster/stripe/src/stripe.c36
-rw-r--r--xlators/features/quota/src/quota.c53
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c59
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c257
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.h4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c292
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.h3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd3_1-mops.c8
-rw-r--r--xlators/performance/io-cache/src/io-cache.c159
-rw-r--r--xlators/performance/io-threads/src/io-threads.c41
-rw-r--r--xlators/performance/write-behind/src/write-behind.c51
-rw-r--r--xlators/protocol/client/src/client.c74
-rw-r--r--xlators/protocol/server/src/server.c37
24 files changed, 1608 insertions, 44 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index daec9c8d6e8..479df938677 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -322,12 +322,16 @@ cli_cmd_volume_set_parse (const char **words, int wordcount, dict_t **options)
if (ret)
goto out;
- for (i = 3; i < wordcount; i++) {
- key = strtok ((char *)words[i], "=");
- value = strtok (NULL, "=");
-
- GF_ASSERT (key);
- GF_ASSERT (value);
+ for (i = 3; i < wordcount; i+=2) {
+
+ key = (char *) words[i];
+ value = (char *) words[i+1];
+
+ if ( !key || !value) {
+ ret = -1;
+ cli_out ("Usage: volume set <VOLNAME> <KEY> <VALUE>");
+ goto out;
+ }
count++;
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index b8a5df6d642..fc7fda9dfc2 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -71,6 +71,11 @@ cli_cmd_volume_info_usage ()
cli_out ("Usage: volume info [all|<VOLNAME>]");
}
+void
+cli_cmd_volume_set_usage ()
+{
+ cli_out ("Usage: volume set <VOLNAME> <KEY> <VALUE>");
+}
int
cli_cmd_volume_info_cbk (struct cli_state *state, struct cli_cmd_word *word,
const char **words, int wordcount)
@@ -424,8 +429,35 @@ int
cli_cmd_volume_set_cbk (struct cli_state *state, struct cli_cmd_word *word,
const char **words, int wordcount)
{
- cli_cmd_broadcast_response (0);
- return 0;
+
+ int ret = -1;
+ rpc_clnt_procedure_t *proc = NULL;
+ call_frame_t *frame = NULL;
+ dict_t *options = NULL;
+
+ proc = &cli_rpc_prog->proctable[GF1_CLI_SET_VOLUME];
+
+ frame = create_frame (THIS, THIS->ctx->pool);
+ if (!frame)
+ goto out;
+
+ ret = cli_cmd_volume_set_parse (words, wordcount, &options);
+
+ if (ret) {
+ cli_cmd_volume_set_usage ();
+ goto out;
+ }
+
+ if (proc->fn) {
+ ret = proc->fn (frame, THIS, options);
+ }
+
+out:
+ if (options)
+ dict_unref (options);
+
+ return ret;
+
}
void
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index c674533e492..6e3cda951aa 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -161,6 +161,152 @@ out:
static char oldvolfile[131072];
static int oldvollen = 0;
+static int
+xlator_equal_rec (xlator_t *xl1, xlator_t *xl2)
+{
+ xlator_list_t *trav1 = NULL;
+ xlator_list_t *trav2 = NULL;
+ int ret = 0;
+
+ if (xl1 == NULL || xl2 == NULL) {
+ gf_log ("xlator", GF_LOG_DEBUG, "invalid argument");
+ return -1;
+ }
+
+ trav1 = xl1->children;
+ trav2 = xl2->children;
+
+ while (trav1 && trav2) {
+ ret = xlator_equal_rec (trav1->xlator, trav2->xlator);
+ if (ret) {
+ gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
+ "xlators children not equal");
+ goto out;
+ }
+
+ trav1 = trav1->next;
+ trav2 = trav2->next;
+ }
+
+ if (trav1 || trav2) {
+ ret = -1;
+ goto out;
+ }
+
+ if (strcmp (xl1->name, xl2->name)) {
+ ret = -1;
+ goto out;
+ }
+out :
+ return ret;
+}
+
+static gf_boolean_t
+is_graph_topology_equal (glusterfs_graph_t *graph1,
+ glusterfs_graph_t *graph2)
+{
+ xlator_t *trav1 = NULL;
+ xlator_t *trav2 = NULL;
+ gf_boolean_t ret = _gf_true;
+
+ trav1 = graph1->first;
+ trav2 = graph2->first;
+
+ ret = xlator_equal_rec (trav1, trav2);
+
+ if (ret) {
+ gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
+ "graphs are not equal");
+ ret = _gf_false;
+ goto out;
+ }
+
+ ret = _gf_true;
+ gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
+ "graphs are equal");
+
+out:
+ return ret;
+}
+
+static int
+glusterfs_volfile_reconfigure (FILE *newvolfile_fp)
+{
+ glusterfs_graph_t *oldvolfile_graph = NULL;
+ glusterfs_graph_t *newvolfile_graph = NULL;
+ FILE *oldvolfile_fp = NULL;
+ glusterfs_ctx_t *ctx = NULL;
+
+ int ret = 0;
+
+ oldvolfile_fp = tmpfile ();
+ if (!oldvolfile_fp)
+ goto out;
+
+ if (!oldvollen)
+ goto out;
+
+ fwrite (oldvolfile, oldvollen, 1, oldvolfile_fp);
+ fflush (oldvolfile_fp);
+
+
+ oldvolfile_graph = glusterfs_graph_construct (oldvolfile_fp);
+ if (!oldvolfile_graph) {
+ ret = -1;
+ goto out;
+ }
+
+ newvolfile_graph = glusterfs_graph_construct (newvolfile_fp);
+ if (!oldvolfile_graph) {
+ ret = -1;
+ goto out;
+ }
+
+ if (!is_graph_topology_equal (oldvolfile_graph,
+ newvolfile_graph)) {
+
+ gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
+ "Graph topology not equal");
+ ret = 0;
+ goto out;
+ }
+
+ gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
+ "Only options have changed in the new "
+ "graph");
+
+ ctx = glusterfs_ctx_get ();
+
+ if (!ctx) {
+ gf_log ("glusterfsd-mgmt", GF_LOG_ERROR,
+ "glusterfs_ctx_get() returned NULL");
+ ret = -1;
+ goto out;
+ }
+
+ oldvolfile_graph = ctx->active;
+
+ if (!oldvolfile_graph) {
+ gf_log ("glusterfsd-mgmt", GF_LOG_ERROR,
+ "glsuterfs_ctx->active is NULL");
+ ret = -1;
+ goto out;
+ }
+
+
+
+ ret = glusterfs_graph_reconfigure (oldvolfile_graph,
+ newvolfile_graph);
+ if (ret) {
+ gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
+ "Could not reconfigure new options in old "
+ "graph");
+ }
+
+out:
+ return ret;
+}
+
int
mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
void *myframe)
@@ -209,6 +355,17 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
fwrite (rsp.spec, size, 1, tmpfp);
fflush (tmpfp);
+ /* Check if only options have changed. No need to reload the
+ volfile if topology hasn't changed.
+ */
+
+ ret = glusterfs_volfile_reconfigure (tmpfp);
+ if (ret) {
+ gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
+ "No need to re-load volfile");
+ goto out;
+ }
+
ret = glusterfs_process_volfp (ctx, tmpfp);
if (ret)
goto out;
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 1d0369c4d61..669bbfaeb55 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -310,4 +310,6 @@ int glusterfs_graph_destroy (glusterfs_graph_t *graph);
int glusterfs_graph_activate (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx);
glusterfs_graph_t *glusterfs_graph_construct (FILE *fp);
glusterfs_graph_t *glusterfs_graph_new ();
+int glusterfs_graph_reconfigure (glusterfs_graph_t *oldgraph,
+ glusterfs_graph_t *newgraph);
#endif /* _GLUSTERFS_H */
diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c
index 4adb04a39c3..c44fa44ad9b 100644
--- a/libglusterfs/src/graph.c
+++ b/libglusterfs/src/graph.c
@@ -495,6 +495,24 @@ glusterfs_graph_activate (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx)
return 0;
}
+int
+glusterfs_graph_reconfigure (glusterfs_graph_t *oldgraph,
+ glusterfs_graph_t *newgraph)
+{
+ xlator_t *old_xl = NULL;
+ xlator_t *new_xl = NULL;
+ int ret = 0;
+
+ GF_ASSERT (oldgraph);
+ GF_ASSERT (newgraph);
+
+ old_xl = oldgraph->first;
+ new_xl = newgraph->first;
+
+ ret = xlator_tree_reconfigure (old_xl, new_xl);
+
+ return ret;
+}
int
glusterfs_graph_destroy (glusterfs_graph_t *graph)
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 2074c143c8c..393088019f7 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -749,6 +749,12 @@ xlator_set_type (xlator_t *xl,
dlerror ());
}
+ if (!(xl->reconfigure = dlsym (handle, "reconfigure"))) {
+ gf_log ("xlator", GF_LOG_ERROR,
+ "dlsym(reconfigure) on %s -- neglecting",
+ dlerror());
+ }
+
INIT_LIST_HEAD (&xl->volume_options);
vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t),
@@ -910,6 +916,35 @@ xlator_fini_rec (xlator_t *xl)
}
}
+static void
+xlator_reconfigure_rec (xlator_t *old_xl, xlator_t *new_xl)
+{
+ xlator_list_t *trav1 = NULL;
+ xlator_list_t *trav2 = NULL;
+
+ if (old_xl == NULL || new_xl == NULL) {
+ gf_log ("xlator", GF_LOG_DEBUG, "invalid argument");
+ return;
+ }
+
+ trav1 = old_xl->children;
+ trav2 = new_xl->children;
+
+ while (trav1 && trav2) {
+ xlator_reconfigure_rec (trav1->xlator, trav2->xlator);
+
+ gf_log (trav1->xlator->name, GF_LOG_DEBUG, "reconfigured");
+
+ trav1 = trav1->next;
+ trav2 = trav2->next;
+ }
+
+ if (old_xl->reconfigure)
+ old_xl->reconfigure (old_xl, new_xl->options);
+ else
+ gf_log (old_xl->name, GF_LOG_DEBUG, "No reconfigure() found");
+
+}
int
xlator_notify (xlator_t *xl, int event, void *data, ...)
@@ -976,6 +1011,23 @@ xlator_tree_fini (xlator_t *xl)
xlator_fini_rec (top);
}
+int
+xlator_tree_reconfigure (xlator_t *old_xl, xlator_t *new_xl)
+{
+ xlator_t *new_top = NULL;
+ xlator_t *old_top = NULL;
+
+ GF_ASSERT (old_xl);
+ GF_ASSERT (new_xl);
+
+ old_top = old_xl;
+ new_top = new_xl;
+
+ xlator_reconfigure_rec (old_top, new_top);
+
+ return 0;
+}
+
int
xlator_tree_free (xlator_t *tree)
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index 2aa9b372b8a..84ad990d446 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -806,6 +806,7 @@ struct _xlator {
void (*fini) (xlator_t *this);
int32_t (*init) (xlator_t *this);
+ int32_t (*reconfigure) (xlator_t *this, dict_t *options);
int32_t (*mem_acct_init) (xlator_t *this);
event_notify_fn_t notify;
@@ -854,6 +855,7 @@ int loc_copy (loc_t *dst, loc_t *src);
#define loc_dup(src, dst) loc_copy(dst, src)
void loc_wipe (loc_t *loc);
int xlator_mem_acct_init (xlator_t *xl, int num_types);
+int xlator_tree_reconfigure (xlator_t *old_xl, xlator_t *new_xl);
#define GF_STAT_PRINT_FMT_STR "%"PRIx64",%"PRIx64",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx64",%"PRIx64",%"PRIx32",%"PRIx64",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32"\n"
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index e1154f9d154..a5906550d52 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -61,6 +61,231 @@ mem_acct_init (xlator_t *this)
}
+int
+reconfigure (xlator_t *this, dict_t *options)
+{
+
+ gf_boolean_t metadata_self_heal; /* on/off */
+ gf_boolean_t entry_self_heal;
+ gf_boolean_t data_self_heal;
+ gf_boolean_t data_change_log; /* on/off */
+ gf_boolean_t metadata_change_log; /* on/off */
+ gf_boolean_t entry_change_log; /* on/off */
+ gf_boolean_t strict_readdir;
+
+ afr_private_t * priv = NULL;
+ xlator_list_t * trav = NULL;
+
+ char * read_subvol = NULL;
+ char * self_heal = NULL;
+ char * change_log = NULL;
+ char * str_readdir = NULL;
+
+ int32_t background_count = 0;
+ int32_t window_size = 0;
+
+ int read_ret = -1;
+ int dict_ret = -1;
+ int flag = 1;
+ int ret = 0;
+ int temp_ret = -1;
+
+ priv = this->private;
+
+ dict_ret = dict_get_int32 (options, "background-self-heal-count",
+ &background_count);
+ if (dict_ret == 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring background self-heal count to %d",
+ background_count);
+
+ priv->background_self_heal_count = background_count;
+ }
+
+ dict_ret = dict_get_str (options, "metadata-self-heal",
+ &self_heal);
+ if (dict_ret == 0) {
+ temp_ret = gf_string2boolean (self_heal, &metadata_self_heal);
+ if (temp_ret < 0) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Reconfiguration Invalid 'option metadata"
+ "-self-heal %s'. Defaulting to old value.",
+ self_heal);
+ ret = -1;
+ goto out;
+ }
+
+ priv->metadata_self_heal = metadata_self_heal;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring 'option metadata"
+ "-self-heal %s'.",
+ self_heal);
+ }
+
+ dict_ret = dict_get_str (options, "data-self-heal",
+ &self_heal);
+ if (dict_ret == 0) {
+ temp_ret = gf_string2boolean (self_heal, &data_self_heal);
+ if (temp_ret < 0) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Reconfiguration Invalid 'option data"
+ "-self-heal %s'. Defaulting to old value.",
+ self_heal);
+ ret = -1;
+ goto out;
+ }
+
+ priv->data_self_heal = data_self_heal;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring 'option data"
+ "-self-heal %s'.", self_heal);
+ }
+
+ dict_ret = dict_get_str (options, "entry-self-heal",
+ &self_heal);
+ if (dict_ret == 0) {
+ temp_ret = gf_string2boolean (self_heal, &entry_self_heal);
+ if (temp_ret < 0) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Reconfiguration Invalid 'option data"
+ "-self-heal %s'. Defaulting to old value.",
+ self_heal);
+ ret = -1;
+ goto out;
+ }
+
+ priv->entry_self_heal = entry_self_heal;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring 'option entry"
+ "-self-heal %s'.", self_heal);
+ }
+
+
+ dict_ret = dict_get_str (options, "strict-readdir",
+ &str_readdir);
+ if (dict_ret == 0) {
+ temp_ret = gf_string2boolean (str_readdir, &strict_readdir);
+ if (temp_ret < 0) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Invalid 'option strict-readdir %s'. "
+ "Defaulting to old value.",
+ str_readdir);
+ ret = -1;
+ goto out;
+ }
+
+ priv->strict_readdir = strict_readdir;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring 'option strict"
+ "-readdir %s'.", str_readdir);
+ }
+
+ dict_ret = dict_get_int32 (options, "data-self-heal-window-size",
+ &window_size);
+ if (dict_ret == 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring, Setting data self-heal window size to %d",
+ window_size);
+
+ priv->data_self_heal_window_size = window_size;
+ }
+
+ dict_ret = dict_get_str (options, "data-change-log",
+ &change_log);
+ if (dict_ret == 0) {
+ temp_ret = gf_string2boolean (change_log, &data_change_log);
+ if (temp_ret < 0) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Reconfiguration Invalid 'option data-"
+ "change-log %s'. Defaulting to old value.",
+ change_log);
+ ret = -1;
+ goto out;
+ }
+
+ priv->data_change_log = data_change_log;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring 'option data-"
+ "change-log %s'.", change_log);
+ }
+
+ dict_ret = dict_get_str (options, "metadata-change-log",
+ &change_log);
+ if (dict_ret == 0) {
+ temp_ret = gf_string2boolean (change_log,
+ &metadata_change_log);
+ if (temp_ret < 0) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Invalid 'option metadata-change-log %s'. "
+ "Defaulting to metadata-change-log as 'off'.",
+ change_log);
+ ret = -1;
+ goto out;
+ }
+
+ priv->metadata_change_log = metadata_change_log;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring 'option metadata-"
+ "change-log %s'.", change_log);
+ }
+
+ dict_ret = dict_get_str (options, "entry-change-log",
+ &change_log);
+ if (dict_ret == 0) {
+ temp_ret = gf_string2boolean (change_log, &entry_change_log);
+ if (temp_ret < 0) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Invalid 'option entry-change-log %s'. "
+ "Defaulting to entry-change-log as 'on'.",
+ change_log);
+ ret = -1;
+ goto out;
+ }
+
+ priv->entry_change_log = entry_change_log;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring 'option entry-"
+ "change-log %s'.", change_log);
+ }
+
+ read_ret = dict_get_str (options, "read-subvolume", &read_subvol);
+
+ if (read_ret == -1)
+ goto next;// No need to traverse, hence set the next option
+
+ trav = this->children;
+ flag = 0;
+ while (trav) {
+ if (!read_ret && !strcmp (read_subvol, trav->xlator->name)) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Subvolume '%s' specified as read child.",
+ trav->xlator->name);
+
+ flag = 1;
+ ret = -1;
+ goto out;
+ }
+
+
+ trav = trav->next;
+ }
+
+ if (flag == 0 ) {
+
+ gf_log (this->name, GF_LOG_ERROR,
+ "Invalid 'option read-subvolume %s', no such subvolume"
+ , read_subvol);
+ ret = -1;
+ goto out;
+ }
+
+next:
+out:
+ return ret;
+
+}
+
+
static const char *favorite_child_warning_str = "You have specified subvolume '%s' "
"as the 'favorite child'. This means that if a discrepancy in the content "
"or attributes (ownership, permission, etc.) of a file is detected among "
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c
index c926a1cf400..bd0258eae21 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -252,6 +252,68 @@ mem_acct_init (xlator_t *this)
}
int
+reconfigure (xlator_t *this, dict_t *options)
+{
+ dht_conf_t *conf = NULL;
+ char *temp_str = NULL;
+ gf_boolean_t search_unhashed;
+ uint32_t temp_free_disk = 0;
+ int ret = 0;
+
+
+ conf = this->private;
+
+ if (dict_get_str (options, "lookup-unhashed", &temp_str) == 0) {
+ /* If option is not "auto", other options _should_ be boolean*/
+ if (strcasecmp (temp_str, "auto")) {
+ if (!gf_string2boolean (temp_str, &search_unhashed)) {
+ gf_log(this->name, GF_LOG_DEBUG, "Reconfigure:"
+ " lookup-unahashed reconfigured (%s)",
+ temp_str);
+ conf->search_unhashed = search_unhashed;
+ }
+ else {
+ gf_log(this->name, GF_LOG_ERROR, "Reconfigure:"
+ " lookup-unahashed should be boolean,"
+ " not (%s), defaulting to (%d)",
+ temp_str, conf->search_unhashed);
+ //return -1;
+ ret = -1;
+ goto out;
+ }
+
+ }
+ else {
+ gf_log(this->name, GF_LOG_DEBUG, "Reconfigure:"
+ " lookup-unahashed reconfigured auto ");
+ conf->search_unhashed = GF_DHT_LOOKUP_UNHASHED_AUTO;
+ }
+ }
+
+ if (dict_get_str (options, "min-free-disk", &temp_str) == 0) {
+ if (gf_string2percent (temp_str, &temp_free_disk) == 0) {
+ if (temp_free_disk > 100) {
+ gf_string2bytesize (temp_str,
+ &conf->min_free_disk);
+ conf->disk_unit = 'b';
+ } else {
+ conf->min_free_disk = (uint64_t)temp_free_disk;
+ }
+ } else {
+ gf_string2bytesize (temp_str, &conf->min_free_disk);
+ conf->disk_unit = 'b';
+ }
+
+ gf_log(this->name, GF_LOG_DEBUG, "Reconfigure:"
+ " min-free-disk reconfigured to ",
+ temp_str);
+ }
+
+out:
+ return ret;
+}
+
+int
init (xlator_t *this)
{
dht_conf_t *conf = NULL;
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c
index a9f62038914..00c888f68dd 100644
--- a/xlators/cluster/stripe/src/stripe.c
+++ b/xlators/cluster/stripe/src/stripe.c
@@ -3674,8 +3674,7 @@ set_stripe_block_size (xlator_t *this, stripe_private_t *priv, char *data)
stripe_str = strtok_r (data, ",", &tmp_str);
while (stripe_str) {
dup_str = gf_strdup (stripe_str);
- stripe_opt = GF_CALLOC (1, sizeof (struct stripe_options),
- gf_stripe_mt_stripe_options);
+ stripe_opt = CALLOC (1, sizeof (struct stripe_options));
if (!stripe_opt) {
GF_FREE (dup_str);
goto out;
@@ -3735,6 +3734,37 @@ out:
return ret;
}
+int
+reconfigure (xlator_t *this, dict_t *options)
+{
+
+ stripe_private_t *priv = NULL;
+ data_t *data = NULL;
+ int ret = 0;
+
+
+ priv = this->private;
+
+ data = dict_get (options, "block-size");
+ if (data) {
+ gf_log (this->name, GF_LOG_TRACE,"Reconfiguring Stripe"
+ " Block-size");
+ ret = set_stripe_block_size (this, priv, data->data);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Reconfigue: Block-Size reconfiguration failed");
+ ret = -1;
+ goto out;
+ }
+ gf_log (this->name, GF_LOG_TRACE,
+ "Reconfigue: Block-Size reconfigured Successfully");
+ }
+
+out:
+ return ret;
+
+}
+
/**
* init - This function is called when xlator-graph gets initialized.
* The option given in volfiles are parsed here.
@@ -3873,7 +3903,7 @@ fini (xlator_t *this)
while (trav) {
prev = trav;
trav = trav->next;
- GF_FREE (prev);
+ FREE (prev);
}
LOCK_DESTROY (&priv->lock);
GF_FREE (priv);
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index 4e9b587c27f..094b62d4a56 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -1042,6 +1042,57 @@ mem_acct_init (xlator_t *this)
return ret;
}
+int
+reconfigure (xlator_t *this, dict_t *options)
+{
+
+ struct quota_priv *_private = NULL;
+ uint64_t disk_usage_limit;
+ uint32_t min_free_disk_limit;
+ data_t *data = NULL;
+ int ret = 0;
+
+ _private = this->private;
+
+ data = dict_get (options, "disk-usage-limit");
+ if (data) {
+ if (gf_string2bytesize (data->data, &disk_usage_limit) != 0) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Reconfigure: Invalid number '%s' "
+ "for disk-usage limit", data->data);
+ //return -1;
+ ret = -1;
+ goto out;
+ }
+ _private->disk_usage_limit = disk_usage_limit;
+ gf_log (this->name, GF_LOG_TRACE,
+ "Reconfiguring disk-usage-limit %"PRIu64"",
+ disk_usage_limit);
+
+ }
+
+
+ data = dict_get (options, "min-free-disk-limit");
+ if (data) {
+ if (gf_string2percent (data->data, &min_free_disk_limit) != 0){
+ gf_log (this->name, GF_LOG_ERROR,
+ "Reconfigure : Invalid percent '%s' for"
+ " min-free-disk-limit", data->data);
+ ret = -1;
+ goto out;
+ }
+
+ _private->min_free_disk_limit = min_free_disk_limit;
+ gf_log (this->name, GF_LOG_TRACE,
+ "Reconfiguring min-free-disk-limit %d \%",
+ min_free_disk_limit);
+
+ }
+out:
+ return ret;
+
+}
+
int32_t
init (xlator_t *this)
{
@@ -1106,6 +1157,8 @@ init (xlator_t *this)
return ret;
}
+
+
void
fini (xlator_t *this)
{
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 2c99a60e2ca..bc015293f4a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -1641,6 +1641,42 @@ out:
}
int
+glusterd_handle_set_volume (rpcsvc_request_t *req)
+{
+ int32_t ret = -1;
+ gf1_cli_set_vol_req cli_req = {0,};
+ dict_t *dict = NULL;
+
+ GF_ASSERT (req);
+
+ if (!gf_xdr_to_cli_set_vol_req (req->msg[0], &cli_req)) {
+ //failed to decode msg;
+ req->rpc_err = GARBAGE_ARGS;
+ goto out;
+ }
+
+ if (cli_req.dict.dict_len) {
+ /* Unserialize the dictionary */
+ dict = dict_new ();
+
+ ret = dict_unserialize (cli_req.dict.dict_val,
+ cli_req.dict.dict_len,
+ &dict);
+ if (ret < 0) {
+ gf_log ("glusterd", GF_LOG_ERROR,
+ "failed to "
+ "unserialize req-buffer to dictionary");
+ goto out;
+ }
+ }
+
+ ret = glusterd_set_volume (req, dict);
+
+out:
+ return ret;
+}
+
+int
glusterd_handle_remove_brick (rpcsvc_request_t *req)
{
int32_t ret = -1;
@@ -2970,6 +3006,29 @@ glusterd_replace_brick (rpcsvc_request_t *req, dict_t *dict)
}
int32_t
+glusterd_set_volume (rpcsvc_request_t *req, dict_t *dict)
+{
+ int32_t ret = -1;
+
+ GF_ASSERT (req);
+ GF_ASSERT (dict);
+
+ glusterd_op_set_op (GD_OP_SET_VOLUME);
+
+ glusterd_op_set_ctx (GD_OP_SET_VOLUME, dict);
+
+ glusterd_op_set_ctx_free (GD_OP_SET_VOLUME, _gf_true);
+
+ glusterd_op_set_cli_op (GD_MGMT_CLI_SET_VOLUME);
+
+ glusterd_op_set_req (req);
+
+ ret = glusterd_op_txn_begin ();
+
+ return ret;
+}
+
+int32_t
glusterd_remove_brick (rpcsvc_request_t *req, dict_t *dict)
{
int32_t ret = -1;
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 1497ae4adae..651cb22e036 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -118,6 +118,7 @@ glusterd_op_get_len (glusterd_op_t op)
case GD_OP_START_BRICK:
break;
+ case GD_OP_SET_VOLUME:
case GD_OP_REPLACE_BRICK:
case GD_OP_ADD_BRICK:
{
@@ -125,7 +126,6 @@ glusterd_op_get_len (glusterd_op_t op)
ret = dict_serialized_length (dict);
return ret;
}
-
case GD_OP_REMOVE_BRICK:
{
dict_t *dict = glusterd_op_get_ctx (op);
@@ -266,6 +266,20 @@ glusterd_op_build_payload (glusterd_op_t op, gd1_mgmt_stage_op_req **req)
}
break;
+ case GD_OP_SET_VOLUME:
+ {
+ dict_t *dict = NULL;
+ dict = glusterd_op_get_ctx (op);
+ GF_ASSERT (dict);
+ ret = dict_allocate_and_serialize (dict,
+ &stage_req->buf.buf_val,
+ (size_t *)&stage_req->buf.buf_len);
+ if (ret) {
+ goto out;
+ }
+ }
+ break;
+
case GD_OP_REMOVE_BRICK:
{
dict_t *dict = NULL;
@@ -996,6 +1010,128 @@ out:
}
static int
+glusterd_op_stage_set_volume (gd1_mgmt_stage_op_req *req)
+{
+ int ret = 0;
+ dict_t *dict = NULL;
+ char *volname = NULL;
+ gf_boolean_t exists = _gf_false;
+ char *key = NULL;
+ char str[100] = {0, };
+ int count = 0;
+
+ GF_ASSERT (req);
+
+ dict = dict_new ();
+ if (!dict)
+ goto out;
+
+ ret = dict_unserialize (req->buf.buf_val, req->buf.buf_len, &dict);
+
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "Unable to unserialize dict");
+ goto out;
+ }
+
+ ret = dict_get_str (dict, "volname", &volname);
+
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "Unable to get volume name");
+ goto out;
+ }
+
+ exists = glusterd_check_volume_exists (volname);
+
+ if (!exists) {
+ gf_log ("", GF_LOG_ERROR, "Volume with name: %s "
+ "does not exist",
+ volname);
+ ret = -1;
+ goto out;
+ }
+
+
+ for ( count = 1; ret != -1 ; count++ ) {
+
+ sprintf (str, "key%d", count);
+ ret = dict_get_str (dict, str, &key);
+
+
+ if (ret)
+ break;
+
+ exists = glusterd_check_option_exists(key);
+
+ if (!exists) {
+ gf_log ("", GF_LOG_ERROR, "Option with name: %s "
+ "does not exist", key);
+ ret = -1;
+ goto out;
+ }
+
+
+ }
+
+ if ( count == 1 ) {
+ gf_log ("", GF_LOG_ERROR, "No options received ");
+ ret = -1;
+ goto out;
+ }
+
+ ret = 0;
+
+out:
+ gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+
+ return ret;
+}
+
+
+char *set_option_list[] = {
+ "max-file-size",
+ "min-file-size",
+ "cache-timeout",
+ "priority",
+ "entry-change-log",
+ "read-subvolume",
+ "background-self-heal-count",
+ "metadata-self-heal",
+ "data-self-heal",
+ "entry-self-heal",
+ "strict-readdir",
+ "data-self-heal-window-size",
+ "data-change-log",
+ "metadata-change-log",
+ "frame-timeout",
+ "ping-timeout",
+ "cache-size",
+ "disk-usage-limit",
+ "min-free-disk-limit",
+ "block-size",
+ "inode-lru-limit",
+ "thread-count" ,
+ "lookup-unhashed",
+ "min-free-disk"
+};
+
+
+gf_boolean_t
+glusterd_check_option_exists(char *optstring)
+{
+ //struct set_option_list *list;
+ char **list = NULL;
+
+
+ for (list = &set_option_list[0]; *list ;list++)
+ if (!strcmp (optstring, *list))
+ return _gf_true;
+
+
+ return _gf_false;
+
+}
+
+static int
glusterd_op_stage_remove_brick (gd1_mgmt_stage_op_req *req)
{
int ret = 0;
@@ -2231,6 +2367,106 @@ out:
}
static int
+glusterd_op_set_volume (gd1_mgmt_stage_op_req *req)
+{
+ int ret = 0;
+ dict_t *dict = NULL;
+ glusterd_volinfo_t *volinfo = NULL;
+ char *volname = NULL;
+ xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
+ int count = 1;
+ char *key = NULL;
+ char *value = NULL;
+ char str[50] = {0, };
+ GF_ASSERT (req);
+
+ this = THIS;
+ GF_ASSERT (this);
+
+ priv = this->private;
+ GF_ASSERT (priv);
+
+ dict = dict_new ();
+ if (!dict)
+ goto out;
+
+
+ ret = dict_unserialize (req->buf.buf_val, req->buf.buf_len, &dict);
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "Unable to unserialize dict");
+ goto out;
+ }
+
+ ret = dict_get_str (dict, "volname", &volname);
+
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "Unable to get volume name");
+ goto out;
+ }
+
+ ret = glusterd_volinfo_find (volname, &volinfo);
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "Unable to allocate memory");
+ goto out;
+ }
+
+ for ( count = 1; ret != -1 ; count++ ) {
+
+ sprintf (str, "key%d", count);
+ ret = dict_get_str (dict, str, &key);
+
+
+ if (ret)
+ break;
+
+ sprintf (str, "value%d", count);
+ ret = dict_get_str (dict, str, &value);
+
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "invalid key,value pair"
+ "in 'volume set'");
+ ret = -1;
+ goto out;
+ }
+
+ ret = set_xlator_option (volinfo->dict, key, value);
+
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "Unable to set the options"
+ "in 'volume set'");
+ ret = -1;
+ goto out;
+ }
+ }
+
+ if ( count == 1 ) {
+ gf_log ("", GF_LOG_ERROR, "No options received ");
+ ret = -1;
+ goto out;
+ }
+
+ ret = glusterd_create_volfiles (volinfo);
+
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "Unable to create volfile for"
+ " 'volume set'");
+ ret = -1;
+ goto out;
+ }
+
+
+
+
+ gf_log ("", GF_LOG_DEBUG, "Received set volume command");
+
+ ret = 0;
+
+out:
+ return ret;
+}
+
+static int
glusterd_op_remove_brick (gd1_mgmt_stage_op_req *req)
{
int ret = 0;
@@ -3208,6 +3444,17 @@ glusterd_op_send_cli_response (int32_t op, int32_t op_ret,
break;
}
+ case GD_MGMT_CLI_SET_VOLUME:
+ {
+ gf1_cli_set_vol_rsp rsp = {0,};
+ rsp.op_ret = op_ret;
+ rsp.op_errno = op_errno;
+ rsp.volname = "";
+ cli_rsp = &rsp;
+ sfunc = gf_xdr_serialize_cli_set_vol_rsp;
+ break;
+ }
+
case GD_MGMT_CLI_LOG_FILENAME:
{
gf1_cli_log_filename_rsp rsp = {0,};
@@ -3460,6 +3707,10 @@ glusterd_op_stage_validate (gd1_mgmt_stage_op_req *req, char **op_errstr)
ret = glusterd_op_stage_replace_brick (req);
break;
+ case GD_OP_SET_VOLUME:
+ ret = glusterd_op_stage_set_volume (req);
+ break;
+
case GD_OP_REMOVE_BRICK:
ret = glusterd_op_stage_remove_brick (req);
break;
@@ -3515,6 +3766,10 @@ glusterd_op_commit_perform (gd1_mgmt_stage_op_req *req, char **op_errstr)
ret = glusterd_op_replace_brick (req);
break;
+ case GD_OP_SET_VOLUME:
+ ret = glusterd_op_set_volume (req);
+ break;
+
case GD_OP_REMOVE_BRICK:
ret = glusterd_op_remove_brick (req);
break;
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
index 66435c8d242..e14f007591e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
@@ -96,6 +96,7 @@ typedef enum glusterd_op_ {
GD_OP_ADD_BRICK,
GD_OP_REMOVE_BRICK,
GD_OP_REPLACE_BRICK,
+ GD_OP_SET_VOLUME,
GD_OP_SYNC_VOLUME,
GD_OP_LOG_FILENAME,
GD_OP_LOG_LOCATE,
@@ -237,6 +238,9 @@ glusterd_op_clear_ctx_free (glusterd_op_t op);
gf_boolean_t
glusterd_op_get_ctx_free (glusterd_op_t op);
+gf_boolean_t
+glusterd_check_option_exists(char *optstring);
+
int
set_xlator_option (dict_t *dict, char *key, char *value);
#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 30ba5141628..017ab687327 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -886,6 +886,8 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
"--brick-port %d -l %s", GFS_PREFIX, volinfo->volname,
port, volfile, pidfile, brickinfo->path, port,
brickinfo->logfile);
+
+ gf_log ("",GF_LOG_DEBUG,"Starting GlusterFS Command Executed: \n %s \n", cmd_str);
ret = gf_system (cmd_str);
if (ret == 0) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 3998a0190f1..28b814500d3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -468,13 +468,18 @@ __write_client_xlator (FILE *file, dict_t *dict,
char *opt_transtype = NULL;
char *opt_nodelay = NULL;
int ret = 0;
-
+ char *ping = NULL;
+ char *frame = NULL;
+ char ping_timeout[100] = {0, };
+ char frame_timeout[100] = {0, };
const char *client_str = "volume %s-%s-%d\n"
" type protocol/client\n"
" option transport-type %s\n"
" option remote-host %s\n"
" option transport.socket.nodelay %s\n"
+ "%s" //for frame-timeout
+ "%s" //for ping-timeout
" option remote-subvolume %s\n"
"end-volume\n\n";
@@ -495,6 +500,26 @@ __write_client_xlator (FILE *file, dict_t *dict,
goto out;
}
+ if (dict_get (dict, "frame-timeout")) {
+ ret = dict_get_str (dict, "frame-timeout", &frame);
+ if (ret) {
+ goto out;
+ }
+ gf_log ("", GF_LOG_DEBUG, "Reconfiguring frame-timeout %s",
+ frame);
+ sprintf(frame_timeout, " option frame-timeout %s\n",frame);
+ }
+
+ if (dict_get (dict, "ping-timeout")) {
+ ret = dict_get_str (dict, "ping-timeout", &ping);
+ if (ret) {
+ goto out;
+ }
+ gf_log ("", GF_LOG_DEBUG, "Reconfiguring ping-timeout %s",
+ ping);
+ sprintf(ping_timeout, " option ping-timeout %s\n",ping);
+ }
+
fprintf (file, client_str,
volname,
"client",
@@ -502,6 +527,8 @@ __write_client_xlator (FILE *file, dict_t *dict,
opt_transtype,
remote_host,
opt_nodelay,
+ frame_timeout,
+ ping_timeout,
remote_subvol);
ret = 0;
@@ -608,8 +635,14 @@ __write_iothreads_xlator (FILE *file, dict_t *dict,
goto out;
}
- ret = dict_get_str (dict, VOLGEN_IOT_OPTION_THREADCOUNT,
- &opt_threadcount);
+ if (dict_get (dict, "thread-count")) {
+ gf_log("", GF_LOG_DEBUG, "Resetting the thread-count value");
+ ret = dict_get_str (dict, "thread-count", &opt_threadcount);
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_IOT_OPTION_THREADCOUNT,
+ &opt_threadcount);
+
if (ret) {
goto out;
}
@@ -675,16 +708,19 @@ static int
__write_server_xlator (FILE *file, dict_t *dict,
char *subvolume)
{
- char *volname = NULL;
- char *opt_transtype = NULL;
- char *opt_nodelay = NULL;
- int ret = -1;
+ char *volname = NULL;
+ char *opt_transtype = NULL;
+ char *opt_nodelay = NULL;
+ int ret = -1;
+ char *lru_count = NULL;
+ char inode_lru_count[100] = {0,};
const char *server_str = "volume %s-%s\n"
" type protocol/server\n"
" option transport-type %s\n"
" option auth.addr.%s.allow *\n"
" option transport.socket.nodelay %s\n"
+ "%s"//for inode-lru-limit
" subvolumes %s\n"
"end-volume\n\n";
@@ -705,12 +741,25 @@ __write_server_xlator (FILE *file, dict_t *dict,
goto out;
}
+ if (dict_get (dict, "inode-lru-limit")) {
+ ret = dict_get_str (dict, "inode-lru-limit", &lru_count);
+ if (ret) {
+ goto out;
+ }
+ gf_log ("", GF_LOG_DEBUG, "Reconfiguring inode-lru-limit %s",
+ lru_count);
+ sprintf (inode_lru_count, " option inode-lru-limit %s\n",
+ lru_count);
+ }
+
fprintf (file, server_str,
volname, "server",
opt_transtype,
subvolume,
opt_nodelay,
- subvolume);
+ inode_lru_count,
+ subvolume
+ );
ret = 0;
@@ -747,7 +796,7 @@ __write_replicate_xlator (FILE *file, dict_t *dict,
int subvol_len = 0;
- const char *replicate_str = "volume %s-%s-%d\n"
+ char replicate_str[] = "volume %s-%s-%d\n"
" type cluster/replicate\n"
"# option read-subvolume %s\n"
"# option favorite-child %s\n"
@@ -771,7 +820,15 @@ __write_replicate_xlator (FILE *file, dict_t *dict,
goto out;
}
- ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_READSUBVOL,
+ if (dict_get (dict, "read-subvolume")) {
+ ret = dict_get_str (dict, "read-subvolume", &opt_readsubvol);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring read-subvolume: %s",
+ &opt_readsubvol);
+ uncomment_option (replicate_str,
+ (char *) "# option read-subvolume %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_READSUBVOL,
&opt_readsubvol);
if (ret) {
goto out;
@@ -783,14 +840,32 @@ __write_replicate_xlator (FILE *file, dict_t *dict,
goto out;
}
- ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_BCKSHCOUNT,
+ if (dict_get (dict, "background-self-heal-count")) {
+ ret = dict_get_str (dict,"background-self-heal-count",
+ &opt_bckshcount);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring background-self-heal-"
+ "count: %s", &opt_bckshcount);
+ uncomment_option (replicate_str,
+ (char *) "# option background-self-heal-count %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_BCKSHCOUNT,
&opt_bckshcount);
if (ret) {
goto out;
}
- ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_DATASH,
- &opt_datash);
+ if (dict_get (dict, "data-self-heal")) {
+ ret = dict_get_str (dict,"data-self-heal",
+ &opt_datash);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring data-self-heal"
+ "count: %s", &opt_datash);
+ uncomment_option (replicate_str,
+ (char *) "# option data-self-heal %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_DATASH,
+ &opt_datash);
if (ret) {
goto out;
}
@@ -801,43 +876,106 @@ __write_replicate_xlator (FILE *file, dict_t *dict,
goto out;
}
- ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_SHWINDOWSIZE,
+ if (dict_get (dict, "data-self-heal-window-size")) {
+ ret = dict_get_str (dict,"data-self-heal-window-size",
+ &opt_shwindowsize);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring data-self-heal"
+ "window-size: %s", &opt_shwindowsize);
+ uncomment_option (replicate_str,
+ (char *) "# option data-self-heal-window-size %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_SHWINDOWSIZE,
&opt_shwindowsize);
if (ret) {
goto out;
}
- ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_METASH,
+ if (dict_get (dict, "metadata-self-heal")) {
+ ret = dict_get_str (dict,"metadata-self-heal",
+ &opt_metash);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring metadata-self-heal"
+ "count: %s", &opt_metash);
+ uncomment_option (replicate_str,
+ (char *) "# option metadata-self-heal %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_METASH,
&opt_metash);
if (ret) {
goto out;
}
-
- ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_ENTRYSH,
+
+ if (dict_get (dict, "entry-self-heal")) {
+ ret = dict_get_str (dict,"entry-self-heal",
+ &opt_entrysh);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring entry-self-heal"
+ "count: %s", &opt_entrysh);
+ uncomment_option (replicate_str,
+ (char *) "# option entry-self-heal %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_ENTRYSH,
&opt_entrysh);
if (ret) {
goto out;
}
- ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_DATACHANGELOG,
+ if (dict_get (dict, "data-change-log")) {
+ ret = dict_get_str (dict,"data-change-log",
+ &opt_datachangelog);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring data-change-log"
+ "count: %s", &opt_datachangelog);
+ uncomment_option (replicate_str,
+ (char *) "# option data-change-log %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_DATACHANGELOG,
&opt_datachangelog);
if (ret) {
goto out;
}
- ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_METADATACHANGELOG,
+ if (dict_get (dict, "metadata-change-log")) {
+ ret = dict_get_str (dict,"metadata-change-log",
+ &opt_metadatachangelog);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring metadata-change-log"
+ "count: %s", &opt_metadatachangelog);
+ uncomment_option (replicate_str,
+ (char *) "# option metadata-change-log %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_METADATACHANGELOG,
&opt_metadatachangelog);
if (ret) {
goto out;
}
+ if (dict_get (dict, "entry-change-log")) {
+ ret = dict_get_str (dict, "entry-change-log", &opt_entrychangelog);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring entry-change-log: %s",
+ &opt_entrychangelog);
+ uncomment_option (replicate_str,
+ (char *) "# option entry-change-log %s\n");
+ }
+ else
+
ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_ENTRYCHANGELOG,
&opt_entrychangelog);
if (ret) {
goto out;
}
- ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_STRICTREADDIR,
+ if (dict_get (dict, "strict-readdir")) {
+ ret = dict_get_str (dict,"strict-readdir",
+ &opt_strictreaddir);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring sstrict-readdir"
+ "count: %s", &opt_strictreaddir);
+ uncomment_option (replicate_str,
+ (char *) "# option strict-readdir %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_REPLICATE_OPTION_STRICTREADDIR,
&opt_strictreaddir);
if (ret) {
goto out;
@@ -914,7 +1052,7 @@ __write_stripe_xlator (FILE *file, dict_t *dict,
int subvol_len = 0;
int len = 0;
- const char *stripe_str = "volume %s-%s-%d\n"
+ char stripe_str[] = "volume %s-%s-%d\n"
" type cluster/stripe\n"
"# option block-size %s\n"
"# option use-xattr %s\n"
@@ -928,7 +1066,15 @@ __write_stripe_xlator (FILE *file, dict_t *dict,
goto out;
}
- ret = dict_get_str (dict, VOLGEN_STRIPE_OPTION_BLOCKSIZE,
+ if (dict_get (dict, "block-size")) {
+ ret = dict_get_str (dict, "block-size", &opt_blocksize);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring Stripe Count %s",
+ opt_blocksize);
+ uncomment_option (stripe_str,
+ (char *) "# option block-size %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_STRIPE_OPTION_BLOCKSIZE,
&opt_blocksize);
if (ret) {
goto out;
@@ -999,7 +1145,7 @@ __write_distribute_xlator (FILE *file, dict_t *dict,
int subvol_len = 0;
int len = 0;
- const char *dht_str = "volume %s-%s\n"
+ char dht_str[] = "volume %s-%s\n"
"type cluster/distribute\n"
"# option lookup-unhashed %s\n"
"# option min-free-disk %s\n"
@@ -1012,12 +1158,28 @@ __write_distribute_xlator (FILE *file, dict_t *dict,
goto out;
}
- ret = dict_get_str (dict, VOLGEN_DHT_OPTION_LOOKUPUNHASH,
+ if (dict_get (dict, "lookup-unhashed")) {
+ ret = dict_get_str (dict, "lookup-unhashed", &opt_lookupunhash);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring lookup-unhashed %s",
+ opt_lookupunhash);
+ uncomment_option (dht_str,
+ (char *) "# option lookup-unhashed %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_DHT_OPTION_LOOKUPUNHASH,
&opt_lookupunhash);
if (ret) {
goto out;
}
+ if (dict_get (dict, "min-free-disk")) {
+ ret = dict_get_str (dict, "min-free-disk", &opt_minfreedisk);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring min-free-disk",
+ opt_minfreedisk);
+ uncomment_option (dht_str,
+ (char *) "# option min-free-disk %s\n");
+ }
+ else
ret = dict_get_str (dict, VOLGEN_DHT_OPTION_MINFREEDISK,
&opt_minfreedisk);
if (ret) {
@@ -1067,6 +1229,24 @@ out:
return ret;
}
+
+int
+uncomment_option( char *opt_str,char *comment_str)
+{
+ char *ptr;
+
+ ptr = strstr (opt_str,comment_str);
+ if (!ptr)
+ return -1;
+
+ if (*ptr != '#')
+ return -1;
+
+ *ptr = ' ';
+
+ return 0;
+}
+
static int
__write_wb_xlator (FILE *file, dict_t *dict,
char *subvolume)
@@ -1079,7 +1259,7 @@ __write_wb_xlator (FILE *file, dict_t *dict,
char *opt_tricklingwrites = NULL;
int ret = -1;
- const char *dht_str = "volume %s-%s\n"
+ char dht_str[] = "volume %s-%s\n"
" type performance/write-behind\n"
"# option flush-behind %s\n"
"# option cache-size %s\n"
@@ -1100,7 +1280,13 @@ __write_wb_xlator (FILE *file, dict_t *dict,
goto out;
}
- ret = dict_get_str (dict, VOLGEN_WB_OPTION_CACHESIZE,
+ if (dict_get (dict, "cache-size")) {
+ gf_log("",GF_LOG_DEBUG, "Uncommenting option cache-size");
+ uncomment_option (dht_str,(char *) "# option cache-size %s\n");
+ ret = dict_get_str (dict, "cache-size", &opt_cachesize);
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_WB_OPTION_CACHESIZE,
&opt_cachesize);
if (ret) {
goto out;
@@ -1200,7 +1386,7 @@ __write_iocache_xlator (FILE *file, dict_t *dict,
char *opt_maxfilesize = NULL;
int ret = -1;
- const char *iocache_str = "volume %s-%s\n"
+ char iocache_str[] = "volume %s-%s\n"
" type performance/io-cache\n"
"# option priority %s\n"
"# option cache-timeout %s\n"
@@ -1215,31 +1401,71 @@ __write_iocache_xlator (FILE *file, dict_t *dict,
goto out;
}
- ret = dict_get_str (dict, VOLGEN_IOCACHE_OPTION_PRIORITY,
+ if (dict_get (dict, "priority")) {
+ ret = dict_get_str (dict, "priority", &opt_priority);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring priority",
+ opt_priority);
+ uncomment_option (iocache_str,
+ (char *) "# option priority %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_IOCACHE_OPTION_PRIORITY,
&opt_priority);
if (ret) {
goto out;
}
- ret = dict_get_str (dict, VOLGEN_IOCACHE_OPTION_TIMEOUT,
+ if (dict_get (dict, "cache-timeout")) {
+ ret = dict_get_str (dict, "cache-timeout", &opt_timeout);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring cache-timeout",
+ opt_timeout);
+ uncomment_option (iocache_str,
+ (char *) "# option cache-timeout %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_IOCACHE_OPTION_TIMEOUT,
&opt_timeout);
if (ret) {
goto out;
}
- ret = dict_get_str (dict, VOLGEN_IOCACHE_OPTION_CACHESIZE,
+ if (dict_get (dict, "cache-size")) {
+ ret = dict_get_str (dict, "cache-size", &opt_cachesize);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring cache-size :%s",
+ opt_cachesize);
+ uncomment_option (iocache_str,
+ (char *) "# option cache-size %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_IOCACHE_OPTION_CACHESIZE,
&opt_cachesize);
if (ret) {
goto out;
}
- ret = dict_get_str (dict, VOLGEN_IOCACHE_OPTION_MINFILESIZE,
+ if (dict_get (dict, "min-file-size")) {
+ ret = dict_get_str (dict, "min-file-size", &opt_minfilesize);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring min-file-size: %s",
+ opt_minfilesize);
+ uncomment_option (iocache_str,
+ (char *) "# option min-file-size %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_IOCACHE_OPTION_MINFILESIZE,
&opt_minfilesize);
if (ret) {
goto out;
}
- ret = dict_get_str (dict, VOLGEN_IOCACHE_OPTION_MAXFILESIZE,
+ if (dict_get (dict, "max-file-size")) {
+ ret = dict_get_str (dict, "max-file-size", &opt_maxfilesize);
+ gf_log("", GF_LOG_DEBUG, "Reconfiguring max-file-size: %s",
+ opt_maxfilesize);
+ uncomment_option (iocache_str,
+ (char *) "# option max-file-size %s\n");
+ }
+ else
+ ret = dict_get_str (dict, VOLGEN_IOCACHE_OPTION_MAXFILESIZE,
&opt_maxfilesize);
if (ret) {
goto out;
@@ -2016,6 +2242,8 @@ glusterd_create_volfiles (glusterd_volinfo_t *volinfo)
{
int ret = -1;
+ gf_log ("", GF_LOG_DEBUG, "Inside Create Volfiles");
+
if(volinfo->transport_type == GF_TRANSPORT_RDMA) {
ret = set_xlator_option (volinfo->dict, VOLGEN_CLIENT_OPTION_TRANSTYPE,
"rdma");
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h
index bee57264690..a93bac6751a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.h
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h
@@ -141,4 +141,7 @@ glusterd_get_nfs_filepath ();
int
volgen_generate_nfs_volfile (glusterd_volinfo_t *volinfo);
+
+int
+uncomment_option( char *opt_str,char *comment_str);
#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 947f1c23af9..cfa22930136 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -373,6 +373,12 @@ glusterd_log_rotate (rpcsvc_request_t *req, dict_t *dict);
int32_t
glusterd_remove_brick (rpcsvc_request_t *req, dict_t *dict);
+int32_t
+glusterd_set_volume (rpcsvc_request_t *req, dict_t *dict);
+
+int
+glusterd_handle_set_volume (rpcsvc_request_t *req);
+
int
glusterd_xfer_cli_deprobe_resp (rpcsvc_request_t *req, int32_t op_ret,
int32_t op_errno, char *hostname);
diff --git a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
index 5f0ab79ca1a..244b71009e7 100644
--- a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
+++ b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
@@ -1335,7 +1335,13 @@ glusterd_handle_rpc_msg (rpcsvc_request_t *req)
ret = glusterd_handle_log_rotate (req);
break;
+ case GD_MGMT_CLI_SET_VOLUME:
+ ret = glusterd_handle_set_volume (req);
+ break;
+
default:
+ gf_log("", GF_LOG_ERROR, "Recieved Invalid procnum:%d",
+ req->procnum);
GF_ASSERT (0);
}
@@ -1386,6 +1392,8 @@ rpcsvc_actor_t glusterd1_mgmt_actors[] = {
[GD_MGMT_CLI_LOG_FILENAME] = { "LOG FILENAME", GD_MGMT_CLI_LOG_FILENAME, glusterd_handle_rpc_msg, NULL, NULL},
[GD_MGMT_CLI_LOG_LOCATE] = { "LOG LOCATE", GD_MGMT_CLI_LOG_LOCATE, glusterd_handle_log_locate, NULL, NULL},
[GD_MGMT_CLI_LOG_ROTATE] = { "LOG FILENAME", GD_MGMT_CLI_LOG_ROTATE, glusterd_handle_rpc_msg, NULL, NULL},
+ [GD_MGMT_CLI_SET_VOLUME] = { "SET_VOLUME", GD_MGMT_CLI_SET_VOLUME, glusterd_handle_rpc_msg, NULL, NULL},
+
};
/*rpcsvc_actor_t glusterd1_mgmt_actors[] = {
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 490d3168836..296edf23303 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -1470,6 +1470,165 @@ mem_acct_init (xlator_t *this)
return ret;
}
+int
+reconfigure (xlator_t *this, dict_t *options)
+{
+ ioc_table_t *table = NULL;
+ int32_t cache_timeout;
+ int64_t min_file_size = 0;
+ int64_t max_file_size = 0;
+ char *tmp = NULL;
+ uint64_t cache_size;
+ char *cache_size_string = NULL;
+ int ret = 0;
+
+ table = this->private;
+
+ ioc_table_lock (table);
+ {
+ if (dict_get (options, "cache-timeout")) {
+ cache_timeout =
+ data_to_uint32 (dict_get (options,
+ "cache-timeout"));
+ if (cache_timeout < 0){
+ gf_log (this->name, GF_LOG_WARNING,
+ "cache-timeout %d seconds invalid,"
+ " has to be >=0", cache_timeout);
+ ret = -1;
+ goto out;
+ }
+
+
+ if (cache_timeout > 60){
+ gf_log (this->name, GF_LOG_WARNING,
+ "cache-timeout %d seconds invalid,"
+ " has to be <=60", cache_timeout);
+ ret = -1;
+ goto out;
+ }
+
+ table->cache_timeout = cache_timeout;
+
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring %d seconds to"
+ " revalidate cache", table->cache_timeout);
+ }
+
+
+ if (dict_get (options, "cache-size"))
+ cache_size_string = data_to_str (dict_get (options,
+ "cache-size"));
+ if (cache_size_string) {
+ if (gf_string2bytesize (cache_size_string,
+ &cache_size) != 0) {
+ gf_log ("io-cache", GF_LOG_ERROR,
+ "invalid number format \"%s\" of "
+ "\"option cache-size\" Defaulting"
+ "to old value", cache_size_string);
+ ret = -1;
+ goto out;
+ }
+
+ if (cache_size < (4*(2^20))) {
+ gf_log(this->name, GF_LOG_ERROR, "Reconfiguration"
+ "'option cache-size %s' failed , Max value"
+ "can be 4MiB, Defaulting to old value (%d)"
+ , cache_size_string, table->cache_size);
+ ret = -1;
+ goto out;
+ }
+
+ if (cache_size > (6 *(2^30))) {
+ gf_log(this->name, GF_LOG_ERROR, "Reconfiguration"
+ "'option cache-size %s' failed , Max value"
+ "can be 6GiB, Defaulting to old value (%d)"
+ , cache_size_string, table->cache_size);
+ ret = -1;
+ goto out;
+ }
+
+
+ gf_log (this->name, GF_LOG_DEBUG, "Reconfiguring "
+ " cache-size %"PRIu64"", table->cache_size);
+ table->cache_size = cache_size;
+ }
+
+
+ if (dict_get (options, "priority")) {
+ char *option_list = data_to_str (dict_get (options,
+ "priority"));
+ gf_log (this->name, GF_LOG_TRACE,
+ "option path %s", option_list);
+ /* parse the list of pattern:priority */
+ table->max_pri = ioc_get_priority_list (option_list,
+ &table->priority_list);
+
+ if (table->max_pri == -1) {
+ ret = -1;
+ goto out;
+ }
+ table->max_pri ++;
+ }
+
+
+
+ min_file_size = table->min_file_size;
+ tmp = data_to_str (dict_get (options, "min-file-size"));
+ if (tmp != NULL) {
+ if (gf_string2bytesize (tmp,
+ (uint64_t *)&min_file_size)
+ != 0) {
+ gf_log ("io-cache", GF_LOG_ERROR,
+ "invalid number format \"%s\" of "
+ "\"option min-file-size\"", tmp);
+ ret = -1;
+ goto out;
+ }
+
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring min-file-size %"PRIu64"",
+ table->min_file_size);
+ }
+
+ max_file_size = table->max_file_size;
+ tmp = data_to_str (dict_get (options, "max-file-size"));
+ if (tmp != NULL) {
+ if (gf_string2bytesize (tmp,
+ (uint64_t *)&max_file_size)
+ != 0) {
+ gf_log ("io-cache", GF_LOG_ERROR,
+ "invalid number format \"%s\" of "
+ "\"option max-file-size\"", tmp);
+ ret = -1;
+ goto out;
+ }
+
+
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring max-file-size %"PRIu64"",
+ table->max_file_size);
+ }
+
+ if ((max_file_size >= 0) & (min_file_size > max_file_size)) {
+ gf_log ("io-cache", GF_LOG_ERROR, "minimum size (%"
+ PRIu64") of a file that can be cached is "
+ "greater than maximum size (%"PRIu64"). "
+ "Hence Defaulting to old value",
+ table->min_file_size, table->max_file_size);
+ ret = -1;
+ goto out;
+ }
+
+ table->min_file_size = min_file_size;
+ table->max_file_size = max_file_size;
+ }
+
+ ioc_table_unlock (table);
+out:
+ return ret;
+
+}
+
/*
* init -
* @this:
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index e31bd4bba20..0fe034a3f39 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -2079,10 +2079,51 @@ mem_acct_init (xlator_t *this)
return ret;
}
+
+
return ret;
}
int
+reconfigure ( xlator_t *this, dict_t *options)
+{
+ iot_conf_t *conf = NULL;
+ int ret = 0;
+ int thread_count;
+
+
+ if (dict_get (options, "thread-count")) {
+ thread_count = data_to_int32 (dict_get (options,
+ "thread-count"));
+
+ if (thread_count < IOT_MIN_THREADS) {
+ gf_log ("io-threads", GF_LOG_WARNING,
+ "Number of threads opted is less then min rest"
+ "oring it to previous value",conf->max_count);
+ ret = -1;
+ goto out;
+ }
+
+ if (thread_count > IOT_MAX_THREADS) {
+ gf_log ("io-threads", GF_LOG_WARNING,
+ "Number of threads opted is greater than max "
+ "restoring it to previous value",conf->max_count);
+ ret = -1;
+ goto out;
+ }
+
+ conf->max_count = thread_count;
+ }
+
+ ret = 0;
+
+out:
+ return ret;
+
+
+}
+
+int
init (xlator_t *this)
{
iot_conf_t *conf = NULL;
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index c9fc25a5b57..efb78acf771 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -2727,6 +2727,57 @@ mem_acct_init (xlator_t *this)
return ret;
}
+int
+reconfigure (xlator_t *this, dict_t *options)
+{
+ char *str=NULL;
+ uint64_t window_size;
+ wb_conf_t *conf = NULL;
+ int ret = 0;
+
+ conf = this->private;
+
+ ret = dict_get_str (options, "cache-size",
+ &str);
+ if (ret == 0) {
+ ret = gf_string2bytesize (str, &window_size);
+ if (ret != 0) {
+ gf_log(this->name, GF_LOG_ERROR, "Reconfiguration"
+ "'option cache-size %s failed , Invalid"
+ " number format, Defaulting to old value (%d)"
+ , str, conf->window_size);
+ ret = -1;
+ goto out;
+ }
+
+ if (window_size < (2^19)) {
+ gf_log(this->name, GF_LOG_ERROR, "Reconfiguration"
+ "'option cache-size %s' failed , Max value"
+ "can be 512KiB, Defaulting to old value (%d)"
+ , str, conf->window_size);
+ ret = -1;
+ goto out;
+ }
+
+ if (window_size > (2^30)) {
+ gf_log(this->name, GF_LOG_ERROR, "Reconfiguration"
+ "'option cache-size %s' failed , Max value"
+ "can be 1 GiB, Defaulting to old value (%d)"
+ , str, conf->window_size);
+ ret = -1;
+ goto out;
+ }
+
+ conf->window_size = window_size;
+ gf_log(this->name, GF_LOG_DEBUG, "Reconfiguring "
+ "'option cache-size %s ' to %d"
+ , str, conf->window_size);
+ }
+out:
+ return 0;
+
+}
+
int32_t
init (xlator_t *this)
{
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;