Skip to content

Set snapID to the snapshotName returned in snapInfo#492

Merged
JacobGros merged 3 commits into
mainfrom
292-fix
Mar 21, 2025
Merged

Set snapID to the snapshotName returned in snapInfo#492
JacobGros merged 3 commits into
mainfrom
292-fix

Conversation

@JacobGros

@JacobGros JacobGros commented Mar 19, 2025

Copy link
Copy Markdown
Contributor

Description

SnapID is a string name, calculated via:

snapID := fmt.Sprintf("%s%s-%d", TempSnap, s.getClusterPrefix(), time.Now().Nanosecond())

When creating a volume from a volume, we pass this string to CreateSnapshotFromVolume, and then pass the same name to LinkVolumeToSnapshot.

We assume the name returned from a snapshot created by CreateSnapshotFromVolume will still equal snapID, but this is not the case when the driver is deployed with Authorization because when auth is deployed, the snapshot gets the tenant volumePrefix added to the beginning of its name.

This causes an issue in LinkVolumeToSnapshot, because we call it with the outdated snapID name:

err = s.LinkVolumeToSnapshot(ctx, symID, vol.VolumeID, tgtDevID, snapID, reqID, isCopy, pmaxClient)

this results in an error because it cannot find the snapshot:

time="2025-03-19T15:21:27Z" level=info msg="/csi.v1.Controller/CreateVolume: REP 0747: rpc error: code = Internal desc = Failed to create volume from volume (A problem occurred modifying the snapshot resources: No snapshot information found)"

This error is apparent when creating a volume clone with the authorization module enabled.

This PR is to fix the above issue by update the snapID to the name in the snapshot created by CreateSnapshotFromVolume.

GitHub Issues

List the GitHub issues impacted by this PR:

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

Checklist:

  • Have you run format, vet & lint checks against your submission?
  • Have you made sure that the code compiles?
  • Did you run the unit & integration tests successfully?
  • Have you maintained at least 90% code coverage?
  • Have you commented your code, particularly in hard-to-understand areas
  • Have you done corresponding changes to the documentation
  • Did you run tests in a real Kubernetes cluster?
  • Backward compatibility is not broken

How Has This Been Tested?

  • ran clone volume suite with Auth, results posted internally
  • ran clone volume suite without Auth to ensure no regresion, results posted internally

@github-actions

Copy link
Copy Markdown
Contributor

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/dell/csi-powermax/service 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/dell/csi-powermax/service/snap.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-powermax/service/snap_test.go

@JacobGros JacobGros merged commit e389ffc into main Mar 21, 2025
@JacobGros JacobGros deleted the 292-fix branch March 21, 2025 15:21
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