Skip to content

Commit 923ead2

Browse files
stgrabernmezhenskyi
authored andcommitted
lxd/network/driver/common: Handle missing BGP peer
Signed-off-by: Stéphane Graber <[email protected]> (cherry picked from commit 73f5867e6283f59af4e0a4c9a3668c6db499e89c) Signed-off-by: Nikita Mezhenskyi <[email protected]> License: Apache-2.0
1 parent 898526c commit 923ead2

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)