From a846acc807fee15c55c8b95ab7086ae8b14776da Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Tue, 13 Apr 2021 11:26:36 -0700 Subject: [PATCH] [Windows] Fix timeout value for EnableHostInterface (#2081) The second parameter to wait.PollImmediate (the timeout) is a time.Duration value. When using 5 as the parameter value, it is interpreted as 5ns, and not 5s. This means that EnableHostInterface basically never does any retry. --- pkg/agent/util/net_windows.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/agent/util/net_windows.go b/pkg/agent/util/net_windows.go index c01cc1d9140..6a1b2b8bae9 100644 --- a/pkg/agent/util/net_windows.go +++ b/pkg/agent/util/net_windows.go @@ -39,8 +39,8 @@ const ( LocalHNSNetwork = "antrea-hnsnetwork" OVSExtensionID = "583CC151-73EC-4A6A-8B47-578297AD7623" namedPipePrefix = `\\.\pipe\` - commandMaxRetry = 5 - commandRetryInternal = time.Second + commandRetryTimeout = 5 * time.Second + commandRetryInterval = time.Second ) func GetNSPath(containerNetNS string) (string, error) { @@ -62,7 +62,7 @@ func EnableHostInterface(ifaceName string) error { // Enable-NetAdapter is not a blocking operation based on our testing. // It returns immediately no matter whether the interface has been enabled or not. // So we need to check the interface status to ensure it is up before returning. - if err := wait.PollImmediate(commandRetryInternal, commandMaxRetry, func() (done bool, err error) { + if err := wait.PollImmediate(commandRetryInterval, commandRetryTimeout, func() (done bool, err error) { if err := InvokePSCommand(cmd); err != nil { klog.Errorf("Failed to run command %s: %v", cmd, err) return false, nil