-
Notifications
You must be signed in to change notification settings - Fork 201
Add dynamic BackingType detection via VirtualDiskManager #3799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
divyenpatel
wants to merge
1
commit into
kubernetes-sigs:master
Choose a base branch
from
divyenpatel:query-backing-disk-type-for-batch-attach
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add dynamic BackingType detection via VirtualDiskManager #3799
divyenpatel
wants to merge
1
commit into
kubernetes-sigs:master
from
divyenpatel:query-backing-disk-type-for-batch-attach
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: divyenpatel The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
c87ef5d to
261e4f1
Compare
skogta
reviewed
Dec 12, 2025
pkg/syncer/cnsoperator/controller/cnsnodevmbatchattachment/cnsnodevmbatchattachment_helper.go
Show resolved
Hide resolved
261e4f1 to
aaa0d8b
Compare
skogta
reviewed
Dec 12, 2025
pkg/syncer/cnsoperator/controller/cnsnodevmbatchattachment/cnsnodevmbatchattachment_helper.go
Outdated
Show resolved
Hide resolved
aaa0d8b to
22fd7a7
Compare
44961e6 to
75a45a0
Compare
75a45a0 to
a92fd95
Compare
When the disk-backing annotation is not present on a PVC, dynamically query the backing type from vSphere VirtualDiskManager API and cache it on the PVC annotation for future attach operations. Changes: - Add queryBackingTypeFromVirtualDiskInfo() to query disk type via CNS QueryVolume API and VirtualDiskManager.QueryVirtualDiskInfo() - Add convertDiskTypeToBackingType() to map vSphere disk types (thin, preallocated, eagerZeroedThick, etc.) to backing types - Add patchPVCBackingTypeAnnotation() to persist queried backing type on PVC annotation for caching - Update constructBatchAttachRequest() to query and cache backing type when annotation is missing - Add unit tests for convertDiskTypeToBackingType and patchPVCBackingTypeAnnotation functions
a92fd95 to
0ebdcf1
Compare
divyenpatel
added a commit
to divyenpatel/vsphere-csi-driver
that referenced
this pull request
Dec 14, 2025
This commit adds handling for CnsNotRegisteredFault in various CNS volume operations for the WORKLOAD cluster flavor. When a volume operation fails with CnsNotRegisteredFault, the driver now attempts to re-register the volume with CNS and retries the operation. Changes include: - Add clusterId and clusterDistribution parameters to GetManager() for volume re-registration - Add reRegisterVolume() function to re-register unregistered volumes - Add IsCnsNotRegisteredFault() helper to detect the fault type - Add IsCnsVolumeAlreadyExistsFault() helper for idempotent re-registration - Handle CnsNotRegisteredFault in: - AttachVolume - DetachVolume - DeleteVolume (with improved idempotency) - UpdateVolumeMetadata - UpdateVolumeCrypto - ExpandVolume (both regular and with improved idempotency) - CreateSnapshot (both regular and with improved idempotency) - DeleteSnapshot - Add TODO for batch attach reconcile to handle unregistered volumes when QueryBackingTypeFromVirtualDiskInfo is used (PR kubernetes-sigs#3799) The re-registration is only attempted once per operation to prevent infinite loops. If re-registration fails or the retry fails, the original error is returned.
divyenpatel
added a commit
to divyenpatel/vsphere-csi-driver
that referenced
this pull request
Dec 14, 2025
This commit adds handling for CnsNotRegisteredFault in various CNS volume operations for the WORKLOAD cluster flavor. When a volume operation fails with CnsNotRegisteredFault, the driver now attempts to re-register the volume with CNS and retries the operation. Changes include: - Add clusterId and clusterDistribution parameters to GetManager() for volume re-registration - Add reRegisterVolume() function to re-register unregistered volumes - Add IsCnsNotRegisteredFault() helper to detect the fault type - Add IsCnsVolumeAlreadyExistsFault() helper for idempotent re-registration - Handle CnsNotRegisteredFault in: - AttachVolume - DetachVolume - DeleteVolume (with improved idempotency) - UpdateVolumeMetadata - UpdateVolumeCrypto - ExpandVolume (with improved idempotency) - CreateSnapshot (with improved idempotency and with transaction) - DeleteSnapshot - Add TODO for batch attach reconcile to handle unregistered volumes when QueryBackingTypeFromVirtualDiskInfo is used (PR kubernetes-sigs#3799) The re-registration is only attempted once per operation to prevent infinite loops. If re-registration fails or the retry fails, the original error is returned.
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/L
Denotes a PR that changes 100-499 lines, ignoring generated files.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
When the disk-backing annotation is not present on a PVC, dynamically query the backing type from vSphere VirtualDiskManager API and cache it on the PVC annotation for future attach operations.
Changes:
Testing done:
Verified Creating Dynamic PVC and attaching it to VM. When PVC does not have
cns.vmware.com.protected/disk-backingannotation set, cnsnodevmbatchattachment reconciler is setting this annotation after querying backing type.Special notes for your reviewer:
Release note: