From cb82131f8b4b9a1d517b9e4da0d707008567a89e Mon Sep 17 00:00:00 2001 From: wujing Date: Mon, 8 Feb 2021 11:23:24 +0800 Subject: [PATCH 30/53] save health check log to disk before unhealthy Signed-off-by: wujing --- src/daemon/modules/container/health_check/health_check.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/daemon/modules/container/health_check/health_check.c b/src/daemon/modules/container/health_check/health_check.c index c6ccbbf2..a01679db 100644 --- a/src/daemon/modules/container/health_check/health_check.c +++ b/src/daemon/modules/container/health_check/health_check.c @@ -429,6 +429,10 @@ static int handle_increment_streak(container_t *cont, int retries) ret = -1; } } + } else { + if (container_state_to_disk(cont)) { + WARN("Failed to save container \"%s\" to disk", cont->common_config->id); + } } return ret; @@ -542,6 +546,7 @@ static int handle_probe_result(const char *container_id, const defs_health_log_e } // else we're starting or healthy. Stay in that state. } + // note: replicate Health status changes current = get_health_status(cont->state); if (strcmp(old_state, current) != 0) { -- 2.25.1