diff --git a/pkg/blob/controllerserver.go b/pkg/blob/controllerserver.go index 59fef1356..cf5213865 100644 --- a/pkg/blob/controllerserver.go +++ b/pkg/blob/controllerserver.go @@ -783,7 +783,7 @@ func (d *Driver) copyBlobContainer(req *csi.CreateVolumeRequest, accountSasToken _, percent, _ := d.azcopy.GetAzcopyJob(dstContainerName, authAzcopyEnv) return fmt.Errorf("timeout waiting for copy blob container %s to %s complete, current copy percent: %s%%", srcContainerName, dstContainerName, percent) } - copyErr := util.WaitForExecCompletion(time.Duration(d.waitForAzCopyTimeoutMinutes)*time.Minute, execFunc, timeoutFunc) + copyErr := util.WaitUntilTimeout(time.Duration(d.waitForAzCopyTimeoutMinutes)*time.Minute, execFunc, timeoutFunc) if copyErr != nil { klog.Warningf("CopyBlobContainer(%s, %s, %s) failed with error: %v", resourceGroupName, accountName, dstPath, copyErr) } else { diff --git a/pkg/blob/nodeserver.go b/pkg/blob/nodeserver.go index 2992dc88c..61f78bd7d 100644 --- a/pkg/blob/nodeserver.go +++ b/pkg/blob/nodeserver.go @@ -353,7 +353,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe mountOptions := util.JoinMountOptions(mountFlags, []string{"sec=sys,vers=3,nolock"}) execFunc := func() error { return d.mounter.MountSensitive(source, targetPath, mountType, mountOptions, []string{}) } timeoutFunc := func() error { return fmt.Errorf("time out") } - if err := volumehelper.WaitForExecCompletion(2*time.Minute, execFunc, timeoutFunc); err != nil { + if err := volumehelper.WaitUntilTimeout(2*time.Minute, execFunc, timeoutFunc); err != nil { var helpLinkMsg string if d.appendMountErrorHelpLink { helpLinkMsg = "\nPlease refer to http://aka.ms/blobmounterror for possible causes and solutions for mount errors." diff --git a/pkg/util/util.go b/pkg/util/util.go index bb5e60052..75bd3d583 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -395,8 +395,8 @@ type ExecFunc func() (err error) // TimeoutFunc returns output and error if an ExecFunc timeout type TimeoutFunc func() (err error) -// WaitForExecCompletion waits for the exec function to complete or return timeout error -func WaitForExecCompletion(timeout time.Duration, execFunc ExecFunc, timeoutFunc TimeoutFunc) error { +// WaitUntilTimeout waits for the exec function to complete or return timeout error +func WaitUntilTimeout(timeout time.Duration, execFunc ExecFunc, timeoutFunc TimeoutFunc) error { // Create a channel to receive the result of the azcopy exec function done := make(chan bool) var err error diff --git a/pkg/util/util_test.go b/pkg/util/util_test.go index 3cec59e5a..d2d0b6083 100644 --- a/pkg/util/util_test.go +++ b/pkg/util/util_test.go @@ -657,7 +657,7 @@ func TestSetVolumeOwnership(t *testing.T) { } } -func TestWaitForExecCompletion(t *testing.T) { +func TestWaitUntilTimeout(t *testing.T) { tests := []struct { desc string timeout time.Duration @@ -702,7 +702,7 @@ func TestWaitForExecCompletion(t *testing.T) { } for _, test := range tests { - err := WaitForExecCompletion(test.timeout, test.execFunc, test.timeoutFunc) + err := WaitUntilTimeout(test.timeout, test.execFunc, test.timeoutFunc) if err != nil && (err.Error() != test.expectedErr.Error()) { t.Errorf("unexpected error: %v, expected error: %v", err, test.expectedErr) }