summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c28
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c25
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h3
3 files changed, 50 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 6393f1fca20..5963bb712bc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1057,7 +1057,9 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
FILE *file = NULL;
gf_boolean_t is_locked = _gf_false;
char socketpath[PATH_MAX] = {0};
-
+#ifdef DEBUG
+ char valgrind_logfile[PATH_MAX] = {0};
+#endif
GF_ASSERT (volinfo);
GF_ASSERT (brickinfo);
@@ -1138,12 +1140,32 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
port = pmap_registry_alloc (THIS);
runinit (&runner);
- runner_add_args (&runner, GFS_PREFIX"/sbin/glusterfsd",
+
+#ifdef DEBUG
+ if (priv->valgrind) {
+ if (volinfo->logdir) {
+ snprintf (valgrind_logfile, PATH_MAX,
+ "%s/valgrind-%s-%s.log", volinfo->logdir,
+ volinfo->volname, exp_path);
+ } else {
+ snprintf (valgrind_logfile, PATH_MAX,
+ "%s/bricks/valgrnd-%s-%s.log",
+ DEFAULT_LOG_FILE_DIRECTORY,
+ volinfo->volname, exp_path);
+ }
+ /* Run bricks with valgrind */
+ runner_add_args (&runner, "valgrind", "--leak-check=full",
+ "--trace-children=yes", NULL);
+ runner_argprintf (&runner, "--log-file=%s", valgrind_logfile);
+ }
+#endif
+ runner_add_args (&runner, GFS_PREFIX"/sbin/glusterfsd",
"-s", "localhost", "--volfile-id", volfile,
"-p", pidfile, "-S", socketpath,
"--brick-name", brickinfo->path,
- "-l", brickinfo->logfile, "--brick-port", NULL);
+ "-l", brickinfo->logfile, NULL);
+ runner_add_arg (&runner, "--brick-port");
if (volinfo->transport_type != GF_TRANSPORT_BOTH_TCP_RDMA) {
runner_argprintf (&runner, "%d", port);
} else {
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index b9e09254ba8..40dc2616d7e 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -762,6 +762,9 @@ init (xlator_t *this)
int first_time = 0;
char *mountbroker_root = NULL;
+#ifdef DEBUG
+ char *valgrind_str = NULL;
+#endif
dir_data = dict_get (this->options, "working-directory");
if (!dir_data) {
@@ -943,8 +946,23 @@ init (xlator_t *this)
if (ret)
goto out;
+ /* Set option to run bricks on valgrind if enabled in glusterd.vol */
+#ifdef DEBUG
+ conf->valgrind = _gf_false;
+ ret = dict_get_str (this->options, "brick-with-valgrind", &valgrind_str);
+ if (ret < 0) {
+ gf_log (THIS->name, GF_LOG_ERROR,
+ "cannot get brick-with-valgrind value");
+ }
+ if (valgrind_str) {
+ if (gf_string2boolean (valgrind_str, &(conf->valgrind))) {
+ gf_log (THIS->name, GF_LOG_WARNING,
+ "brick-with-valgrind value not a boolean string");
+ }
+ }
+#endif
this->private = conf;
- //this->ctx->top = this;
+ /* this->ctx->top = this;*/
ret = glusterd_uuid_init (first_time);
if (ret < 0)
@@ -1090,11 +1108,9 @@ struct volume_options options[] = {
{ .key = {"downgrade"},
.type = GF_OPTION_TYPE_BOOL,
},
-
{ .key = {"bind-insecure"},
.type = GF_OPTION_TYPE_BOOL,
},
-
{ .key = {"mountbroker-root"},
.type = GF_OPTION_TYPE_PATH,
},
@@ -1110,5 +1126,8 @@ struct volume_options options[] = {
{ .key = {GEOREP"-log-group"},
.type = GF_OPTION_TYPE_ANY,
},
+ { .key = {"brick-with-valgrind"},
+ .type = GF_OPTION_TYPE_BOOL,
+ },
{ .key = {NULL} },
};
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 45890a5d8b7..ab521af0f4b 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -112,6 +112,9 @@ typedef struct {
glusterd_sm_tr_log_t op_sm_log;
struct rpc_clnt_program *gfs_mgmt;
struct list_head mount_specs;
+#ifdef DEBUG
+ gf_boolean_t valgrind;
+#endif
} glusterd_conf_t;
typedef enum gf_brick_status {