@@ -1114,10 +1114,10 @@ func (d *Driver) restoreSnapshot(ctx context.Context, req *csi.CreateVolumeReque
1114
1114
dstPath := fmt .Sprintf ("https://%s.file.%s/%s%s" , dstAccountName , storageEndpointSuffix , dstFileShareName , dstAccountSasToken )
1115
1115
1116
1116
srcFileShareSnapshotName := fmt .Sprintf ("%s(snapshot: %s)" , srcFileShareName , snapshot )
1117
- return d .copyFileShareByAzcopy (srcFileShareSnapshotName , dstFileShareName , srcPath , dstPath , snapshot , srcAccountName , dstAccountName , srcAccountSasToken , authAzcopyEnv , accountOptions )
1117
+ return d .copyFileShareByAzcopy (ctx , srcFileShareSnapshotName , dstFileShareName , srcPath , dstPath , snapshot , srcAccountName , dstAccountName , srcAccountSasToken , authAzcopyEnv , accountOptions )
1118
1118
}
1119
1119
1120
- func (d * Driver ) copyFileShareByAzcopy (srcFileShareName , dstFileShareName , srcPath , dstPath , snapshot , srcAccountName , dstAccountName , accountSASToken string , authAzcopyEnv []string , accountOptions * storage.AccountOptions ) error {
1120
+ func (d * Driver ) copyFileShareByAzcopy (ctx context. Context , srcFileShareName , dstFileShareName , srcPath , dstPath , snapshot , srcAccountName , dstAccountName , accountSASToken string , authAzcopyEnv []string , accountOptions * storage.AccountOptions ) error {
1121
1121
azcopyCopyOptions := azcopyCloneVolumeOptions
1122
1122
srcPathAuth := srcPath
1123
1123
if snapshot != "" {
@@ -1136,7 +1136,7 @@ func (d *Driver) copyFileShareByAzcopy(srcFileShareName, dstFileShareName, srcPa
1136
1136
case util .AzcopyJobError , util .AzcopyJobCompleted , util .AzcopyJobCompletedWithErrors , util .AzcopyJobCompletedWithSkipped , util .AzcopyJobCompletedWithErrorsAndSkipped :
1137
1137
return err
1138
1138
case util .AzcopyJobRunning :
1139
- err = wait .PollImmediate ( 20 * time .Second , time .Duration (d .waitForAzCopyTimeoutMinutes )* time .Minute , func () (bool , error ) {
1139
+ err = wait .PollUntilContextTimeout ( ctx , 20 * time .Second , time .Duration (d .waitForAzCopyTimeoutMinutes )* time .Minute , true , func (context. Context ) (bool , error ) {
1140
1140
jobState , percent , err := d .azcopy .GetAzcopyJob (dstFileShareName , authAzcopyEnv )
1141
1141
klog .V (2 ).Infof ("azcopy job status: %s, copy percent: %s%%, error: %v" , jobState , percent , err )
1142
1142
if err != nil {
0 commit comments