Skip to content

Commit

Permalink
lxd/cluster: Don't fail when notifying a server...
Browse files Browse the repository at this point in the history
...that is shutting down when using NotifyAlive.

Fixes canonical#13811

Signed-off-by: Wesley Hershberger <[email protected]>
  • Loading branch information
MggMuggins authored and tomponline committed Sep 13, 2024
1 parent bfd326e commit 8bb2dab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lxd/cluster/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package cluster
import (
"context"
"fmt"
"net/http"
"sync"
"time"

"github.com/canonical/lxd/client"
"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"
)

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 8bb2dab

Please sign in to comment.