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

[cinder-csi-plugin] support "multiattach" volume type #1073

Merged
merged 1 commit into from
Sep 8, 2020

Conversation

ramineni
Copy link
Contributor

@ramineni ramineni commented May 22, 2020

What this PR does / why we need it:
When the type of the volume is of "multiattach", it can be attached to multiple instances.
Currently type of the volume can be specified as part of parameters['type'] of storageclass , https://github.com/kubernetes/cloud-provider-openstack/blob/master/pkg/csi/cinder/controllerserver.go#L63
This PR enables the same for multiattach type as well .
Which issue this PR fixes(if applicable):
fixes #729

Special notes for reviewers:

Specify the 'type' as 'multiattach' in storageclass as specified in example doc.
type should exist in backend.

Release note:

[cinder-csi-plugin] Support to attach a volume to multiple instances if ‘multiattach’ flag is enabled in Cinder volume type.

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 22, 2020
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 22, 2020
@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2020

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2020

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 26, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 26, 2020

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 26, 2020

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 26, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 26, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 26, 2020

Build succeeded.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 10, 2020
@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 10, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 10, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 10, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 10, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 10, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 10, 2020

Build failed.

@ramineni
Copy link
Contributor Author

/test cloud-provider-openstack-multinode-csi-migration-test

@k8s-ci-robot
Copy link
Contributor

@ramineni: The specified target(s) for /test were not found.
The following commands are available to trigger jobs:

  • /test pull-cloud-provider-openstack-check
  • /test pull-cloud-provider-openstack-test

Use /test all to run all jobs.

In response to this:

/test cloud-provider-openstack-multinode-csi-migration-test

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

@wangxiyuan: The specified target(s) for /test were not found.
The following commands are available to trigger jobs:

  • /test pull-cloud-provider-openstack-check
  • /test pull-cloud-provider-openstack-test

Use /test all to run all jobs.

In response to this:

/test cloud-provider-openstack-acceptance-test-csi-cinder

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.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Aug 26, 2020

Build succeeded.

Copy link
Contributor

@lingxiankong lingxiankong left a comment

Choose a reason for hiding this comment

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

Do we need to change here https://github.com/kubernetes/cloud-provider-openstack/blob/master/pkg/csi/cinder/driver.go#L84? If yes, how we could give the csi driver deployer the ability to define if the MULTI_NODE_MULTI_WRITER access mode is supported?

name: csi-sc-cinderplugin
provisioner: cinder.csi.openstack.org
parameters:
type: multiattach
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering why it's related to volume type? I thought it's related to accessModes when defining PersistentVolumeClaim.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lingxiankong right , there are 2 ways of doing it (either way creating volume type is required if we need to attach to more than one node)

  1. Support automatically create volume type of multiattach , depending on the access modes that are specified in pvc (ReadWriteMany, ReadOnlyMany..).
  2. Use the existing field of volume type we already support and create volume of that type.

So, in the initial support we provide in k8s, I thought it would be better to leave it for operator if they really would like to create the volume of type multiattach,(understanding their limitations ) instead of creating it automatically for them which might cause issues later on .

https://docs.openstack.org/cinder/latest/admin/blockstorage-volume-multiattach.html#ro-rw-caveats-the-secondary-rw-attachment-issue .

Copy link
Contributor

Choose a reason for hiding this comment

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

So is accessModes actually supported in cinder-csi? Is there any difference when user specifies ReadWriteOnce and ReadWriteMany?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think leave to operator to decide is a better option here..
if customer has requirement on option 1) above, we can consider it later on

@ramineni ramineni changed the title [cinder-csi-plugin] support multi-node attachments [cinder-csi-plugin] support "multiattach" volume type Sep 2, 2020
@@ -151,7 +155,7 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
return nil, status.Error(codes.Internal, fmt.Sprintf("DeleteVolume failed with error %v", err))
Copy link
Contributor

Choose a reason for hiding this comment

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

as you change the log from InfoF to error at line 130, maybe consider to update 154 as well

}
return "", fmt.Errorf("disk %q is attached to a different compute: %q, should be detached before proceeding", volumeID, volume.Attachments[0].ServerID)
return "", fmt.Errorf("disk %q is not attached to compute: %q", volumeID, instanceID)
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure this compute is valid ? seems this is virtual machine ? or guest ?
at least compute make me think about compute node...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, its compute node

Copy link
Contributor

@lingxiankong lingxiankong left a comment

Choose a reason for hiding this comment

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

IIUC, supporting multi-attach is kind of transparent to the end users, right? The requirements are:

  • The openstack cloud admin creates a multiattach enabled volume type.
  • The k8s cluster admin creates a storage class with that volume type.

@@ -434,6 +434,24 @@ Following prerequisites needed for volume cloning to work :

Sample yamls can be found [here](https://github.com/kubernetes/cloud-provider-openstack/tree/master/examples/cinder-csi-plugin/clone)

### Multi-Attach Volumes

To avail the multiattach feature of cinder, specify the 'type' of the volume as 'multiattach' in storageclass definition.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sounds like a volume type named multiattach must exist in Cinder, but actually what we need is a volume type which enables multiattach in its extra-spec capability. We should make it clear for end users.

Copy link
Contributor

Choose a reason for hiding this comment

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

this is a good suggestion,

Starting from the Queens release the ability to attach a volume to multiple hosts/servers requires that the volume is of a special type that includes an extra-spec capability setting of multiattach=<is> True. You can create the volume type the following way: reflect your suggestion

name: csi-sc-cinderplugin
provisioner: cinder.csi.openstack.org
parameters:
type: multiattach
Copy link
Contributor

Choose a reason for hiding this comment

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

So is accessModes actually supported in cinder-csi? Is there any difference when user specifies ReadWriteOnce and ReadWriteMany?

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 4, 2020
@ramineni
Copy link
Contributor Author

ramineni commented Sep 4, 2020

IIUC, supporting multi-attach is kind of transparent to the end users, right? The requirements are:

  • The openstack cloud admin creates a multiattach enabled volume type.
  • The k8s cluster admin creates a storage class with that volume type.

Correct

So is accessModes actually supported in cinder-csi? Is there any difference when user specifies ReadWriteOnce and ReadWriteMany?

accessModes specify the capabilities that should be supported by volume , right now, unless he specify explicit volume type of multiattach , there is no affect of that

@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 4, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 4, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 4, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 4, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 4, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 4, 2020

Build succeeded.

@lingxiankong
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 7, 2020
@ramineni
Copy link
Contributor Author

ramineni commented Sep 8, 2020

@jichenjc PTAL

@jichenjc
Copy link
Contributor

jichenjc commented Sep 8, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jichenjc

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 /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 Sep 8, 2020
@k8s-ci-robot k8s-ci-robot merged commit 9fad047 into kubernetes:master Sep 8, 2020
@ekeih
Copy link

ekeih commented Nov 17, 2020

@ramineni Thanks for implementing this. As you did this, I assume that you also use this in production in some capacity. Are you able to share some insights how you manage a cluster filesystem ontop of this?

@baurmatt
Copy link

Did anyone managed to run this in production with k8s creating the cluster filesystem on the attached volume?

powellchristoph pushed a commit to powellchristoph/cloud-provider-openstack that referenced this pull request Jan 19, 2022
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. 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.

Support Multinode attachement Cinder CSI
7 participants