@@ -41,11 +41,14 @@ const (
41
41
// PollCheckInterval specifies the interval to check if filesystem is ready;
42
42
// needs to be shorter than the provisioner timeout
43
43
PollCheckInterval = 30 * time .Second
44
- // PollCheckTimeout specifies the time limit for polling DescribeFileSystems
45
- // for a completed create/update operation. FSx for Lustre filesystem
46
- // creation time is around 5 minutes, and update time varies depending on
47
- // target file system values
48
- PollCheckTimeout = 10 * time .Minute
44
+ // PollCheckTimeoutConstant & PollCheckTimeoutLinearFactor define the time limit
45
+ // for polling DescribeFileSystems for a completed create/update operation.
46
+ // FSx for Lustre filesystem creation time is around 5 minutes, and update
47
+ // time varies depending on target file system values. To handle varying creation
48
+ // times, the driver will wait at least PollCheckTimeoutConstant, but will
49
+ // increase the timeout linearly with PollCheckTimeoutLinearFactor (unit is duration/GiB)
50
+ PollCheckTimeoutConstant = 10 * time .Minute
51
+ PollCheckTimeoutLinearFactor = 5 * time .Millisecond
49
52
)
50
53
51
54
// Tags
@@ -117,7 +120,7 @@ type Cloud interface {
117
120
ResizeFileSystem (ctx context.Context , fileSystemId string , newSizeGiB int64 ) (int64 , error )
118
121
DeleteFileSystem (ctx context.Context , fileSystemId string ) (err error )
119
122
DescribeFileSystem (ctx context.Context , fileSystemId string ) (fs * FileSystem , err error )
120
- WaitForFileSystemAvailable (ctx context.Context , fileSystemId string ) error
123
+ WaitForFileSystemAvailable (ctx context.Context , fileSystemId string , sizeGiB int64 ) error
121
124
WaitForFileSystemResize (ctx context.Context , fileSystemId string , resizeGiB int64 ) error
122
125
}
123
126
@@ -329,8 +332,12 @@ func (c *cloud) DescribeFileSystem(ctx context.Context, fileSystemId string) (*F
329
332
}, nil
330
333
}
331
334
332
- func (c * cloud ) WaitForFileSystemAvailable (ctx context.Context , fileSystemId string ) error {
333
- err := wait .Poll (PollCheckInterval , PollCheckTimeout , func () (done bool , err error ) {
335
+ func CalcPollTimeout (sizeGiB int64 ) time.Duration {
336
+ return time .Duration (int64 (PollCheckTimeoutConstant ) + sizeGiB * int64 (PollCheckTimeoutLinearFactor ))
337
+ }
338
+
339
+ func (c * cloud ) WaitForFileSystemAvailable (ctx context.Context , fileSystemId string , sizeGiB int64 ) error {
340
+ err := wait .Poll (PollCheckInterval , CalcPollTimeout (sizeGiB ), func () (done bool , err error ) {
334
341
fs , err := c .getFileSystem (ctx , fileSystemId )
335
342
if err != nil {
336
343
return true , err
@@ -352,7 +359,7 @@ func (c *cloud) WaitForFileSystemAvailable(ctx context.Context, fileSystemId str
352
359
// WaitForFileSystemResize polls the FSx API for status of the update operation with the given target storage
353
360
// capacity. The polling terminates when the update operation reaches a completed, failed, or unknown state.
354
361
func (c * cloud ) WaitForFileSystemResize (ctx context.Context , fileSystemId string , resizeGiB int64 ) error {
355
- err := wait .PollImmediate (PollCheckInterval , PollCheckTimeout , func () (done bool , err error ) {
362
+ err := wait .PollImmediate (PollCheckInterval , CalcPollTimeout ( resizeGiB ) , func () (done bool , err error ) {
356
363
updateAction , err := c .getUpdateResizeAdministrativeAction (ctx , fileSystemId , resizeGiB )
357
364
if err != nil {
358
365
return true , err
0 commit comments