Skip to content

[VMOwnedVolumes][Draft] Completion gaps- UnregisterVolumeEx and additional tests#4060

Open
deepakkinni wants to merge 8 commits into
kubernetes-sigs:masterfrom
deepakkinni:topic/dk016388/vmown-csi-phase-5-and-6
Open

[VMOwnedVolumes][Draft] Completion gaps- UnregisterVolumeEx and additional tests#4060
deepakkinni wants to merge 8 commits into
kubernetes-sigs:masterfrom
deepakkinni:topic/dk016388/vmown-csi-phase-5-and-6

Conversation

@deepakkinni
Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:

Critical Functional Gap

The greenfield attach path uses UnregisterVolume (old single-phase API) instead of UnregisterVolumeEx (new two-phase API with PENDING_UNREGISTER + ACK). The spec (Section 7.3, A.3/A.4) requires the two-phase commit model where:

  • A.3: CnsUnregisterVolumeEx marks the CNS DB row as PENDING_UNREGISTER, preserving backingDiskPath and diskUUID in the row, and returns them to CSI.
  • A.4: After CVI patch and BA status write, CSI calls AckUnregister(volumeID) to delete the PENDING_UNREGISTER row.
  • On crash between A.3 and A.4, the PENDING_UNREGISTER row survives, enabling crash recovery via QueryPendingUnregisters.

Currently in vm_owned_attach.go line 85, the code calls volumeManager.UnregisterVolume(ctx, volumeID, true) which:

  • Does NOT return backingDiskPath/diskUUID from the unregister result (returns only a fault type string)
  • Does NOT persist a PENDING_UNREGISTER row -- the CNS DB row is deleted immediately
  • Does NOT require an ACK step
  • Breaks the crash recovery model in Section 14.2

The govmomi fork already has UnregisterVolumeEx, AcknowledgeUnregister, and QueryPendingUnregisters client methods. The CSI driver's Manager interface already has QueryPendingUnregisters and AckUnregister wrappers. What is missing is:

  1. An UnregisterVolumeEx method on the Manager interface that returns (backingDiskPath, diskUUID, error)
  2. Wiring the attach path to use it instead of the old UnregisterVolume
  3. Adding the ACK step after CVI patch + BA status write
Test Coverage Gaps

Multiple areas lack unit tests:

  • PV-bind reconciler (cvi_pv_bind.go) -- no tests for ownerRef patching, crash recovery, cross-namespace rebind
  • MaybeLazilyCreateCVI end-to-end flow -- no test
  • VMHasVCenterSnapshots helper -- no test
  • ReregisterVolumeAsFCD -- no unit tests
  • reconcileSnapshotDeletion / processDiskAfterSnapshotDeletion -- no unit tests
  • GetRetainedDiskUUIDs / IsVolumeRetainedByVCenterSnapshot -- no unit tests
  • Full sync CVI filter -- no dedicated unit test (only mock stubs)
  • checkCVISnapshotRetained admission webhook -- no dedicated named test case
  • reconcileStaleCVIs -- limited test coverage (only noop paths tested)
Minor Issues
  • Commit 9e2bb78e includes an unrelated .cursor/rules/pith.mdc file that should be excluded

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Testing done:
A PR must be marked "[WIP]", if no test result is provided. A WIP PR won't be reviewed, nor merged.
The requester can determine a sufficient test, e.g. build for a cosmetic change, E2E test in a predeployed setup, etc.
For new features, new tests should be done, in addition to regression tests.
If jtest is used to trigger precheckin tests, paste the result after jtest completes and remove [WIP] in the PR subject.
The review cycle will start, only after "[WIP]" is removed from the PR subject.

Special notes for your reviewer:

Release note:

Signed-off-by: Deepak Kinni <deepak.kinni@broadcom.com>
Signed-off-by: Deepak Kinni <deepak.kinni@broadcom.com>
…pshot Deletion, Revert Re-adoption

Signed-off-by: Deepak Kinni <deepak.kinni@broadcom.com>
…ndling

Signed-off-by: Deepak Kinni <deepak.kinni@broadcom.com>
Signed-off-by: Deepak Kinni <deepak.kinni@broadcom.com>
…ional tests

Signed-off-by: Deepak Kinni <deepak.kinni@broadcom.com>
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deepakkinni

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 31, 2026
Signed-off-by: Deepak Kinni <deepak.kinni@broadcom.com>
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 1, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

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-sigs/prow repository.

Signed-off-by: Deepak Kinni <deepak.kinni@broadcom.com>
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@deepakkinni: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-vsphere-csi-driver-verify-vet bcd4696 link true /test pull-vsphere-csi-driver-verify-vet
pull-vsphere-csi-driver-verify-golangci-lint bcd4696 link true /test pull-vsphere-csi-driver-verify-golangci-lint
pull-vsphere-csi-driver-verify-fmt bcd4696 link true /test pull-vsphere-csi-driver-verify-fmt
pull-vsphere-csi-driver-build bcd4696 link true /test pull-vsphere-csi-driver-build
pull-vsphere-csi-driver-unit-test bcd4696 link true /test pull-vsphere-csi-driver-unit-test
pull-vsphere-csi-driver-verify-staticcheck bcd4696 link true /test pull-vsphere-csi-driver-verify-staticcheck
pull-vsphere-csi-driver-verify-shell bcd4696 link true /test pull-vsphere-csi-driver-verify-shell

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

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-sigs/prow repository. I understand the commands that are listed here.

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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants