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>
- 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;
}
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);
msg.u.snapshot_channel.use_relayd = 1;
ret = snprintf(msg.u.snapshot_channel.pathname,
sizeof(msg.u.snapshot_channel.pathname),
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;
session_path);
if (ret < 0) {
ret = -LTTNG_ERR_NOMEM;
} else {
ret = snprintf(msg.u.snapshot_channel.pathname,
sizeof(msg.u.snapshot_channel.pathname),
} 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;
session_path);
if (ret < 0) {
ret = -LTTNG_ERR_NOMEM;
/* Data path for network streaming. */
struct lttng_uri data;
/* Data path for network streaming. */
struct lttng_uri data;
+
+ /* <hostname>/<session-name> */
+ char base_dir[PATH_MAX];
}
DBG3("Kernel local consumer tracefile path: %s", pathname);
} else {
}
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;
if (ret < 0) {
PERROR("snprintf kernel metadata path");
goto error;
- 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");
ua_sess->path);
if (ret < 0) {
PERROR("snprintf channel path");