From 1ae9702ccce36ed267d8b2c4bfc21e82c0e520f2 Mon Sep 17 00:00:00 2001 From: zhaocongqi <1229896069@qq.com> Date: Fri, 27 Dec 2024 13:58:45 +0800 Subject: [PATCH] remove unused function Signed-off-by: zhaocongqi <1229896069@qq.com> --- pkg/controller/init.go | 4 +-- pkg/ovs/ovn-nb-dhcp_options.go | 5 ---- pkg/ovs/ovn-nb-dhcp_options_test.go | 40 ----------------------------- pkg/ovs/ovn-nb-suite_test.go | 4 --- 4 files changed, 2 insertions(+), 51 deletions(-) diff --git a/pkg/controller/init.go b/pkg/controller/init.go index 4a410a116ce..d278212a900 100644 --- a/pkg/controller/init.go +++ b/pkg/controller/init.go @@ -318,10 +318,10 @@ func (c *Controller) InitIPAM() error { } subnetProviderMaps := make(map[string]string, len(subnets)) for _, subnet := range subnets { - subnetProviderMaps[subnet.Name] = subnet.Spec.Provider - klog.Infof("Init subnet %s", subnet.Name) + subnetProviderMaps[subnet.Name] = subnet.Spec.Provider + if err := c.ipam.AddOrUpdateSubnet(subnet.Name, subnet.Spec.CIDRBlock, subnet.Spec.Gateway, subnet.Spec.ExcludeIps); err != nil { klog.Errorf("failed to init subnet %s: %v", subnet.Name, err) } diff --git a/pkg/ovs/ovn-nb-dhcp_options.go b/pkg/ovs/ovn-nb-dhcp_options.go index a76b8373d6d..4f1a939e008 100644 --- a/pkg/ovs/ovn-nb-dhcp_options.go +++ b/pkg/ovs/ovn-nb-dhcp_options.go @@ -293,11 +293,6 @@ func (c *OVNNbClient) ListDHCPOptions(needVendorFilter bool, externalIDs map[str return dhcpOptList, nil } -func (c *OVNNbClient) DHCPOptionsExists(lsName, protocol string) (bool, error) { - dhcpOpt, err := c.GetDHCPOptions(lsName, protocol, true) - return dhcpOpt != nil, err -} - // newDHCPOptions return dhcp options with basic information func newDHCPOptions(lsName, cidr, options string) (*ovnnb.DHCPOptions, error) { if len(cidr) == 0 || len(lsName) == 0 { diff --git a/pkg/ovs/ovn-nb-dhcp_options_test.go b/pkg/ovs/ovn-nb-dhcp_options_test.go index c87dad068f4..de8d6ff1e5d 100644 --- a/pkg/ovs/ovn-nb-dhcp_options_test.go +++ b/pkg/ovs/ovn-nb-dhcp_options_test.go @@ -640,43 +640,3 @@ func (suite *OvnClientTestSuite) testCreateDHCPOptions() { require.Error(t, err) }) } - -func (suite *OvnClientTestSuite) testDHCPOptionsExists() { - t := suite.T() - t.Parallel() - - nbClient := suite.ovnNBClient - lsName := "test-dhcp-opt-exists-ls" - - t.Run("DHCP options exist", func(t *testing.T) { - cidr := "192.168.80.0/24" - err := nbClient.CreateDHCPOptions(lsName, cidr, "") - require.NoError(t, err) - - exists, err := nbClient.DHCPOptionsExists(lsName, "IPv4") - require.NoError(t, err) - require.True(t, exists) - }) - - t.Run("DHCP options do not exist", func(t *testing.T) { - exists, err := nbClient.DHCPOptionsExists(lsName+"-1", "IPv4") - require.NoError(t, err) - require.False(t, exists) - }) - - t.Run("DHCP options exist for IPv6", func(t *testing.T) { - cidr := "fd00::c0a8:8001/120" - err := nbClient.CreateDHCPOptions(lsName, cidr, "") - require.NoError(t, err) - - exists, err := nbClient.DHCPOptionsExists(lsName, "IPv6") - require.NoError(t, err) - require.True(t, exists) - }) - - t.Run("DHCP options do not exist for IPv6", func(t *testing.T) { - exists, err := nbClient.DHCPOptionsExists(lsName+"-1", "IPv6") - require.NoError(t, err) - require.False(t, exists) - }) -} diff --git a/pkg/ovs/ovn-nb-suite_test.go b/pkg/ovs/ovn-nb-suite_test.go index 4bc6c96400b..f1f57e98020 100644 --- a/pkg/ovs/ovn-nb-suite_test.go +++ b/pkg/ovs/ovn-nb-suite_test.go @@ -991,10 +991,6 @@ func (suite *OvnClientTestSuite) Test_CreateDHCPOptions() { suite.testCreateDHCPOptions() } -func (suite *OvnClientTestSuite) Test_DHCPOptionsExists() { - suite.testDHCPOptionsExists() -} - /* mixed operations unit test */ func (suite *OvnClientTestSuite) Test_CreateGatewayLogicalSwitch() { suite.testCreateGatewayLogicalSwitch()