Create the session and domain directories on start
authorJulien Desfossez <jdesfossez@efficios.com>
Mon, 11 Dec 2017 19:41:45 +0000 (14:41 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 5 Mar 2018 21:25:39 +0000 (16:25 -0500)
When the session starts, we now create the <session-name> folder and the
domain folder(s) regardless of the activity or registered apps.

This will be useful for the session rotation feature to avoid dealing
with empty rotations. Also, it is more consistent for the user to have
an empty trace folder instead of no folder at all if a session is
completely inactive.

This also removes the directory creation made by the session daemon
which did not belong there.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/main.c
tests/regression/ust/linking/test_linking.py

index 27acbada09627970ee2c6a46ebe301bacf4e2ae9..1542fe8e1cb6ae6a91db693a5528338037575390 100644 (file)
@@ -2519,8 +2519,20 @@ int cmd_start_trace(struct ltt_session *session)
                goto error;
        }
 
+       if (!session->has_been_started) {
+               if (!session->snapshot_mode && session->output_traces) {
+                       ret = session_mkdir(session);
+                       if (ret) {
+                               ERR("Failed to create the session directories");
+                               ret = LTTNG_ERR_CREATE_DIR_FAIL;
+                               goto error;
+                       }
+               }
+       }
+
        /* Kernel tracing */
        if (ksession != NULL) {
+               DBG("Start kernel tracing session %s", session->name);
                ret = start_kernel_session(ksession, kernel_tracer_fd);
                if (ret != LTTNG_OK) {
                        goto error;
index 114e9c21d7a10432613ea480aef7ba0bc6d2c3e4..a6c45c2ed90942e03ba45a36f79a9ca6af538112 100644 (file)
@@ -2832,20 +2832,6 @@ static int create_kernel_session(struct ltt_session *session)
                goto error;
        }
 
-       /* Create directory(ies) on local filesystem. */
-       if (session->kernel_session->consumer->type == CONSUMER_DST_LOCAL &&
-                       strlen(session->kernel_session->consumer->dst.session_root_path) > 0) {
-               ret = run_as_mkdir_recursive(
-                               session->kernel_session->consumer->dst.session_root_path,
-                               S_IRWXU | S_IRWXG, session->uid, session->gid);
-               if (ret < 0) {
-                       if (errno != EEXIST) {
-                               ERR("Trace directory creation error");
-                               goto error;
-                       }
-               }
-       }
-
        session->kernel_session->uid = session->uid;
        session->kernel_session->gid = session->gid;
        session->kernel_session->output_traces = session->output_traces;
index 7400091e77fc03b3eaf506bb6356e90db36b798c..44940f74948aea0b4eefe37e99271f42ec251b77 100644 (file)
@@ -117,7 +117,8 @@ if DYNAMIC_TEST_ENABLED:
     print_test_result(demo_process.returncode == 0, current_test,\
                           "Running application dynamically linked to providers, no preload")
     current_test += 1
-    print_test_result(not os.path.exists(session_info.trace_path), current_test,\
+    trace_path = os.path.join(session_info.trace_path, "ust", "uid")
+    print_test_result(not os.path.exists(trace_path), current_test,\
                           "No events logged when running demo application without preloading providers")
     current_test += 1
 
This page took 0.033524 seconds and 5 git commands to generate.