sessiond: query relayd configuration for availability of clear feature
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 11 Dec 2019 18:31:24 +0000 (13:31 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 19 Dec 2019 22:37:56 +0000 (17:37 -0500)
Query the relayd configuration when connecting to check for availability
of the clear feature.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5827fdc7f92bc9bc87ccf9d1c567057b2c227e2b
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/consumer.c
src/bin/lttng-sessiond/consumer.h

index 869215b8d920cb7d2a0bd33d22129c34024e199e..1977353e9f6bec04c7fc74fc8eaaf84584bb017a 100644 (file)
@@ -998,6 +998,8 @@ static enum lttng_error_code create_connect_relayd(struct lttng_uri *uri,
 
        /* Create socket for control stream. */
        if (uri->stype == LTTNG_STREAM_CONTROL) {
+               uint64_t result_flags;
+
                DBG3("Creating relayd stream socket from URI");
 
                /* Check relayd version */
@@ -1012,6 +1014,16 @@ static enum lttng_error_code create_connect_relayd(struct lttng_uri *uri,
                }
                consumer->relay_major_version = rsock->major;
                consumer->relay_minor_version = rsock->minor;
+               ret = relayd_get_configuration(rsock, 0,
+                               &result_flags);
+               if (ret < 0) {
+                       ERR("Unable to get relayd configuration");
+                       status = LTTNG_ERR_RELAYD_CONNECT_FAIL;
+                       goto close_sock;
+               }
+               if (result_flags & LTTCOMM_RELAYD_CONFIGURATION_FLAG_CLEAR_ALLOWED) {
+                       consumer->relay_allows_clear = true;
+               }
        } else if (uri->stype == LTTNG_STREAM_DATA) {
                DBG3("Creating relayd data socket from URI");
        } else {
@@ -1224,6 +1236,8 @@ int cmd_setup_relayd(struct ltt_session *session)
                        usess->consumer->relay_major_version;
                session->consumer->relay_minor_version =
                        usess->consumer->relay_minor_version;
+               session->consumer->relay_allows_clear =
+                       usess->consumer->relay_allows_clear;
        }
 
        if (ksess && ksess->consumer && ksess->consumer->type == CONSUMER_DST_NET
@@ -1250,6 +1264,8 @@ int cmd_setup_relayd(struct ltt_session *session)
                        ksess->consumer->relay_major_version;
                session->consumer->relay_minor_version =
                        ksess->consumer->relay_minor_version;
+               session->consumer->relay_allows_clear =
+                       ksess->consumer->relay_allows_clear;
        }
 
 error:
index 98cd14149c0d0089075728152d3650b2de844ece..2e31279247ddf84335bc1a2391bf47a29732f612 100644 (file)
@@ -626,6 +626,7 @@ struct consumer_output *consumer_copy_output(struct consumer_output *src)
        output->snapshot = src->snapshot;
        output->relay_major_version = src->relay_major_version;
        output->relay_minor_version = src->relay_minor_version;
+       output->relay_allows_clear = src->relay_allows_clear;
        memcpy(&output->dst, &src->dst, sizeof(output->dst));
        ret = consumer_copy_sockets(output, src);
        if (ret < 0) {
index a2dc03e7606c4c5a9d8dd0f0b9e82d29fa866ae1..8ebbe00e2edd35e37eaaf259b8c131e5fbb559d9 100644 (file)
@@ -152,6 +152,9 @@ struct consumer_output {
        uint32_t relay_major_version;
        uint32_t relay_minor_version;
 
+       /* True if relayd supports the clear feature. */
+       bool relay_allows_clear;
+
        /*
         * Subdirectory path name used for both local and network
         * consumer ("kernel", "ust", or empty).
This page took 0.028671 seconds and 4 git commands to generate.