Skip to content

[csi-manila] fixed incorrect behaviour discovered by csi-sanity test suite#730

Merged
k8s-ci-robot merged 3 commits intokubernetes:masterfrom
gman0:csimanila-csi-spec-compliance-fix
Aug 22, 2019
Merged

[csi-manila] fixed incorrect behaviour discovered by csi-sanity test suite#730
k8s-ci-robot merged 3 commits intokubernetes:masterfrom
gman0:csimanila-csi-spec-compliance-fix

Conversation

@gman0
Copy link
Copy Markdown
Contributor

@gman0 gman0 commented Aug 20, 2019

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:

  • missing 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 PR fixes the issues mentioned above and cleans up the codebase a bit

Release note:

NONE

* 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
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 20, 2019
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 20, 2019
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 20, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 20, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 20, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 20, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 20, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 20, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 20, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 20, 2019

Build succeeded.

@gman0
Copy link
Copy Markdown
Contributor Author

gman0 commented Aug 20, 2019

Copy link
Copy Markdown
Contributor

@gouthampacha gouthampacha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, LGTM

Copy link
Copy Markdown
Contributor

@tombarron tombarron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha ha, those tests catch stuff :)

LGTM

@adisky
Copy link
Copy Markdown
Contributor

adisky commented Aug 21, 2019

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 21, 2019
Comment thread pkg/csi/manila/controllerserver.go Outdated

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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Comment thread pkg/csi/manila/controllerserver.go Outdated
}

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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also, shouldn't it be codes.Internal?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InvalidArgument, is sent when something is missing in request from CO or request arguments not adhering to CSI specs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

https://github.com/grpc/grpc-go/blob/3bb34e5324978dca98dea479160fe5f434d0f960/codes/codes.go#L78-L97

@gman0
Copy link
Copy Markdown
Contributor Author

gman0 commented Aug 21, 2019

@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.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@adisky
Copy link
Copy Markdown
Contributor

adisky commented Aug 21, 2019

@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.

@gman0 actually based on return error codes CO performs next actions like retry/abort

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

@gman0
Copy link
Copy Markdown
Contributor Author

gman0 commented Aug 21, 2019

@adisky yup i know but i'd imagine INTERNAL and FAILED_PRECONDITION would have similar behavior (i.e. abort), likewise INVALID_ARGUMENT and UNAVAILABLE (retry when ready)...leaning on the conservative side, abort seems safer (internal/failed precondition)

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@gman0
Copy link
Copy Markdown
Contributor Author

gman0 commented Aug 21, 2019

Although an explicit status check could be added

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@gman0
Copy link
Copy Markdown
Contributor Author

gman0 commented Aug 21, 2019

@adisky PTAL

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@gman0
Copy link
Copy Markdown
Contributor Author

gman0 commented Aug 21, 2019

When validating share/snapshot states, transient creating status will now cause UNAVAILABLE error code, any other share/snapshot status will result in FAILED_PRECONDITION error code (unless it's available :) ).

Note that invalid states detected during share/snapshot creation are still considered as INTERNAL errors.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 21, 2019

Build succeeded.

@adisky
Copy link
Copy Markdown
Contributor

adisky commented Aug 22, 2019

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 22, 2019
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 22, 2019
@k8s-ci-robot k8s-ci-robot merged commit 6788416 into kubernetes:master Aug 22, 2019
Comment thread pkg/csi/manila/util.go
return manilaErrorMessage{message: "unknown error"}, nil
}

func isManilaErrNotFound(err error) bool {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out! Will update

return nil, status.Errorf(codes.InvalidArgument, "invalid OpenStack secrets: %v", err)
}

volID := volumeID(req.GetVolumeId())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to check if specified volume exists or not here also?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...which returns INVALID_ARGUMENT if it fails to retrieve the share - this is of course not correct. I'll fix this as well

powellchristoph pushed a commit to powellchristoph/cloud-provider-openstack that referenced this pull request Jan 19, 2022
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants