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

[manila-csi-plugin] snapshot caps check #1592

Merged
merged 6 commits into from
Aug 12, 2021

Conversation

gman0
Copy link
Member

@gman0 gman0 commented Jul 9, 2021

What this PR does / why we need it:
This PR removes hard-coded checks for CephFS shares, preventing them from being snapshotted. Instead, share type capabilities are checked and creating snapshots is accepted or denied based on that.

Which issue this PR fixes(if applicable):
fixes #720

We've abandoned the original idea described in #720. Since Manila supports snapshot restoration with CephFS backends since the Wallaby release, we're going with that instead.

Release note:

[manila-csi-plugin] Added support for snapshot and snapshot restore of CephFS shares where backends support it

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jul 9, 2021
@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. labels Jul 9, 2021
@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 9, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 9, 2021

Build succeeded.


for _, c := range requiredShareTypeCaps {
if !shareTypeCaps[c] {
return nil, status.Errorf(codes.InvalidArgument,
Copy link
Member Author

Choose a reason for hiding this comment

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

The main objective here is to ensure that it will be possible to create a new volume with this snapshot as its source and I'm not sure I'm going the right way about this.

Is it possible to create a share from a snapshot, but using a share type that's different than what was used to create the original share? If so, then checking share type caps here doesn't make much sense -- because maybe one type had create_share_from_snapshot_support disabled, but the other may have it enabled and share creation would succeed.

From my tests, it seems the caps on the share (not on the share type) seemed to have the final say. Even if I tried to create a share from snapshot with a type that had create_share_from_snapshot_support=True, Manila would refuse to create it if the original share reported create_share_from_snapshot_support=False. Unfortunately, there's no way for manila-csi to know at the moment. The gophercloud lib is currently missing create_share_from_snapshot_support field in shares.Share struct. I'll push a patch there. I'm not entirely sure we should merge this PR without it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@gman0: no you can't specify both snapshot and share type when creating new shares; new shares from snapshots are expected to retain the share type of the parent;

and yes, the capability of the share is the best place to look since share type extra specs are mutable. While share type extra-specs are mutable, they're assumed to not change often and manila administrators know that changes aren't going to apply to resources that are already provisioned. However, i totally agree with not relying on the share type extra-specs.

your proposed way of just checking the share's "snapshot_support" and "create_share_from_snapshot_support" seems correct.

Copy link
Member Author

Choose a reason for hiding this comment

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

@gouthampacha thank you for explanation and suggestions! I'll fix this like we've agreed after the create_share_from_snapshot_support patch in gophercloud is in.

@gman0
Copy link
Member Author

gman0 commented Jul 9, 2021

PTAL @tombarron @gouthampacha

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 9, 2021

Build succeeded.

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

Thanks for the changes @gman0


for _, c := range requiredShareTypeCaps {
if !shareTypeCaps[c] {
return nil, status.Errorf(codes.InvalidArgument,
Copy link
Contributor

Choose a reason for hiding this comment

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

@gman0: no you can't specify both snapshot and share type when creating new shares; new shares from snapshots are expected to retain the share type of the parent;

and yes, the capability of the share is the best place to look since share type extra specs are mutable. While share type extra-specs are mutable, they're assumed to not change often and manila administrators know that changes aren't going to apply to resources that are already provisioned. However, i totally agree with not relying on the share type extra-specs.

your proposed way of just checking the share's "snapshot_support" and "create_share_from_snapshot_support" seems correct.

@@ -75,7 +90,7 @@ func getOrCreateShare(shareName string, createOpts *shares.CreateOpts, manilaCli
return share, 0, nil
}

return waitForShareStatus(share.ID, shareCreating, shareAvailable, false, manilaClient)
return waitForShareStatus(share.ID, []string{shareCreating, shareCreatingFromSnapshot}, shareAvailable, false, manilaClient)
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome!

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this looks right. (@gouthampacha reminded me yesterday)

Copy link
Member Author

@gman0 gman0 Jul 22, 2021

Choose a reason for hiding this comment

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

Thank you both! I'll update this PR once I find out how do we go about updating the gophercloud lib dependency.

@gman0
Copy link
Member Author

gman0 commented Jul 22, 2021

Do we wait for new release of gophercloud or is it ok if I pin the gophercloud dependency to a particular commit @lingxiankong @ramineni (see #1592 (comment) )? I'd like this feature to still make it for v1.22 if possible

@ramineni
Copy link
Contributor

Do we wait for new release of gophercloud or is it ok if I pin the gophercloud dependency to a particular commit @lingxiankong @ramineni (see #1592 (comment) )? I'd like this feature to still make it for v1.22 if possible

@gman0 we can pin to particular commit , I dont see any issue in that.
But when is the new release planned?

@gman0
Copy link
Member Author

gman0 commented Jul 22, 2021

Thanks @ramineni . I just asked Gophercloud's Joe Topjian to find out whether v0.19.0 is planned still this month. It seems releases are 1 month apart, and the last one was 11th of June -- so maybe the next one is coming very soon? If it's not soon enough I'll pin the dependency to the commit from the PR linked earlier.

…share

This commit removes all hard-coded checks for CephFS shares,
preventing them from being snapshotted. Instead, manila-csi
now checks for snapshot_support and create_share_from_snapshot
capabilities.
@gman0 gman0 force-pushed the manilacsi-snapshot-caps-check branch from 89e7d55 to b54ea0e Compare July 23, 2021 14:14
@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 23, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 23, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 23, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 23, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 23, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 23, 2021

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 23, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 23, 2021

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 23, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 23, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 23, 2021

Build succeeded.

@gman0
Copy link
Member Author

gman0 commented Jul 26, 2021

/test openlab/cloud-provider-openstack-e2e-test-csi-cinder

@k8s-ci-robot
Copy link
Contributor

@gman0: 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 openlab/cloud-provider-openstack-e2e-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.

@gman0
Copy link
Member Author

gman0 commented Jul 26, 2021

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

@k8s-ci-robot
Copy link
Contributor

@gman0: 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 openlab/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.

@gman0
Copy link
Member Author

gman0 commented Jul 26, 2021

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

@k8s-ci-robot
Copy link
Contributor

@gman0: 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-e2e-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.

@gman0
Copy link
Member Author

gman0 commented Jul 26, 2021

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

@k8s-ci-robot
Copy link
Contributor

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

@gman0
Copy link
Member Author

gman0 commented Jul 27, 2021

Jobs cloud-provider-openstack-e2e-test-csi-cinder and cloud-provider-openstack-multinode-csi-migration-test are stuck. I don't think it's caused by this PR.

@gman0
Copy link
Member Author

gman0 commented Jul 27, 2021

I've updated the caps checks like we've agreed. @tombarron @gouthampacha could you please take a look? @ramineni I'm not sure about the failing jobs. I think I've seen these ones failing in other PRs too... Is that a blocker for this PR?

@tombarron
Copy link
Contributor

/lgtm
/approve
But there are files here outside pkg/csi/manila so these are just for the record.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 27, 2021
Copy link
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.

/lgtm
/assign @ramineni

Thank you @gman0

@ramineni
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ramineni, tombarron

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 Jul 28, 2021
@gman0
Copy link
Member Author

gman0 commented Jul 28, 2021

Thank you all for feedback! @ramineni your approval didn't trigger a merge so I guess that will happen once CI passes?

@ramineni
Copy link
Contributor

ramineni commented Aug 9, 2021

@gman0 looks like gate resolution might take some time. Only change is gophercloud update which would effect the cinder plugin . I hope no breaking changes which would effect the plugin . Though looks safe to me to merge, If you have setup, could you quickly run e2e on cinder csi manually , so that we can override and go ahead with the merge.

@gman0
Copy link
Member Author

gman0 commented Aug 11, 2021

@ramineni

I manually deployed examples/cinder-csi-plugin/nginx.yaml that's used by cinder-csi's acceptance test. I can supply more info if you need.

  1. Checked-out branch from this PR
  2. make image-cinder-csi-plugin
  3. Customized cloud-provider-openstack/charts/cinder-csi-plugin/values.yaml accordingly, along with changes to img repo&tag and cloud-config secret.
$ kubectl get all | grep cinder
pod/openstack-cinder-csi-controllerplugin-0        6/6     Running   0          4m26s
pod/openstack-cinder-csi-nodeplugin-8pq6s          3/3     Running   0          4m26s
service/openstack-cinder-csi-controllerplugin      ClusterIP   None         <none>        <none>      4m26s
daemonset.apps/openstack-cinder-csi-nodeplugin      1         1         1       1            1           <none>          4m26s
statefulset.apps/openstack-cinder-csi-controllerplugin      1/1     4m27s
$ kubectl create -f examples/cinder-csi-plugin/nginx.yaml 
storageclass.storage.k8s.io/csi-sc-cinderplugin created
persistentvolumeclaim/csi-pvc-cinderplugin created
pod/nginx created
$ openstack volume list
+--------------------------------------+------------------------------------------+--------+------+-----------------------------------------+
| ID                                   | Name                                     | Status | Size | Attached to                             |
+--------------------------------------+------------------------------------------+--------+------+-----------------------------------------+
| 3594c5db-a6f6-4142-a022-767279cfe944 | pvc-6045e704-08b5-4b12-8b66-b01ad43b3339 | in-use |    1 | Attached to rvasek-k8s-dev on /dev/vdb  |
+--------------------------------------+------------------------------------------+--------+------+-----------------------------------------+
$ openstack volume show 3594c5db-a6f6-4142-a022-767279cfe944
+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field                        | Value                                                                                                                                                                                                                                                                                                     |
+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| attachments                  | [{'id': '3594c5db-a6f6-4142-a022-767279cfe944', 'attachment_id': 'e02b7f79-271d-436c-8afc-a8742283ad2c', 'volume_id': '3594c5db-a6f6-4142-a022-767279cfe944', 'server_id': 'bb3dd693-6af5-459b-b69e-d1d0a9104125', 'host_name': None, 'device': '/dev/vdb', 'attached_at': '2021-08-11T14:57:43.000000'}] |
| availability_zone            | nova                                                                                                                                                                                                                                                                                                      |
| bootable                     | false                                                                                                                                                                                                                                                                                                     |
| consistencygroup_id          | None                                                                                                                                                                                                                                                                                                      |
| created_at                   | 2021-08-11T14:57:00.000000                                                                                                                                                                                                                                                                                |
| description                  | Created by OpenStack Cinder CSI driver                                                                                                                                                                                                                                                                    |
| encrypted                    | False                                                                                                                                                                                                                                                                                                     |
| id                           | 3594c5db-a6f6-4142-a022-767279cfe944                                                                                                                                                                                                                                                                      |
| multiattach                  | False                                                                                                                                                                                                                                                                                                     |
| name                         | pvc-6045e704-08b5-4b12-8b66-b01ad43b3339                                                                                                                                                                                                                                                                  |
| os-vol-tenant-attr:tenant_id | ce8c897f-6252-4454-b1cc-bfee7d447572                                                                                                                                                                                                                                                                      |
| properties                   | cinder.csi.openstack.org/cluster='kubernetes', csi.storage.k8s.io/pv/name='pvc-6045e704-08b5-4b12-8b66-b01ad43b3339', csi.storage.k8s.io/pvc/name='csi-pvc-cinderplugin', csi.storage.k8s.io/pvc/namespace='default'                                                                                      |
| replication_status           | None                                                                                                                                                                                                                                                                                                      |
| size                         | 1                                                                                                                                                                                                                                                                                                         |
| snapshot_id                  | None                                                                                                                                                                                                                                                                                                      |
| source_volid                 | None                                                                                                                                                                                                                                                                                                      |
| status                       | in-use                                                                                                                                                                                                                                                                                                    |
| type                         | standard                                                                                                                                                                                                                                                                                                  |
| updated_at                   | 2021-08-11T14:57:44.000000                                                                                                                                                                                                                                                                                |
| user_id                      | rvasek                                                                                                                                                                                                                                                                                                    |
+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
$  kubectl get pod nginx
NAME    READY   STATUS    RESTARTS   AGE
nginx   1/1     Running   0          3m22s

Clean up was successful too.

@ramineni
Copy link
Contributor

ramineni commented Aug 12, 2021

@gman0 Thanks.
@lingxiankong @jichenjc Overriding jobs , change doesnt effect much on cinder-csi . Basic tests have been done by @gman0 .
All Manila jobs have been passed.

@ramineni
Copy link
Contributor

/override openlab/cloud-provider-openstack-e2e-test-csi-cinder

@k8s-ci-robot
Copy link
Contributor

@ramineni: Overrode contexts on behalf of ramineni: openlab/cloud-provider-openstack-e2e-test-csi-cinder

In response to this:

/override openlab/cloud-provider-openstack-e2e-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.

@ramineni
Copy link
Contributor

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

@k8s-ci-robot
Copy link
Contributor

@ramineni: Overrode contexts on behalf of ramineni: openlab/cloud-provider-openstack-multinode-csi-migration-test

In response to this:

/override openlab/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 k8s-ci-robot merged commit 2bdbd8a into kubernetes:master Aug 12, 2021
pierreprinetti pushed a commit to shiftstack/cloud-provider-openstack that referenced this pull request Aug 23, 2021
* go.mod: bumped github.com/gophercloud/gophercloud to v0.19.0

* removed hardcoded checks for cephfs, added checks for caps in parent share

This commit removes all hard-coded checks for CephFS shares,
preventing them from being snapshotted. Instead, manila-csi
now checks for snapshot_support and create_share_from_snapshot
capabilities.

* share: added handling for creating_from_snapshot status

* docs: added a note about snapshots

* go.sum: added k8s.io/code-generator

* go.mod fix 2: added github.com/gophercloud/gophercloud v0.19.0
powellchristoph pushed a commit to powellchristoph/cloud-provider-openstack that referenced this pull request Jan 19, 2022
* go.mod: bumped github.com/gophercloud/gophercloud to v0.19.0

* removed hardcoded checks for cephfs, added checks for caps in parent share

This commit removes all hard-coded checks for CephFS shares,
preventing them from being snapshotted. Instead, manila-csi
now checks for snapshot_support and create_share_from_snapshot
capabilities.

* share: added handling for creating_from_snapshot status

* docs: added a note about snapshots

* go.sum: added k8s.io/code-generator

* go.mod fix 2: added github.com/gophercloud/gophercloud v0.19.0
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.

[Manila CSI] add support for CephFS snapshots
5 participants