Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix context handling in WaitForVolumeAttachment & add in-flight checks to attachment/detachment operations #1621

Merged
merged 1 commit into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/cloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ func (c *cloud) WaitForAttachmentState(ctx context.Context, volumeID, expectedSt

var attachment *ec2.VolumeAttachment

verifyVolumeFunc := func() (bool, error) {
verifyVolumeFunc := func(ctx context.Context) (bool, error) {
request := &ec2.DescribeVolumesInput{
VolumeIds: []*string{
aws.String(volumeID),
Expand Down Expand Up @@ -710,11 +710,11 @@ func (c *cloud) WaitForAttachmentState(ctx context.Context, volumeID, expectedSt
return true, nil
}
// continue waiting
klog.V(2).InfoS("Waiting for volume state", "volumeID", volumeID, "actual", attachmentState, "desired", expectedState)
klog.V(4).InfoS("Waiting for volume state", "volumeID", volumeID, "actual", attachmentState, "desired", expectedState)
torredil marked this conversation as resolved.
Show resolved Hide resolved
return false, nil
}

return attachment, wait.ExponentialBackoff(backoff, verifyVolumeFunc)
return attachment, wait.ExponentialBackoffWithContext(ctx, backoff, verifyVolumeFunc)
}

func (c *cloud) GetDiskByName(ctx context.Context, name string, capacityBytes int64) (*Disk, error) {
Expand Down
Loading