Skip to content

Fixed DeleteVolume with remaining host access#320

Merged
alexemc merged 6 commits into
mainfrom
usr/babija/delete-volume-fix
Jun 25, 2025
Merged

Fixed DeleteVolume with remaining host access#320
alexemc merged 6 commits into
mainfrom
usr/babija/delete-volume-fix

Conversation

@alexemc
Copy link
Copy Markdown
Contributor

@alexemc alexemc commented Jun 24, 2025

Description

This PR addresses a race condition in the CSI driver's DeleteVolume handler caused by delayed host access updates in the Unity array.

When ControllerPublishVolume sends a host access request to the array, the Unity API may respond slowly. If Kubernetes times out and cancels the request before the array completes the operation, the array may still proceed to add host access in the background.

Subsequently, ControllerUnpublishVolume may run and succeed because the host access hasn't appeared yet. However, by the time DeleteVolume is called, the host access might have been added, causing the array to reject the volume deletion. Kubernetes, unaware of this intermediate state, retries the deletion repeatedly with the same failure.

To resolve this, the DeleteVolume handler now checks for and removes any existing host access before attempting to delete the volume.

GitHub Issues

List the GitHub issues impacted by this PR:

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

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?

@alexemc alexemc changed the title Usr/babija/delete volume fix Fixed DeleteVolume with remaining host access Jun 24, 2025
@github-actions
Copy link
Copy Markdown
Contributor

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/dell/csi-unity/service 86.25% (+0.23%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/dell/csi-unity/service/controller.go 87.14% (+0.72%) 1050 (+41) 915 (+43) 135 (-2) 👍

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-unity/service/controller_test.go

@alexemc alexemc merged commit 9c268e0 into main Jun 25, 2025
6 checks passed
@alexemc alexemc deleted the usr/babija/delete-volume-fix branch June 25, 2025 18: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.

3 participants