Skip to content

fix idempotent nfs case and csi-sanity tests for nfs#501

Merged
JacobGros merged 15 commits into
mainfrom
grosnj1/fix-idempotent-nfs
Jun 9, 2025
Merged

fix idempotent nfs case and csi-sanity tests for nfs#501
JacobGros merged 15 commits into
mainfrom
grosnj1/fix-idempotent-nfs

Conversation

@JacobGros

@JacobGros JacobGros commented Jun 2, 2025

Copy link
Copy Markdown
Contributor

Description

When the driver gets the same CreateVolume request more than once, it should return the exact same response each time. Unfortunately, it does not return the same Volume in the CreateVolume Response when using NFS.

The first time a driver creates a NFS volume, it will return a CSI volume with the available capacity of that volume: total size - reserved size for overhead (1.5 Gb)
When the driver receives a CreateVolume request for a NFS volume that already exists, the driver will return a CSI volume with the total size of the volume, not accounting for the 1.5 Gb of overhead. This can lead to a few issues, so this PR is:

  1. Fixing the issue with idempotent CreateVolume NFS calls
  2. Adds more logging to the driver to make debugging easier
  3. Overhauling the csi-sanity scripts to make running/configuring the tests easier
  4. Several small tweaks to pass more csi-sanity tests; these changes are:
  • CreateVolume will now check SC params to determine if NFS should be used, since sanity test seems to expect the params to be enough to tell the driver which fstype to use
  • CreateVolume will check requisite topology after checking Preferred topology, since sanity test only adds requisite topology to CreateVolume request, not preferred topology (see here)
  • When source snapshot/volume cannot be found, CreateVolume will return a NotFound error code
  • When NodePublish can't find the nodeID, it will return a NotFound error code
  • During NodeUnpublish, the targetPath is now removed after unmount
  • During NodeExpandVolume, if volume is not found, it will return a NotFound error code
  • In NodeExpandVolume, moved the targetPath param check before the NFS check, to ensure the func is csi spec compliant in cases where NFS is used

GitHub Issues

List the GitHub issues impacted by this PR:

GitHub Issue #
https://github.com/dell/csm/issues/1899

Checklist:

  • I have performed a self-review of my own code to ensure there are no formatting, vetting, linting, or security issues
  • I have verified that new and existing unit tests pass locally with my changes
  • I have not allowed coverage numbers to degenerate
  • I have maintained at least 90% code coverage
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Backward compatibility is not broken

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also list any relevant details for your test configuration

  • Tested out creating and deleting a NFS volume 1000x, verified that in the idempotent cases, the size was still set correctly, results tracked internally
  • Added and ran UT
  • Ran cert-csi certify with NFS storage class, results tracked internally
  • csi-sanity tests were run with NFS, results tracked internally
  • csi-sanity tests were run with ext4, results tracked internally
Ran 68 of 92 Specs in 706.781 seconds
SUCCESS! -- 68 Passed | 0 Failed | 1 Pending | 23 Skipped

@JacobGros JacobGros marked this pull request as ready for review June 2, 2025 19:50
ChristianAtDell
ChristianAtDell previously approved these changes Jun 2, 2025
santhoshatdell
santhoshatdell previously approved these changes Jun 2, 2025
@JacobGros JacobGros dismissed stale reviews from santhoshatdell and ChristianAtDell via 754ba9e June 4, 2025 13:48
@JacobGros JacobGros changed the title fix idempotent nfs case and add UT fix idempotent nfs case and csi-sanity tests for nfs Jun 6, 2025
@alikdell

alikdell commented Jun 8, 2025

Copy link
Copy Markdown
Contributor

Thanks for making sure we return CSI Spec expected error codes!

@github-actions

github-actions Bot commented Jun 9, 2025

Copy link
Copy Markdown
Contributor

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/dell/csi-powerstore/pkg/controller 0.00% (ø)
github.com/dell/csi-powerstore/pkg/node 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/dell/csi-powerstore/pkg/controller/controller.go 0.00% (ø) 0 0 0
github.com/dell/csi-powerstore/pkg/controller/creator.go 0.00% (ø) 0 0 0
github.com/dell/csi-powerstore/pkg/controller/publisher.go 0.00% (ø) 0 0 0
github.com/dell/csi-powerstore/pkg/node/node.go 0.00% (ø) 0 0 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/dell/csi-powerstore/pkg/controller/creator_test.go
  • github.com/dell/csi-powerstore/pkg/node/node_test.go

@santhoshatdell santhoshatdell left a comment

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.

Ran cert-csi certify with NFS storage class, results tracked internally
Please run tests for block-based storage class too.

@JacobGros

Copy link
Copy Markdown
Contributor Author

Ran cert-csi certify with NFS storage class, results tracked internally Please run tests for block-based storage class too.

Tests passed, results tracked internally

@JacobGros JacobGros merged commit ddfd047 into main Jun 9, 2025
6 checks passed
@JacobGros JacobGros deleted the grosnj1/fix-idempotent-nfs branch June 9, 2025 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants