summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2012-02-20 14:34:39 +0530
committerVijay Bellur <vijay@gluster.com>2012-02-20 02:07:16 -0800
commit4d1b040f00e7ec8de997d151b35fa035bba9cb25 (patch)
treea194e77d4a76a32d47117cebd8308b74a0b70d89
parent6827f56dfcde4546e5adb3af65e7f21bef7fd58a (diff)
volgen: give an option to insert trace/error-gen
currently, these translators can be plugged in on the server volfile. Need to enhance on client side too. Change-Id: I8c3696f62f1de646a736d68c4c427c6fffd6bbf4 Signed-off-by: Amar Tumballi <amar@gluster.com> BUG: 782262 Reviewed-on: http://review.gluster.com/776 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c71
1 files changed, 65 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 919994b1572..923271f0a2e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -174,6 +174,8 @@ static struct volopt_map_entry glusterd_volopt_map[] = {
{"performance.client-io-threads", "performance/io-threads", "!perf", "off", NO_DOC, 0},
{VKEY_MARKER_XTIME, "features/marker", "xtime", "off", NO_DOC, OPT_FLAG_FORCE},
{VKEY_MARKER_XTIME, "features/marker", "!xtime", "off", NO_DOC, OPT_FLAG_FORCE},
+ {"debug.trace", "debug/trace", "!debug","off", NO_DOC, 0},
+ {"debug.error-gen", "debug/error-gen", "!debug","off", NO_DOC, 0},
{"nfs.enable-ino32", "nfs/server", "nfs.enable-ino32", NULL, GLOBAL_DOC, 0},
{"nfs.mem-factor", "nfs/server", "nfs.mem-factor", NULL, GLOBAL_DOC, 0},
@@ -751,6 +753,42 @@ optget_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme,
return 0;
}
+int
+check_and_add_debug_xl (volgen_graph_t *graph, dict_t *set_dict, char *volname,
+ char *xlname)
+{
+ int ret = 0;
+ xlator_t *xl = NULL;
+ char *value_str = NULL;
+
+ ret = dict_get_str (set_dict, "debug.trace", &value_str);
+ if (!ret) {
+ if (strcmp (xlname, value_str) == 0) {
+ xl = volgen_graph_add (graph, "debug/trace", volname);
+ if (!xl) {
+ ret = -1;
+ goto out;
+ }
+ }
+ }
+
+ ret = dict_get_str (set_dict, "debug.error-gen", &value_str);
+ if (!ret) {
+ if (strcmp (xlname, value_str) == 0) {
+ xl = volgen_graph_add (graph, "debug/error-gen", volname);
+ if (!xl) {
+ ret = -1;
+ goto out;
+ }
+ }
+ }
+
+ ret = 0;
+
+out:
+ return ret;
+}
+
/* This getter considers defaults also. */
static int
volgen_dict_get (dict_t *dict, char *key, char **value)
@@ -1542,18 +1580,34 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (ret)
return -1;
+ ret = check_and_add_debug_xl (graph, set_dict, volname, "posix");
+ if (ret)
+ return -1;
+
xl = volgen_graph_add (graph, "features/access-control", volname);
if (!xl)
return -1;
+ ret = check_and_add_debug_xl (graph, set_dict, volname, "acl");
+ if (ret)
+ return -1;
+
xl = volgen_graph_add (graph, "features/locks", volname);
if (!xl)
return -1;
+ ret = check_and_add_debug_xl (graph, set_dict, volname, "locks");
+ if (ret)
+ return -1;
+
xl = volgen_graph_add (graph, "performance/io-threads", volname);
if (!xl)
return -1;
+ ret = check_and_add_debug_xl (graph, set_dict, volname, "io-threads");
+ if (ret)
+ return -1;
+
ret = dict_get_int32 (volinfo->dict, "enable-pump", &pump);
if (ret == -ENOENT)
ret = pump = 0;
@@ -1601,6 +1655,7 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
xl = volgen_graph_add (graph, "features/marker", volname);
if (!xl)
return -1;
+
uuid_unparse (volinfo->volume_id, volume_id);
ret = xlator_set_option (xl, "volume-uuid", volume_id);
if (ret)
@@ -1610,6 +1665,10 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (ret)
return -1;
+ ret = check_and_add_debug_xl (graph, set_dict, volname, "marker");
+ if (ret)
+ return -1;
+
xl = volgen_graph_add_as (graph, "debug/io-stats", path);
if (!xl)
return -1;
@@ -2081,6 +2140,7 @@ volgen_graph_build_clusters (volgen_graph_t *graph,
if (trav == txl)
break;
+
i++;
}
@@ -3247,8 +3307,8 @@ glusterd_validate_brickreconf (glusterd_volinfo_t *volinfo,
}
ret = 0;
-out:
+out:
return ret;
}
@@ -3292,10 +3352,9 @@ glusterd_validate_globalopts (glusterd_volinfo_t *volinfo,
ret = validate_nfsopts (volinfo, val_dict, op_errstr);
-
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
- return ret;
+ gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ return ret;
}
static void
@@ -3340,6 +3399,6 @@ glusterd_validate_reconfopts (glusterd_volinfo_t *volinfo, dict_t *val_dict,
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
- return ret;
+ gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ return ret;
}