Skip to content

Commit

Permalink
fix(evpn-bridge): retry when the routing table is busy
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitrios Markou <dimitrios.markou@ericsson.com>
  • Loading branch information
mardim91 authored and sandersms committed Apr 25, 2024
1 parent 5847a43 commit 7c0854f
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions pkg/LinuxGeneralModule/lgm.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,12 @@ func setUpTenantBridge() {
}

// routingTableBusy checks if the route is in filterred list
func routingTableBusy(table uint32) bool {
_, err := nlink.RouteListFiltered(ctx, netlink.FAMILY_V4, &netlink.Route{Table: int(table)}, netlink.RT_FILTER_TABLE)
return err == nil
func routingTableBusy(table uint32) (bool, error) {
routeList, err := nlink.RouteListFiltered(ctx, netlink.FAMILY_V4, &netlink.Route{Table: int(table)}, netlink.RT_FILTER_TABLE)
if err != nil {
return false, err
}
return len(routeList) > 0, nil
}

// setUpBridge sets up the bridge
Expand Down Expand Up @@ -414,12 +417,21 @@ func setUpVrf(vrf *infradb.Vrf) (string, bool) {
*vrf.Metadata.RoutingTable[1] = 255
return "", true
}
routingTable := GenerateRouteTable()
vrf.Metadata.RoutingTable = make([]*uint32, 1)
vrf.Metadata.RoutingTable[0] = new(uint32)
if routingTableBusy(routingTable) {
log.Printf("LGM :Routing table %d is not empty\n", routingTable)
// return "Error"
var routingTable uint32
for {
routingTable = GenerateRouteTable()
isBusy, err := routingTableBusy(routingTable)
if err != nil {
log.Printf("LGM : Error occurred when checking if routing table %d is busy: %+v\n", routingTable, err)
return "", false
}
if !isBusy {
log.Printf("LGM: Routing Table %d is not busy\n", routingTable)
break
}
log.Printf("LGM: Routing Table %d is busy\n", routingTable)
}
var vtip string
if !reflect.ValueOf(vrf.Spec.VtepIP).IsZero() {
Expand Down

0 comments on commit 7c0854f

Please sign in to comment.