From c7b518ab85f6fbcbdbae64c8fa092e998a14d1e9 Mon Sep 17 00:00:00 2001 From: Kaushik BV Date: Thu, 7 Oct 2010 06:37:12 +0000 Subject: mgmt/Glusterd: Volume set enhancements - performance.flush-behind, transport.keepalive added - volume info to display the options reconfigured Signed-off-by: Kaushik BV Signed-off-by: Vijay Bellur BUG: 1159 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159 --- xlators/mgmt/glusterd/src/glusterd-handler.c | 37 ++++++++++++++++++++++++++++ xlators/mgmt/glusterd/src/glusterd-op-sm.c | 8 +++--- xlators/mgmt/glusterd/src/glusterd-volgen.c | 3 +++ 3 files changed, 44 insertions(+), 4 deletions(-) (limited to 'xlators/mgmt/glusterd/src') diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 448dd6534..57239c626 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -254,6 +254,7 @@ out: return ret; } + int glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo, dict_t *volumes, int count) @@ -264,6 +265,11 @@ glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *brickinfo = NULL; char *buf = NULL; int i = 1; + data_pair_t *pairs = NULL; + char reconfig_key[256] = {0, }; + dict_t *dict = NULL; + data_t *value = NULL; + GF_ASSERT (volinfo); GF_ASSERT (volumes); @@ -309,6 +315,37 @@ glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo, goto out; i++; } + + dict = volinfo->dict; + if (!dict) { + ret = -1; + goto out; + } + + pairs = dict->members_list; + if (!pairs) { + ret = -1; + goto out; + } + + while (pairs) { + if (1 == glusterd_check_option_exists (pairs->key, NULL)) { + value = pairs->value; + if (!value) { + ret = -1; + goto out; + } + snprintf (reconfig_key, 256, "volume%d.option.%s", count, + pairs->key); + gf_log ("", GF_LOG_DEBUG, + "Setting dict with key=%s, value=%s", + reconfig_key, pairs->value->data); + ret = dict_set_str (volumes, gf_strdup (reconfig_key), + value->data); + } + pairs = pairs->next; + } + out: return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index d867497cc..4ae7afcc3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -1087,10 +1087,10 @@ out: static int glusterd_op_stage_set_volume (gd1_mgmt_stage_op_req *req, char **op_errstr) { - int ret = 0; - dict_t *dict = NULL; - char *volname = NULL; - gf_boolean_t exists = _gf_false; + int ret = 0; + dict_t *dict = NULL; + char *volname = NULL; + int exists = 0; char *key = NULL; char *value = NULL; char str[100] = {0, }; diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 9d3ceaf56..cfd7a7396 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -110,6 +110,7 @@ static struct volopt_map_entry glusterd_volopt_map[] = { {"performance.cache-priority", "performance/io-cache", "priority",}, /* NODOC */ {"performance.cache-size", "performance/io-cache", }, {"performance.cache-size", "performance/quick-read", }, + {"performance.flush-behind", "performance/write-behind", "flush-behind",}, {"performance.io-thread-count", "performance/io-threads", "thread-count",}, @@ -124,6 +125,8 @@ static struct volopt_map_entry glusterd_volopt_map[] = { {"auth.allow", "protocol/server", "!server-auth", "*"}, {"auth.reject", "protocol/server", "!server-auth",}, + + {"transport.keepalive", "protocol/server", "transport.socket.keepalive",}, {"performance.write-behind", "performance/write-behind", "!perf", "on"}, /* NODOC */ {"performance.read-ahead", "performance/read-ahead", "!perf", "on"}, /* NODOC */ -- cgit