From: Mathieu Desnoyers Date: Wed, 11 Dec 2019 18:31:24 +0000 (-0500) Subject: sessiond: query relayd configuration for availability of clear feature X-Git-Tag: v2.12.0-rc1~140 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=eacb7b6f2773556e31efb5e5d53d888c004b8f2f;p=lttng-tools.git sessiond: query relayd configuration for availability of clear feature Query the relayd configuration when connecting to check for availability of the clear feature. Signed-off-by: Mathieu Desnoyers Change-Id: I5827fdc7f92bc9bc87ccf9d1c567057b2c227e2b Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 869215b8d..1977353e9 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -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: diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 98cd14149..2e3127924 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -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) { diff --git a/src/bin/lttng-sessiond/consumer.h b/src/bin/lttng-sessiond/consumer.h index a2dc03e76..8ebbe00e2 100644 --- a/src/bin/lttng-sessiond/consumer.h +++ b/src/bin/lttng-sessiond/consumer.h @@ -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).