summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c41
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.h4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c23
3 files changed, 42 insertions, 26 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index e14e3133679..f65ad94ace6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -2548,16 +2548,15 @@ debugxl_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme,
return 0;
if (!strcmp (vme->key , "debug.trace") ||
- !strcmp (vme->key, "debug.error-gen")) {
+ !strcmp (vme->key, "debug.error-gen") ||
+ !strcmp (vme->key, "debug.delay-gen")) {
if (get_server_xlator (vme->value) == GF_XLATOR_NONE &&
get_client_xlator (vme->value) == GF_CLNT_XLATOR_NONE)
return 0;
- else
- goto add_graph;
}
if (gf_string2boolean (vme->value, &enabled) == -1)
- return -1;
+ goto add_graph;
if (!enabled)
return 0;
@@ -2574,34 +2573,28 @@ int
check_and_add_debug_xl (volgen_graph_t *graph, dict_t *set_dict, char *volname,
char *xlname)
{
+ int i = 0;
int ret = 0;
char *value_str = NULL;
+ static char *xls[] = {"debug.trace", "debug.error-gen",
+ "debug.delay-gen", NULL};
if (!xlname)
goto out;
- ret = dict_get_str (set_dict, "debug.trace", &value_str);
- if (!ret) {
- if (strcmp (xlname, value_str) == 0) {
- ret = volgen_graph_set_options_generic (graph,
- set_dict, volname,
- &debugxl_option_handler);
- if (ret)
- goto out;
- }
- }
-
- ret = dict_get_str (set_dict, "debug.error-gen", &value_str);
- if (!ret) {
- if (strcmp (xlname, value_str) == 0) {
- ret = volgen_graph_set_options_generic (graph,
- set_dict, volname,
- &debugxl_option_handler);
- if (ret)
- goto out;
+ while (xls[i]) {
+ ret = dict_get_str (set_dict, xls[i], &value_str);
+ if (!ret) {
+ if (strcmp (xlname, value_str) == 0) {
+ ret = volgen_graph_set_options_generic (graph,
+ set_dict, volname,
+ &debugxl_option_handler);
+ if (ret)
+ goto out;
+ }
}
+ i++;
}
-
ret = 0;
out:
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h
index 6c79c776436..aa4359c2589 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.h
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h
@@ -163,8 +163,8 @@ struct volgen_brick_xlator {
/* function that builds a xlator */
brick_xlator_builder builder;
/* debug key for a xlator that
- * gets used for adding debug translators like trace, error-gen
- * before this xlator */
+ * gets used for adding debug translators like trace, error-gen,
+ * delay-gen before this xlator */
char *dbg_key;
};
typedef struct volgen_brick_xlator volgen_brick_xlator_t;
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 3dcfafb4a3e..2c4dc413b0d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -3526,6 +3526,29 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.op_version = GD_OP_VERSION_3_12_0,
.validate_fn = validate_boolean
},
+ { .key = "debug.delay-gen",
+ .voltype = "debug/delay-gen",
+ .option = "!debug",
+ .value = "off",
+ .type = NO_DOC,
+ .op_version = GD_OP_VERSION_4_0_0,
+ .flags = VOLOPT_FLAG_XLATOR_OPT
+ },
+ { .key = "delay-gen.delay-percentage",
+ .voltype = "debug/delay-gen",
+ .type = NO_DOC,
+ .op_version = GD_OP_VERSION_4_0_0,
+ },
+ { .key = "delay-gen.delay-duration",
+ .voltype = "debug/delay-gen",
+ .type = NO_DOC,
+ .op_version = GD_OP_VERSION_4_0_0,
+ },
+ { .key = "delay-gen.enable",
+ .voltype = "debug/delay-gen",
+ .type = NO_DOC,
+ .op_version = GD_OP_VERSION_4_0_0,
+ },
{ .key = NULL
}
};