summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2010-10-08 09:52:52 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-09 06:37:05 -0700
commitafb6997fe74af257c7e687e33fe88a292f7a4a00 (patch)
tree90cc2ced17d863360137d055d281d93b1dadb888 /xlators
parentd1f938c16e309431382ab9aaa32d50bf0ccd3260 (diff)
io-stats, volgen: make the distinction between client and brick loglevel in volgen's scope
Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1789 (add log-level options to volume set) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1789
Diffstat (limited to 'xlators')
-rw-r--r--xlators/debug/io-stats/src/io-stats.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c41
2 files changed, 38 insertions, 12 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 2061d9bc9b1..c72545bd387 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -1586,11 +1586,7 @@ reconfigure (xlator_t *this, dict_t *options)
if (!ctx)
return -1;
- if (ctx->cmd_args.brick_name)
- ret = dict_get_str (options, "log-level", &log_str);
- else
- ret = dict_get_str (options, "client-log-level", &log_str);
-
+ ret = dict_get_str (options, "log-level", &log_str);
if (!ret) {
if (!is_gf_log_command(this, "trusted.glusterfs*set-log-level", log_str)) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -1762,8 +1758,5 @@ struct volume_options options[] = {
{ .key = {"log-level"},
.type = GF_OPTION_TYPE_STR,
},
- { .key = {"client-log-level"},
- .type = GF_OPTION_TYPE_STR,
- },
{ .key = {NULL} },
};
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index cfd7a7396a9..93e276dc9fb 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -101,8 +101,8 @@ static struct volopt_map_entry glusterd_volopt_map[] = {
{"diagnostics.latency-measurement", "debug/io-stats", },
{"diagnostics.dump-fd-stats", "debug/io-stats", },
- {"diagnostics.brick-log-level", "debug/io-stats", "log-level",},
- {"diagnostics.client-log-level", "debug/io-stats", },
+ {"diagnostics.brick-log-level", "debug/io-stats", "!log-level",},
+ {"diagnostics.client-log-level", "debug/io-stats", "!log-level",},
{"performance.cache-max-file-size", "performance/io-cache", "max-file-size",},
{"performance.cache-min-file-size", "performance/io-cache", "min-file-size",},
@@ -727,6 +727,36 @@ server_auth_option_handler (glusterfs_graph_t *graph,
}
static int
+loglevel_option_handler (glusterfs_graph_t *graph,
+ struct volopt_map_entry *vme, void *param)
+{
+ char *role = param;
+ struct volopt_map_entry vme2 = {0,};
+
+ if (strcmp (vme->option, "!log-level") != 0 ||
+ !strstr (vme->key, role))
+ return 0;
+
+ memcpy (&vme2, vme, sizeof (vme2));
+ vme2.option = "log-level";
+
+ return basic_option_handler (graph, &vme2, NULL);
+}
+
+static int
+server_spec_option_handler (glusterfs_graph_t *graph,
+ struct volopt_map_entry *vme, void *param)
+{
+ int ret = 0;
+
+ ret = server_auth_option_handler (graph, vme, NULL);
+ if (!ret)
+ ret = loglevel_option_handler (graph, vme, "brick");
+
+ return ret;
+}
+
+static int
server_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo,
dict_t *set_dict, void *param)
{
@@ -809,7 +839,7 @@ server_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo,
return -1;
ret = volgen_graph_set_options_generic (graph, set_dict, NULL,
- &server_auth_option_handler);
+ &server_spec_option_handler);
return ret;
}
@@ -999,7 +1029,10 @@ client_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo,
if (!xl)
return -1;
- return 0;
+ ret = volgen_graph_set_options_generic (graph, set_dict, "client",
+ &loglevel_option_handler);
+
+ return ret;
}