-
Notifications
You must be signed in to change notification settings - Fork 450
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
21f0b97
commit cee3921
Showing
5 changed files
with
136 additions
and
37 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