Keep the base directory of a relay session separate
authorJulien Desfossez <jdesfossez@efficios.com>
Mon, 11 Dec 2017 19:16:06 +0000 (14:16 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 28 Feb 2018 22:11:17 +0000 (17:11 -0500)
For the session rotation feature, we need a way to modify the path of a
channel, so we need to keep the "<hostname>/<session-name>" information
separate in the consumer_net structure for future use.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/consumer.c
src/bin/lttng-sessiond/consumer.h
src/bin/lttng-sessiond/kernel-consumer.c
src/bin/lttng-sessiond/ust-consumer.c

index dc21e24ca0a5c01e4c2e8d3b24082492685944bf..6351ebe32f47431c0f6490bd6edd23ba3b8a0c37 100644 (file)
@@ -715,11 +715,12 @@ int consumer_set_network_uri(struct consumer_output *obj,
                        goto error;
                }
 
-               if (lttng_strncpy(obj->subdir, tmp_path, sizeof(obj->subdir))) {
+               if (lttng_strncpy(obj->dst.net.base_dir, tmp_path,
+                               sizeof(obj->dst.net.base_dir))) {
                        ret = -LTTNG_ERR_INVALID;
                        goto error;
                }
-               DBG3("Consumer set network uri subdir path %s", tmp_path);
+               DBG3("Consumer set network uri base_dir path %s", tmp_path);
        }
 
        return 0;
@@ -1417,8 +1418,11 @@ int consumer_snapshot_channel(struct consumer_socket *socket, uint64_t key,
                msg.u.snapshot_channel.use_relayd = 1;
                ret = snprintf(msg.u.snapshot_channel.pathname,
                                sizeof(msg.u.snapshot_channel.pathname),
-                               "%s/%s-%s-%" PRIu64 "%s", output->consumer->subdir,
-                               output->name, output->datetime, output->nb_snapshot,
+                               "%s/%s/%s-%s-%" PRIu64 "%s",
+                               output->consumer->dst.net.base_dir,
+                               output->consumer->subdir,
+                               output->name, output->datetime,
+                               output->nb_snapshot,
                                session_path);
                if (ret < 0) {
                        ret = -LTTNG_ERR_NOMEM;
@@ -1427,8 +1431,10 @@ int consumer_snapshot_channel(struct consumer_socket *socket, uint64_t key,
        } else {
                ret = snprintf(msg.u.snapshot_channel.pathname,
                                sizeof(msg.u.snapshot_channel.pathname),
-                               "%s/%s-%s-%" PRIu64 "%s", output->consumer->dst.session_root_path,
-                               output->name, output->datetime, output->nb_snapshot,
+                               "%s/%s-%s-%" PRIu64 "%s",
+                               output->consumer->dst.session_root_path,
+                               output->name, output->datetime,
+                               output->nb_snapshot,
                                session_path);
                if (ret < 0) {
                        ret = -LTTNG_ERR_NOMEM;
index 9186d2f2be19a1ac325a8789734db218947a0cae..ddc94d7148e5c3cc91be34f98b0a924374862fba 100644 (file)
@@ -140,6 +140,9 @@ struct consumer_net {
 
        /* Data path for network streaming. */
        struct lttng_uri data;
+
+       /* <hostname>/<session-name> */
+       char base_dir[PATH_MAX];
 };
 
 /*
index 20a7efb402a2314a9fcc006dbf4c84439e5a099f..10011f4cd109b4b630abd615ca4d8256b36ccd03 100644 (file)
@@ -69,7 +69,9 @@ static char *create_channel_path(struct consumer_output *consumer,
                }
                DBG3("Kernel local consumer tracefile path: %s", pathname);
        } else {
-               ret = snprintf(tmp_path, sizeof(tmp_path), "%s", consumer->subdir);
+               ret = snprintf(tmp_path, sizeof(tmp_path), "%s%s",
+                               consumer->dst.net.base_dir,
+                               consumer->subdir);
                if (ret < 0) {
                        PERROR("snprintf kernel metadata path");
                        goto error;
index a431a19f01ac8e9706caf5201529f0559586f4d9..eac9956574e6c9e9b284c7d8ef6dd12e9768a370 100644 (file)
@@ -81,7 +81,10 @@ static char *setup_trace_path(struct consumer_output *consumer,
                        }
                }
        } else {
-               ret = snprintf(pathname, PATH_MAX, "%s%s", consumer->subdir,
+               ret = snprintf(pathname, PATH_MAX, "%s%s%s%s",
+                               consumer->dst.net.base_dir,
+                               consumer->chunk_path,
+                               consumer->subdir,
                                ua_sess->path);
                if (ret < 0) {
                        PERROR("snprintf channel path");
This page took 0.029047 seconds and 5 git commands to generate.