Skip to content

Commit

Permalink
fix: err is always nil (#4857)
Browse files Browse the repository at this point in the history
* fix: err is always nil

Signed-off-by: zcq98 <[email protected]>

* log and format optimization

Signed-off-by: zcq98 <[email protected]>

* fix ut failed

Signed-off-by: zcq98 <[email protected]>

---------

Signed-off-by: zcq98 <[email protected]>
  • Loading branch information
zhaocongqi authored Dec 20, 2024
1 parent 3e78b22 commit 6478007
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ func (c *Controller) gcAddressSet() error {
}

if err = c.OVNNbClient.DeleteAddressSet(asList...); err != nil {
klog.Errorf("failed to delete address set %v,%v", asList, err)
klog.Errorf("failed to delete address set %v: %v", asList, err)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func (csh cniServerHandler) handleDel(req *restful.Request, resp *restful.Respon
var vmName string

// If the Pod was found, process its annotations and labels.
if err == nil {
if pod != nil {
if pod.Annotations != nil && (util.IsOvnProvider(podRequest.Provider) || podRequest.CniType == util.CniTypeName) {
subnet := pod.Annotations[fmt.Sprintf(util.LogicalSwitchAnnotationTemplate, podRequest.Provider)]
if subnet != "" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func ValidateNetworkBroadcast(cidr, ip string) error {
}
_, network, _ := net.ParseCIDR(cidrBlock)
if AddressCount(network) == 1 {
return fmt.Errorf("subnet %s is configured with /32 netmask", cidrBlock)
return fmt.Errorf("subnet %s is configured with /32 or /128 netmask", cidrBlock)
}

ipStr := IPToString(ipAddr)
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ func TestValidateSubnet(t *testing.T) {
},
Status: kubeovnv1.SubnetStatus{},
},
err: "validate gateway 10.16.0.0 for cidr 10.16.0.0/32 failed: subnet 10.16.0.0/32 is configured with /32 netmask",
err: "validate gateway 10.16.0.0 for cidr 10.16.0.0/32 failed: subnet 10.16.0.0/32 is configured with /32 or /128 netmask",
},
}

Expand Down

0 comments on commit 6478007

Please sign in to comment.