Skip to content

Commit

Permalink
libovsdb: ignore not found error when listing objects with a filter (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Jun 7, 2023
1 parent 78f923a commit d61a2ad
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/ovs/ovn-nb-logical_router_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package ovs

import (
"context"
"errors"
"fmt"

"github.com/ovn-org/libovsdb/client"
"github.com/ovn-org/libovsdb/model"
"github.com/ovn-org/libovsdb/ovsdb"
"github.com/scylladb/go-set/strset"
Expand Down Expand Up @@ -302,6 +304,9 @@ func (c *ovnClient) listLogicalRouterPoliciesByFilter(lrName string, filter func
for _, uuid := range lr.Policies {
policy, err := c.GetLogicalRouterPolicyByUUID(uuid)
if err != nil {
if errors.Is(err, client.ErrNotFound) {
continue
}
return nil, err
}
if filter == nil || filter(policy) {
Expand Down
5 changes: 5 additions & 0 deletions pkg/ovs/ovn-nb-logical_router_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package ovs

import (
"context"
"errors"
"fmt"

"github.com/ovn-org/libovsdb/client"
"github.com/ovn-org/libovsdb/model"
"github.com/ovn-org/libovsdb/ovsdb"
"github.com/scylladb/go-set/strset"
Expand Down Expand Up @@ -313,6 +315,9 @@ func (c *ovnClient) listLogicalRouterStaticRoutesByFilter(lrName string, filter
for _, uuid := range lr.StaticRoutes {
route, err := c.GetLogicalRouterStaticRouteByUUID(uuid)
if err != nil {
if errors.Is(err, client.ErrNotFound) {
continue
}
return nil, err
}
if filter == nil || filter(route) {
Expand Down
5 changes: 5 additions & 0 deletions pkg/ovs/ovn-nb-nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package ovs

import (
"context"
"errors"
"fmt"

"github.com/ovn-org/libovsdb/client"
"github.com/ovn-org/libovsdb/model"
"github.com/ovn-org/libovsdb/ovsdb"

Expand Down Expand Up @@ -338,6 +340,9 @@ func (c *ovnClient) listLogicalRouterNatByFilter(lrName string, filter func(rout
for _, uuid := range lr.Nat {
nat, err := c.GetNATByUUID(uuid)
if err != nil {
if errors.Is(err, client.ErrNotFound) {
continue
}
return nil, err
}
if filter == nil || filter(nat) {
Expand Down

0 comments on commit d61a2ad

Please sign in to comment.