From 03d8dff155814770b69981daada45aff46f4211a Mon Sep 17 00:00:00 2001 From: zcq98 Date: Thu, 19 Dec 2024 15:47:17 +0800 Subject: [PATCH 1/3] fix: err is always nil Signed-off-by: zcq98 --- pkg/daemon/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/daemon/handler.go b/pkg/daemon/handler.go index 68b956ece9c..86c7d0d1458 100644 --- a/pkg/daemon/handler.go +++ b/pkg/daemon/handler.go @@ -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 != "" { From ed79e955931529bb4f73a1cd4b72dae5a6e1f551 Mon Sep 17 00:00:00 2001 From: zcq98 Date: Thu, 19 Dec 2024 15:47:25 +0800 Subject: [PATCH 2/3] log and format optimization Signed-off-by: zcq98 --- pkg/controller/gc.go | 2 +- pkg/util/validator.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/controller/gc.go b/pkg/controller/gc.go index 01d48511198..4e0caeb6f63 100644 --- a/pkg/controller/gc.go +++ b/pkg/controller/gc.go @@ -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 } diff --git a/pkg/util/validator.go b/pkg/util/validator.go index 942eb750ffe..fd4577ca766 100644 --- a/pkg/util/validator.go +++ b/pkg/util/validator.go @@ -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) From 086f5962d48b927ce4261dba58ea16772189f064 Mon Sep 17 00:00:00 2001 From: zcq98 Date: Thu, 19 Dec 2024 15:57:51 +0800 Subject: [PATCH 3/3] fix ut failed Signed-off-by: zcq98 --- pkg/util/validator_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/util/validator_test.go b/pkg/util/validator_test.go index 956918060c6..e5625e76628 100644 --- a/pkg/util/validator_test.go +++ b/pkg/util/validator_test.go @@ -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", }, }