-
Notifications
You must be signed in to change notification settings - Fork 807
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 Incorrect Error Handling for Volumes in Optimizing State #1833
Fix Incorrect Error Handling for Volumes in Optimizing State #1833
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not attempting to start a modification when a volume is in the OPTIMIZING state is intentional
Why are we validating this in our driver instead of relying on the EC2 API? Won't EC2 ModifyVolume error out on this case? |
By my understanding not starting a modification if the volume is already in the desired state would be a more appropriate check, could you elaborate? |
Because it produces spurious failed API calls. A volume in the OPTIMIZING state cannot be modified, attempting to make an API call is 100% guaranteed to fail. It produces additional unnecessary load on the AWS API in a case that we can 100% prevent.
The appropriate fix here is that this check should not be running until we are sure we need to make a modification. Removing an entire block of checks is not the appropriate fix for this bug. |
If we really want to prevent an extra ModifyVolume API call, I think the most appropriate check would be something along the lines of:
|
Agree that would work, but I think the simplest fix given the existing code is just to move this
|
Signed-off-by: Eddie Torres <[email protected]>
71ec102
to
3f02221
Compare
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AndrewSirenko The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Is this a bug fix or adding new feature?
Bug
What is this PR about? / Why do we need it?
This PR fixes a bug where an error is incorrectly returned if a volume is in an optimizing state.
According to cloud, a modification is considered done if the volume is an
optimizing
state:aws-ebs-csi-driver/pkg/cloud/cloud.go
Lines 1320 to 1323 in d071db8
In the case where
ResizeOrModifyDisk
hasn't been previously called for a volume, we simply move on to check if the volume is in the desired state. If it is,ResizeOrModifyDisk
succeeds even if the volume is stilloptimizing
. However, ifcheckDesiredState
returns an error or the sidecar times out, latestMod won't be nil the second time around and we error out if the volume isoptimizing
:aws-ebs-csi-driver/pkg/cloud/cloud.go
Lines 1298 to 1300 in d071db8
What testing is done?
make test