Propagate trace format to relayd on session creation
[deliverable/lttng-tools.git] / src / bin / lttng-sessiond / cmd.cpp
index 94edb6368637eb625497819ac27eff4e5d246221..52adba00604027b0ede6cf86bd71fe7bacd54df6 100644 (file)
@@ -832,17 +832,12 @@ error:
  *
  * Returns LTTNG_OK on success or an LTTng error code on failure.
  */
-static enum lttng_error_code send_consumer_relayd_socket(unsigned int session_id,
+static enum lttng_error_code send_consumer_relayd_socket(const struct ltt_session& session,
                struct lttng_uri *relayd_uri,
                struct consumer_output *consumer,
                struct consumer_socket *consumer_sock,
-               const char *session_name,
-               const char *hostname,
-               const char *base_path,
-               int session_live_timer,
+               const char *base_path_override,
                const uint64_t *current_chunk_id,
-               time_t session_creation_time,
-               bool session_name_contains_creation_time,
                struct lttcomm_relayd_sock& rsock)
 {
        int ret;
@@ -862,9 +857,7 @@ static enum lttng_error_code send_consumer_relayd_socket(unsigned int session_id
 
        /* Send relayd socket to consumer. */
        ret = consumer_send_relayd_socket(consumer_sock, &rsock, consumer, relayd_uri->stype,
-                       session_id, session_name, hostname, base_path, session_live_timer,
-                       current_chunk_id, session_creation_time,
-                       session_name_contains_creation_time);
+                       session, base_path_override, current_chunk_id);
        if (ret < 0) {
                status = LTTNG_ERR_ENABLE_CONSUMER_FAIL;
                goto error;
@@ -926,7 +919,7 @@ static bool is_trace_format_configuration_supported(
 static lttng_error_code send_consumer_relayd_sockets(const ltt_session& session,
                struct consumer_output *consumer,
                struct consumer_socket *sock,
-               const char *base_path,
+               const char *base_path_override,
                const uint64_t *current_chunk_id)
 {
        enum lttng_error_code status = LTTNG_OK;
@@ -971,10 +964,8 @@ static lttng_error_code send_consumer_relayd_sockets(const ltt_session& session,
                        goto error;
                }
 
-               status = send_consumer_relayd_socket(session.id, &consumer->dst.net.control,
-                               consumer, sock, session.name, session.hostname, base_path,
-                               session.live_timer, current_chunk_id, session.creation_time,
-                               session.name_contains_creation_time, *control_sock);
+               status = send_consumer_relayd_socket(session, &consumer->dst.net.control, consumer,
+                               sock, base_path_override, current_chunk_id, *control_sock);
 
                if (status != LTTNG_OK) {
                        goto error;
@@ -990,10 +981,8 @@ static lttng_error_code send_consumer_relayd_sockets(const ltt_session& session,
                }
                LTTNG_ASSERT(data_sock);
 
-               status = send_consumer_relayd_socket(session.id, &consumer->dst.net.data, consumer,
-                               sock, session.name, session.hostname, base_path, session.live_timer,
-                               current_chunk_id, session.creation_time,
-                               session.name_contains_creation_time, *data_sock);
+               status = send_consumer_relayd_socket(session, &consumer->dst.net.data, consumer,
+                               sock, base_path_override, current_chunk_id, *data_sock);
 
                if (status != LTTNG_OK) {
                        goto error;
@@ -1055,8 +1044,7 @@ int cmd_setup_relayd(struct ltt_session *session)
                cds_lfht_for_each_entry (
                                usess->consumer->socks->ht, &iter.iter, socket, node.node) {
                        pthread_mutex_lock(socket->lock);
-                       ret = send_consumer_relayd_sockets(*session, usess->consumer, socket,
-                                       session->base_path,
+                       ret = send_consumer_relayd_sockets(*session, usess->consumer, socket, NULL,
                                        current_chunk_id.is_set ? &current_chunk_id.value : NULL);
                        pthread_mutex_unlock(socket->lock);
                        if (ret != LTTNG_OK) {
@@ -1078,8 +1066,7 @@ int cmd_setup_relayd(struct ltt_session *session)
                cds_lfht_for_each_entry (
                                ksess->consumer->socks->ht, &iter.iter, socket, node.node) {
                        pthread_mutex_lock(socket->lock);
-                       ret = send_consumer_relayd_sockets(*session, ksess->consumer, socket,
-                                       session->base_path,
+                       ret = send_consumer_relayd_sockets(*session, ksess->consumer, socket, NULL,
                                        current_chunk_id.is_set ? &current_chunk_id.value : NULL);
                        pthread_mutex_unlock(socket->lock);
                        if (ret != LTTNG_OK) {
@@ -5061,7 +5048,7 @@ static enum lttng_error_code set_relayd_for_snapshot(
        struct lttng_ht_iter iter;
        struct consumer_socket *socket;
        LTTNG_OPTIONAL(uint64_t) current_chunk_id = {};
-       const char *base_path;
+       const char *base_path_override = NULL;
 
        LTTNG_ASSERT(output);
        LTTNG_ASSERT(session);
@@ -5093,9 +5080,7 @@ static enum lttng_error_code set_relayd_for_snapshot(
         * base path.
         */
        if (output->dst.net.control.subdir[0] != '\0') {
-               base_path = output->dst.net.control.subdir;
-       } else {
-               base_path = session->base_path;
+               base_path_override = output->dst.net.control.subdir;
        }
 
        /*
@@ -5105,7 +5090,7 @@ static enum lttng_error_code set_relayd_for_snapshot(
        rcu_read_lock();
        cds_lfht_for_each_entry (output->socks->ht, &iter.iter, socket, node.node) {
                pthread_mutex_lock(socket->lock);
-               status = send_consumer_relayd_sockets(*session, output, socket, base_path,
+               status = send_consumer_relayd_sockets(*session, output, socket, base_path_override,
                                current_chunk_id.is_set ? &current_chunk_id.value : NULL);
                pthread_mutex_unlock(socket->lock);
                if (status != LTTNG_OK) {
@@ -6171,7 +6156,8 @@ enum lttng_error_code cmd_execute_trace_format_support_query(
                        goto end;
                }
 
-               if (!(supported_trace_format & trace_format->relayd_type())) {
+               if (!is_trace_format_configuration_supported(
+                                   supported_trace_format, *trace_format)) {
                        ERR("Relayd does not support the requested trace format");
                        ret_code = LTTNG_ERR_TRACE_FORMAT_UNSUPPORTED_RELAY_DAEMON;
                        goto end;
This page took 0.026037 seconds and 5 git commands to generate.