diff options
-rw-r--r-- | src/providers/backend.h | 5 | ||||
-rw-r--r-- | src/providers/data_provider_be.c | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/providers/backend.h b/src/providers/backend.h index f6c74f856..191427403 100644 --- a/src/providers/backend.h +++ b/src/providers/backend.h @@ -113,6 +113,11 @@ struct be_ctx { size_t check_online_ref_count; struct data_provider *provider; + + /* Indicates whether the last state of the DP that has been logged is + * DP_ERR_OK or DP_ERR_OFFLINE. The only usage of this var, so far, is + * to log the DP status without spamming the syslog/journal. */ + int last_dp_state; }; bool be_is_offline(struct be_ctx *ctx); diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index e564bc11d..2e55dc4e3 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -262,9 +262,17 @@ static void be_check_online_done(struct tevent_req *req) switch (reply->dp_error) { case DP_ERR_OK: + if (be_ctx->last_dp_state != DP_ERR_OK) { + be_ctx->last_dp_state = DP_ERR_OK; + sss_log(SSS_LOG_INFO, "Backend is online\n"); + } DEBUG(SSSDBG_TRACE_FUNC, "Backend is online\n"); break; case DP_ERR_OFFLINE: + if (be_ctx->last_dp_state != DP_ERR_OFFLINE) { + be_ctx->last_dp_state = DP_ERR_OFFLINE; + sss_log(SSS_LOG_INFO, "Backend is offline\n"); + } DEBUG(SSSDBG_TRACE_FUNC, "Backend is offline\n"); break; default: @@ -397,6 +405,7 @@ errno_t be_process_init(TALLOC_CTX *mem_ctx, ret = ENOMEM; goto done; } + be_ctx->last_dp_state = -1; ret = be_init_failover(be_ctx); if (ret != EOK) { |