Skip to content

Commit 15dd0ae

Browse files
authored
lxd/network/common: Handle missing BGP peer (from Incus) (#15220)
Includes cherry-pick from lxc/incus#1818.
2 parents 898526c + 923ead2 commit 15dd0ae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lxd/network/driver_common.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package network
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"net"
78
"os"
@@ -10,6 +11,7 @@ import (
1011
"unicode"
1112

1213
"github.com/canonical/lxd/client"
14+
"github.com/canonical/lxd/lxd/bgp"
1315
"github.com/canonical/lxd/lxd/cluster"
1416
"github.com/canonical/lxd/lxd/cluster/request"
1517
"github.com/canonical/lxd/lxd/db"
@@ -671,7 +673,7 @@ func (n *common) bgpClearPeers(config map[string]string) error {
671673
// Remove the peer.
672674
fields := strings.Split(peer, ",")
673675
err := n.state.BGP.RemovePeer(net.ParseIP(fields[0]))
674-
if err != nil {
676+
if err != nil && !errors.Is(err, bgp.ErrPeerNotFound) {
675677
return err
676678
}
677679
}

0 commit comments

Comments
 (0)