Skip to content

[cinder-csi-plugin] reject non-multiattach publish on another node#3115

Open
gnom4ik wants to merge 1 commit into
kubernetes:masterfrom
gnom4ik:cinder-single-node-publish-guard
Open

[cinder-csi-plugin] reject non-multiattach publish on another node#3115
gnom4ik wants to merge 1 commit into
kubernetes:masterfrom
gnom4ik:cinder-single-node-publish-guard

Conversation

@gnom4ik
Copy link
Copy Markdown

@gnom4ik gnom4ik commented May 19, 2026

What this PR does / why we need it:

This fixes non-multiattach Cinder volume publish behavior when the volume is already attached to a different node.

Before this change, AttachVolume treated an existing attachment as idempotent only when it was already attached to the requested instance. For a non-multiattach volume attached to another instance, the driver still attempted a new Nova volume attach. In some OpenStack environments this can leave the volume with the old attached entry and an additional attaching entry for the new node.

This change makes the driver return FailedPrecondition before calling Nova attach when a non-multiattach volume already has an attachment to another node. ControllerPublishVolume now preserves that gRPC status code instead of wrapping it as Internal.

Which issue this PR fixes(if applicable):

None

Special notes for reviewers:

Tested against a real OpenStack-backed Kubernetes cluster (training) with a patched cinder-csi-plugin controller image.

Verification scenario:

  1. Created a PVC backed by Cinder.
  2. Started a pod using the PVC on one worker node and confirmed the volume was attached.
  3. Manually created a second VolumeAttachment for the same PV targeting another worker node.
  4. Confirmed the second publish failed with FailedPrecondition.
  5. Confirmed OpenStack kept only the original attachment and did not create a second attaching attachment.
  6. Deleted the test pod/PVC and confirmed the volume detached and was cleaned up.

Local tests:

  • go test ./pkg/csi/cinder/openstack
  • go test ./pkg/csi/cinder -run 'TestControllerPublishVolume|TestControllerPublishVolumePreservesFailedPrecondition'

Note: go test ./pkg/csi/cinder/... was not fully runnable on macOS arm64 because an existing node expansion test depends on block-device functionality that is not implemented for Darwin.

Release note:

[cinder-csi-plugin] Return FailedPrecondition when publishing a non-multiattach Cinder volume that is already attached to another node.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label May 19, 2026
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 19, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: gnom4ik / name: Alexey Pashkin (a8ed9c1)

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Welcome @gnom4ik!

It looks like this is your first PR to kubernetes/cloud-provider-openstack 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/cloud-provider-openstack has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 19, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @gnom4ik. 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-sigs/prow repository.

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zetaab for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 requested review from kayrus and stephenfin May 19, 2026 11:42
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 19, 2026
@gnom4ik
Copy link
Copy Markdown
Author

gnom4ik commented May 19, 2026

This PR has local unit test coverage and was also verified against a real OpenStack-backed Kubernetes cluster.

Tested:

  • go test ./pkg/csi/cinder/openstack
  • go test ./pkg/csi/cinder -run 'TestControllerPublishVolume|TestControllerPublishVolumePreservesFailedPrecondition'

Manual verification:

  • Created a Cinder-backed PVC.
  • Attached it to one worker through a pod.
  • Created a second VolumeAttachment for the same PV targeting another worker.
  • Confirmed ControllerPublishVolume returned FailedPrecondition.
  • Confirmed OpenStack kept only the original attachment and did not create a second attaching attachment.

Could a Kubernetes org member please run /ok-to-test?

@gnom4ik gnom4ik changed the title fix(cinder): reject non-multiattach publish on another node [cinder-csi-plugin] reject non-multiattach publish on another node May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

2 participants