-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
optimize lrp create for subnet in vpc (#1712)
- Loading branch information
1 parent
f582a11
commit 3ff586e
Showing
5 changed files
with
128 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package ovs | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/ovn-org/libovsdb/client" | ||
|
||
"github.com/kubeovn/kube-ovn/pkg/ovsdb/ovnnb" | ||
) | ||
|
||
func (c OvnClient) GetLogicalSwitch(name string, ignoreNotFound bool) (*ovnnb.LogicalSwitch, error) { | ||
ls := &ovnnb.LogicalSwitch{Name: name} | ||
if err := c.ovnNbClient.Get(context.TODO(), ls); err != nil { | ||
if ignoreNotFound && err == client.ErrNotFound { | ||
return nil, nil | ||
} | ||
return nil, fmt.Errorf("failed to get logical switch %s: %v", name, err) | ||
} | ||
|
||
return ls, nil | ||
} | ||
|
||
func (c OvnClient) LogicalSwitchExists(name string) (bool, error) { | ||
ls, err := c.GetLogicalSwitch(name, true) | ||
return ls != nil, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters