Skip to content

Commit

Permalink
list ls with label to avoid listing ts failure
Browse files Browse the repository at this point in the history
  • Loading branch information
lut777 committed Jul 9, 2021
1 parent 8304f8d commit 8cff685
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ func (c *Controller) handleAddOrUpdateSubnet(key string) error {
}
}

exist, err := c.ovnClient.LogicalSwitchExists(subnet.Name)
exist, err := c.ovnClient.LogicalSwitchExists(subnet.Name, fmt.Sprintf("external_ids:vendor=%s", util.CniTypeName))
if err != nil {
klog.Errorf("failed to list logical switch, %v", err)
c.patchSubnetStatus(subnet, "ListLogicalSwitchFailed", err.Error())
Expand Down Expand Up @@ -653,7 +653,7 @@ func (c *Controller) handleDeleteRoute(subnet *kubeovnv1.Subnet) error {
func (c *Controller) handleDeleteLogicalSwitch(key string) error {
c.ipam.DeleteSubnet(key)

exist, err := c.ovnClient.LogicalSwitchExists(key)
exist, err := c.ovnClient.LogicalSwitchExists(key, fmt.Sprintf("external_ids:vendor=%s", util.CniTypeName))
if err != nil {
klog.Errorf("failed to list logical switch, %v", err)
return err
Expand Down
4 changes: 2 additions & 2 deletions pkg/ovs/ovn-nbctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ func (c Client) GetEntityInfo(entity string, index string, attris []string) (res
return result, nil
}

func (c Client) LogicalSwitchExists(logicalSwitch string) (bool, error) {
lss, err := c.ListLogicalSwitch(fmt.Sprintf("external_ids:vendor=%s", util.CniTypeName))
func (c Client) LogicalSwitchExists(logicalSwitch string, args ...string) (bool, error) {
lss, err := c.ListLogicalSwitch(args...)
if err != nil {
return false, err
}
Expand Down

0 comments on commit 8cff685

Please sign in to comment.