relayd: send sessiond uuid and session id as part of create session
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 5 Mar 2019 03:16:10 +0000 (22:16 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Jul 2019 19:58:25 +0000 (15:58 -0400)
Send the sessiond's instance UUID and session id as part of the
relay daemon control protocol's CREATE_SESSION command.

Those attributes will be used to uniquely identify trace chunks
in follow-up commits.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/consumer.c
src/common/relayd/relayd.c
src/common/relayd/relayd.h
src/common/sessiond-comm/relayd.h
tests/regression/tools/live/Makefile.am
tests/unit/Makefile.am

index 336c7607104e1a982cb0f62b0622e9e65eb81bf9..171301ab5688fafc305210d955c5daa94e204977 100644 (file)
@@ -35,6 +35,7 @@
 #include "health-sessiond.h"
 #include "ust-app.h"
 #include "utils.h"
+#include "lttng-sessiond.h"
 
 /*
  * Send a data payload using a given consumer socket of size len.
@@ -1078,7 +1079,8 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock,
                ret = relayd_create_session(rsock,
                                &msg.u.relayd_sock.relayd_session_id,
                                session_name, hostname, session_live_timer,
-                               consumer->snapshot);
+                               consumer->snapshot, session_id,
+                               sessiond_uuid);
                if (ret < 0) {
                        /* Close the control socket. */
                        (void) relayd_close(rsock);
index 78ed85558c8cf24cc1048924ce4db794e0dfeef9..ff0be32a17190f2a45ae1a4b91987f5a1a774619 100644 (file)
@@ -127,7 +127,8 @@ error:
  */
 static int relayd_create_session_2_11(struct lttcomm_relayd_sock *rsock,
                char *session_name, char *hostname,
-               int session_live_timer, unsigned int snapshot)
+               int session_live_timer, unsigned int snapshot,
+               uint64_t sessiond_session_id, const lttng_uuid sessiond_uuid)
 {
        int ret;
        struct lttcomm_relayd_create_session_2_11 *msg = NULL;
@@ -165,6 +166,9 @@ static int relayd_create_session_2_11(struct lttcomm_relayd_sock *rsock,
        msg->live_timer = htobe32(session_live_timer);
        msg->snapshot = !!snapshot;
 
+       lttng_uuid_copy(msg->sessiond_uuid, sessiond_uuid);
+       msg->session_id = htobe64(sessiond_session_id);
+
        /* Send command */
        ret = send_command(rsock, RELAYD_CREATE_SESSION, msg, msg_length, 0);
        if (ret < 0) {
@@ -231,15 +235,16 @@ error:
  * On success, return 0 else a negative value which is either an errno error or
  * a lttng error code from the relayd.
  */
-int relayd_create_session(struct lttcomm_relayd_sock *rsock, uint64_t *session_id,
+int relayd_create_session(struct lttcomm_relayd_sock *rsock, uint64_t *relayd_session_id,
                char *session_name, char *hostname, int session_live_timer,
-               unsigned int snapshot)
+               unsigned int snapshot, uint64_t sessiond_session_id,
+               const lttng_uuid sessiond_uuid)
 {
        int ret;
        struct lttcomm_relayd_status_session reply;
 
        assert(rsock);
-       assert(session_id);
+       assert(relayd_session_id);
 
        DBG("Relayd create session");
 
@@ -253,7 +258,8 @@ int relayd_create_session(struct lttcomm_relayd_sock *rsock, uint64_t *session_i
        } else {
                /* From 2.11 to ... */
                ret = relayd_create_session_2_11(rsock, session_name,
-                               hostname, session_live_timer, snapshot);
+                               hostname, session_live_timer, snapshot,
+                               sessiond_session_id, sessiond_uuid);
        }
 
        if (ret < 0) {
@@ -276,7 +282,7 @@ int relayd_create_session(struct lttcomm_relayd_sock *rsock, uint64_t *session_i
                goto error;
        } else {
                ret = 0;
-               *session_id = reply.session_id;
+               *relayd_session_id = reply.session_id;
        }
 
        DBG("Relayd session created with id %" PRIu64, reply.session_id);
index 9353fc2d78440b64e29af8e753a61778afca270f..2fcdcf4c76b5a3c2e84dcd749101bfa614784332 100644 (file)
 
 int relayd_connect(struct lttcomm_relayd_sock *sock);
 int relayd_close(struct lttcomm_relayd_sock *sock);
-int relayd_create_session(struct lttcomm_relayd_sock *sock, uint64_t *session_id,
-               char *session_name, char *hostname, int session_live_timer,
-               unsigned int snapshot);
+int relayd_create_session(struct lttcomm_relayd_sock *sock,
+               uint64_t *relayd_session_id, char *session_name, char *hostname,
+               int session_live_timer, unsigned int snapshot,
+               uint64_t sessiond_session_id, const lttng_uuid sessiond_uuid);
 int relayd_add_stream(struct lttcomm_relayd_sock *sock, const char *channel_name,
                const char *pathname, uint64_t *stream_id,
                uint64_t tracefile_size, uint64_t tracefile_count,
index 579a41df19355261186691263893b1ed6298fbc4..cbeb5b5d6fe20535e398753c07b57d5e62c7febf 100644 (file)
@@ -26,6 +26,7 @@
 #include <common/defaults.h>
 #include <common/index/ctf-index.h>
 #include <common/macros.h>
+#include <common/compat/uuid.h>
 
 #define RELAYD_VERSION_COMM_MAJOR             VERSION_MAJOR
 #define RELAYD_VERSION_COMM_MINOR             VERSION_MINOR
@@ -206,6 +207,10 @@ struct lttcomm_relayd_create_session_2_11 {
        uint32_t hostname_len;
        uint32_t live_timer;
        uint8_t snapshot;
+       /* Sessiond instance UUID */
+       lttng_uuid sessiond_uuid;
+       /* Sessiond session id */
+        uint64_t session_id;
        /* Contains the session_name and hostname */
        char names[];
 } LTTNG_PACKED;
index 7a26b42cfd3ecf7b708207094a1d4548186c0398..be9388b1730d74255d7c2adf224b93ef1fe011d5 100644 (file)
@@ -7,8 +7,10 @@ LIBSESSIOND_COMM=$(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la
 LIBHASHTABLE=$(top_builddir)/src/common/hashtable/libhashtable.la
 LIBRELAYD=$(top_builddir)/src/common/relayd/librelayd.la
 LIBHEALTH=$(top_builddir)/src/common/health/libhealth.la
+LIBCOMPAT=$(top_builddir)/src/common/compat/libcompat.la
 
 LIVE= $(top_builddir)/src/bin/lttng-sessiond/consumer.$(OBJEXT) \
+        $(top_builddir)/src/bin/lttng-sessiond/globals.$(OBJEXT) \
         $(top_builddir)/src/bin/lttng-sessiond/utils.$(OBJEXT) \
         $(top_builddir)/src/bin/lttng-sessiond/snapshot.$(OBJEXT)
 
@@ -21,7 +23,7 @@ endif
 
 live_test_SOURCES = live_test.c
 live_test_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \
-               $(LIBHASHTABLE) $(LIBHEALTH) $(DL_LIBS) -lrt
+               $(LIBHASHTABLE) $(LIBHEALTH) $(DL_LIBS) $(LIBCOMPAT) -lrt
 live_test_LDADD += $(LIVE) \
                $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la
 
index a949d3cdda6756a313da3b49de3a3ea11e24b863..4ded1dfb12f1d0b77a186b674416d47b7c488a11 100644 (file)
@@ -126,7 +126,9 @@ endif
 
 # Kernel data structures unit test
 KERN_DATA_TRACE=$(top_builddir)/src/bin/lttng-sessiond/trace-kernel.$(OBJEXT) \
+               $(top_builddir)/src/common/compat/libcompat.la \
                $(top_builddir)/src/bin/lttng-sessiond/consumer.$(OBJEXT) \
+               $(top_builddir)/src/bin/lttng-sessiond/globals.$(OBJEXT) \
                $(top_builddir)/src/bin/lttng-sessiond/utils.$(OBJEXT) \
                $(top_builddir)/src/common/health/libhealth.la \
                $(top_builddir)/src/bin/lttng-sessiond/notification-thread-commands.$(OBJEXT) \
This page took 0.029752 seconds and 4 git commands to generate.