From 331006f7c64bcbaaa95eac71a4d1ffc596cc95ea Mon Sep 17 00:00:00 2001 From: Mengxin Liu Date: Tue, 9 Jul 2024 09:42:28 +0800 Subject: [PATCH] when router is deleted return success for static route deletion (#4266) Signed-off-by: oilbeater --- pkg/ovs/ovn-nb-logical_router_route.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/ovs/ovn-nb-logical_router_route.go b/pkg/ovs/ovn-nb-logical_router_route.go index 290b3cdeda9..2d35c34be89 100644 --- a/pkg/ovs/ovn-nb-logical_router_route.go +++ b/pkg/ovs/ovn-nb-logical_router_route.go @@ -134,12 +134,17 @@ func (c *OVNNbClient) UpdateLogicalRouterStaticRoute(route *ovnnb.LogicalRouterS return nil } -// DeleteLogicalRouterStaticRoute add a logical router static route +// DeleteLogicalRouterStaticRoute delete a logical router static route func (c *OVNNbClient) DeleteLogicalRouterStaticRoute(lrName string, routeTable, policy *string, ipPrefix, nexthop string) error { if policy == nil || len(*policy) == 0 { policy = &ovnnb.LogicalRouterStaticRoutePolicyDstIP } + lr, err := c.GetLogicalRouter(lrName, true) + if lr == nil && err == nil { + return nil + } + routes, err := c.ListLogicalRouterStaticRoutes(lrName, routeTable, policy, ipPrefix, nil) if err != nil { klog.Error(err)