From 93ffbe9898d890673fba2ad148b7eb1968a6eeb6 Mon Sep 17 00:00:00 2001 From: Wesley Hershberger Date: Tue, 6 Aug 2024 16:37:14 -0500 Subject: [PATCH] lxd/cluster: Don't fail when notifying a server... ...that is shutting down when using NotifyAlive. Fixes #13811 Signed-off-by: Wesley Hershberger --- lxd/cluster/notify.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lxd/cluster/notify.go b/lxd/cluster/notify.go index 06d419f5ff0b..8f337292694b 100644 --- a/lxd/cluster/notify.go +++ b/lxd/cluster/notify.go @@ -3,6 +3,7 @@ package cluster import ( "context" "fmt" + "net/http" "sync" "time" @@ -10,6 +11,7 @@ import ( "github.com/canonical/lxd/lxd/db" "github.com/canonical/lxd/lxd/state" "github.com/canonical/lxd/shared" + "github.com/canonical/lxd/shared/api" "github.com/canonical/lxd/shared/logger" ) @@ -109,7 +111,9 @@ func NewNotifier(state *state.State, networkCert *shared.CertInfo, serverCert *s // TODO: aggregate all errors? for i, err := range errs { if err != nil { - if shared.IsConnectionError(err) && policy == NotifyAlive { + isDown := shared.IsConnectionError(err) || api.StatusErrorCheck(err, http.StatusServiceUnavailable) + + if isDown && policy == NotifyAlive { logger.Warnf("Could not notify node %s", peers[i]) continue }