diff --git a/pkg/daemon/init.go b/pkg/daemon/init.go index e096553adb3..3a860377c79 100644 --- a/pkg/daemon/init.go +++ b/pkg/daemon/init.go @@ -5,6 +5,7 @@ import ( "fmt" "net" "strings" + "syscall" "time" "github.com/Wifx/gonetworkmanager" @@ -199,7 +200,7 @@ func changeProvideNicName(current, target string) (bool, error) { continue } if route.Scope == scope { - if err = netlink.RouteReplace(&route); err != nil { + if err = netlink.RouteReplace(&route); err != nil && err != syscall.EEXIST { klog.Errorf("failed to replace route %s: %v", route.String(), err) return false, err } diff --git a/test/e2e/underlay/underlay.go b/test/e2e/underlay/underlay.go index e83eb125fe1..acb6acf4c53 100644 --- a/test/e2e/underlay/underlay.go +++ b/test/e2e/underlay/underlay.go @@ -197,7 +197,10 @@ var _ = Describe("[Underlay]", func() { Expect(err).NotTo(HaveOccurred()) } + By("wait provider network to be ready") time.Sleep(3 * time.Second) + err = f.WaitProviderNetworkReady(ProviderNetwork) + Expect(err).NotTo(HaveOccurred()) By("validate provider network") pn, err := f.OvnClientSet.KubeovnV1().ProviderNetworks().Get(context.Background(), ProviderNetwork, metav1.GetOptions{}) @@ -222,6 +225,11 @@ var _ = Describe("[Underlay]", func() { newPn.Spec.ExcludeNodes = nil _, err = f.OvnClientSet.KubeovnV1().ProviderNetworks().Update(context.Background(), newPn, metav1.UpdateOptions{}) Expect(err).NotTo(HaveOccurred()) + + By("wait provider network to be ready") + time.Sleep(3 * time.Second) + err = f.WaitProviderNetworkReady(ProviderNetwork) + Expect(err).NotTo(HaveOccurred()) }) })