summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorRajesh Amaravathi <rajesh.amaravathi@gmail.com>2011-09-12 17:29:47 +0530
committerVijay Bellur <vijay@gluster.com>2011-09-19 05:39:13 -0700
commitb23d329608163ee2aa1aa89b907a5a6e50291464 (patch)
tree412bb8a00f5b7c4a7dda8f740855dfeefe6b780d /xlators/mgmt/glusterd/src/glusterd-utils.c
parent8ad4d3f53000724389db6003ca6d6d777b880017 (diff)
glusterd: provide a option to start processes with valgrind
By enabling the brick-with-valgrind option in glusterd, one can automatically start all bricks with valgrind monitoring them. Change-Id: Ib0a97a83c4461c0878454e96bc84462f6cad6bc8 BUG: 3461 Reviewed-on: http://review.gluster.com/311 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c28
1 files changed, 25 insertions, 3 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 {