Skip to content

Conversation

@divyenpatel
Copy link
Member

@divyenpatel divyenpatel commented Dec 6, 2025

What this PR does / why we need it:

This PR 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 transaction support)
    • DeleteSnapshot

Add TODO for batch attach reconcile to handle unregistered volumes when QueryBackingTypeFromVirtualDiskInfo is used (PR #3799)

Re-registration is attempted only once per operation to prevent infinite loops. If re-registration fails or the retry fails, the original error is returned.

Testing done:

Refer to tests and logs here - https://gist.github.com/divyenpatel/c48fddcc2bb7323fbbd168d4e035ff6a

Special notes for your reviewer:

Release note:

handle CnsNotRegisteredFault and re-register volume

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 6, 2025
@k8s-ci-robot
Copy link
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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 6, 2025
@divyenpatel divyenpatel force-pushed the handle-CnsNotRegisteredFault branch 4 times, most recently from bd3e2f8 to 8469478 Compare December 11, 2025 00:06
@divyenpatel divyenpatel changed the title [WIP] handle CnsNotRegisteredFault and re-register volume handle CnsNotRegisteredFault, re-register volume and continue volume operations Dec 11, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 11, 2025
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Dec 11, 2025

@divyenpatel: The following test 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-golangci-lint 8469478 link true /test pull-vsphere-csi-driver-verify-golangci-lint

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.

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.

@divyenpatel divyenpatel force-pushed the handle-CnsNotRegisteredFault branch from 8469478 to 49fc6ee Compare December 14, 2025 19:26
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels 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.
@divyenpatel divyenpatel force-pushed the handle-CnsNotRegisteredFault branch from 49fc6ee to a2961cf Compare December 14, 2025 19:33
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 14, 2025
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants