Skip to content

[VMOwnedVolumes][Draft]Core Workflows — Attach, Snapshot, Detach, Snapshot Deletion, Revert Re-adoption#4058

Open
deepakkinni wants to merge 3 commits into
kubernetes-sigs:masterfrom
deepakkinni:topic/dk016388/vmown-csi-phase2
Open

[VMOwnedVolumes][Draft]Core Workflows — Attach, Snapshot, Detach, Snapshot Deletion, Revert Re-adoption#4058
deepakkinni wants to merge 3 commits into
kubernetes-sigs:masterfrom
deepakkinni:topic/dk016388/vmown-csi-phase2

Conversation

@deepakkinni
Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:
Phase 2 — Workflow A: Attach (Section 7)
Greenfield/Brownfield Branching in BA Controller (A.3) — In cnsnodevmbatchattachment_controller.go, for each new dependent-persistent volume in BA spec, read the parent VM's vmoperator.vmware.com/vm-owned-volumes annotation and check CVI existence/state; if greenfield + CVI CSI_MANAGED, take the new path; otherwise fall through to legacy CnsAttachVolume (AttachMethod=CnsAttach).

CnsUnregisterVolume Call (A.3) — Implement the call to CnsUnregisterVolume(volumeID, targetType=LEGACY_DISK) via cns-lib/volume/manager.go, handling the two-phase PENDING_UNREGISTER result (backingDiskPath, diskUUID) and error cases (snapshots, CBT, linked clone).

CVI Transition + BA Signal + CNS ACK (A.4) — After successful unregister: (1) patch CVI to TRANSFERRING_TO_VM with vmName, vmInstanceUUID, refreshed diskPath, and cvi-protection finalizer; (2) write diskPath/diskUUID and AttachMethod=Reconfig condition on BA status; (3) call AckUnregister to delete the CNS PENDING_UNREGISTER row.

PENDING_UNREGISTER Crash Recovery (A.3/A.4) — On CSI pod restart, scan CNS for volumes in PENDING_UNREGISTER state that correspond to greenfield BA spec entries, and resume from step A.4 (CVI patch, BA update, ACK).

Mid-Attach Cancellation (Section 7.5) — When a volume is removed from vm.spec.volumes while CVI is in TRANSFERRING_TO_VM, drive Workflow C from the transient state: skip ReconfigVM (disk not yet on VM), query vCenter snapshot tree, and re-register FCD back to CSI_MANAGED.

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>
@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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 30, 2026
…pshot Deletion, Revert Re-adoption

Signed-off-by: Deepak Kinni <deepak.kinni@broadcom.com>
@deepakkinni deepakkinni force-pushed the topic/dk016388/vmown-csi-phase2 branch from 99e15e2 to 0872e3c Compare May 30, 2026 20:59
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. 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