[csi-manila] fixed incorrect behaviour discovered by csi-sanity test suite#730
Conversation
* implemented ValidateVolumeCapabilities in Controller Plugin
* validateNode{Unstage,Unpublish}Request functions were missing checks for empty staging/target paths
* verifySnapshotCompatibility's check for source volume ID was incorrect
this commit fixes the issues mentioned above and cleans up the codebase a bit
|
Hi @gman0. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
tombarron
left a comment
There was a problem hiding this comment.
Ha ha, those tests catch stuff :)
LGTM
|
/ok-to-test |
|
|
||
| if sourceShare, res.err = manilaClient.GetShareByID(req.GetSourceVolumeId()); res.err != nil { | ||
| if isManilaErrNotFound(res.err) { | ||
| return nil, status.Errorf(codes.InvalidArgument, "failed to create a snapshot (%s) for share %s because the share doesn't exist: %v", req.GetName(), req.GetSourceVolumeId(), err) |
There was a problem hiding this comment.
codes.InvalidArgument? shouldn't it be codes.NotFound
| return nil, status.Errorf(codes.DeadlineExceeded, "deadline exceeded while waiting for snapshot %s of share %s to become available", snapshot.ID, req.GetSourceVolumeId()) | ||
| } | ||
|
|
||
| if isManilaErrNotFound(res.err) { |
| } | ||
|
|
||
| if share.Status != shareAvailable { | ||
| return nil, status.Errorf(codes.InvalidArgument, "share %s is in an unexpected state: wanted %s, got %s", share.ID, shareAvailable, share.Status) |
There was a problem hiding this comment.
here also, shouldn't it be codes.Internal?
There was a problem hiding this comment.
InvalidArgument, is sent when something is missing in request from CO or request arguments not adhering to CSI specs
There was a problem hiding this comment.
Actually, FAILED_PRECONDITION or UNAVAILABLE seem to come even closer to describing this particular error. The status mismatch might be just a transient error (i.e. when the share is still in creating state).
|
@adisky thank you for your feedback! I've left a comment on your review above but it doesn't make all that much of a difference so i've worked in all the changes you suggested. |
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
|
Build failed.
|
|
@adisky yup i know but i'd imagine |
|
Build succeeded.
|
|
Although an explicit status check could be added |
|
Build succeeded.
|
|
@adisky PTAL |
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
|
When validating share/snapshot states, transient Note that invalid states detected during share/snapshot creation are still considered as |
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
|
Build succeeded.
|
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adisky The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| return manilaErrorMessage{message: "unknown error"}, nil | ||
| } | ||
|
|
||
| func isManilaErrNotFound(err error) bool { |
There was a problem hiding this comment.
we already have IsNotFound error defined here , you can reuse it the same https://github.com/kubernetes/cloud-provider-openstack/blob/master/pkg/util/errors/errors.go#L25
There was a problem hiding this comment.
Thanks for pointing this out! Will update
| return nil, status.Errorf(codes.InvalidArgument, "invalid OpenStack secrets: %v", err) | ||
| } | ||
|
|
||
| volID := volumeID(req.GetVolumeId()) |
There was a problem hiding this comment.
we need to check if specified volume exists or not here also?
There was a problem hiding this comment.
It's already being checked in buildVolumeContext function:
https://github.com/gman0/cloud-provider-openstack/blob/4d0ef767cfb92359a7e42e2ecb7eb70e8d55caf7/pkg/csi/manila/nodeserver.go#L49-L71
There was a problem hiding this comment.
...which returns INVALID_ARGUMENT if it fails to retrieve the share - this is of course not correct. I'll fix this as well
…suite (kubernetes#730) * fixed incorrect behaviour discovered by csi-sanity test suite * implemented ValidateVolumeCapabilities in Controller Plugin * validateNode{Unstage,Unpublish}Request functions were missing checks for empty staging/target paths * verifySnapshotCompatibility's check for source volume ID was incorrect this commit fixes the issues mentioned above and cleans up the codebase a bit * addressed review comments: fixed error codes * added explicit status checks for shares and snapshots
What this PR does / why we need it:
Part of #714
Continuing in an effort of integrating the csi-sanity test suite into CSI Manila, this is the third patch out of 4:
While testing the driver against the csi-sanity test suite, following errors were found:
this PR fixes the issues mentioned above and cleans up the codebase a bit
Release note: