OCPBUGS-16118: fix vsphere machine stuck in infinite requeue when PatchMachine fails after clone#1519
Conversation
…fails after clone When a VM clone is initiated, the task ID is saved to an in-memory TaskIDCache. If the subsequent PatchMachine() call fails (e.g. due to a transient ValidatingAdmissionPolicy rejection), the task ID is never persisted to the machine object. On every subsequent reconcile, the cache guard sees a mismatch between the cached task ID and the empty TaskRef in the machine's providerStatus, causing an infinite RequeueAfterError loop. The recovery code in reconciler.create() that handles "cloned but lost taskRef" is never reached. Fix by clearing the TaskIDCache entry when PatchMachine() fails, so the next Create() call can proceed past the cache guard and reach the existing recovery path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Skipping CI for Draft Pull Request. |
Walkthrough
ChangesvSphere TaskIDCache behavior
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/test unit |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@jcpowermac: This pull request references Jira Issue OCPBUGS-16118, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/controller/vsphere/actuator.go (1)
100-114: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueFix looks correct; update the now-stale comment.
Clearing the cache entry on
PatchMachine()failure correctly breaks the infinite-requeue loop described in the PR objective. However, the comment at Line 100 ("save the taskRef in our cache in case of any error with patch") no longer fully applies — the entry is now immediately deleted again ifPatchMachine()fails in the same call, so the cache no longer survives a patch failure. Consider updating the comment to mention that the entry is purged on patch failure and only persists across failures... intentionally left for cases where saving succeeds but a subsequent operation still needs it.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/controller/vsphere/actuator.go` around lines 100 - 114, Update the comment above the TaskIDCache assignment in the reconciliation flow to state that the task reference is cached for later errors only when patching succeeds, and that it is removed if PatchMachine() fails. Keep the existing cache assignment and deletion behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pkg/controller/vsphere/actuator.go`:
- Around line 100-114: Update the comment above the TaskIDCache assignment in
the reconciliation flow to state that the task reference is cached for later
errors only when patching succeeds, and that it is removed if PatchMachine()
fails. Keep the existing cache assignment and deletion behavior unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 5bc34bbe-b89a-4aa8-b752-8dff17cbb153
📒 Files selected for processing (2)
pkg/controller/vsphere/actuator.gopkg/controller/vsphere/actuator_test.go
|
/jira refresh |
|
@jcpowermac: This pull request references Jira Issue OCPBUGS-16118, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
|
@openshift-ci-robot: GitHub didn't allow me to request PR reviews from the following users: huali9. Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn response to this:
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. |
|
/test ? |
|
/test e2e-vsphere-ovn-multi-vcenter |
|
/assign @racheljpg /cc @vr4manta |
|
@jcpowermac: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
@jcpowermac Do you have logs (preferrably a must-gather) from a cluster where you saw:
Independent of this fix, I'm very interested in that. |
…fails after clone
When a VM clone is initiated, the task ID is saved to an in-memory TaskIDCache. If the subsequent PatchMachine() call fails (e.g. due to a transient ValidatingAdmissionPolicy rejection), the task ID is never persisted to the machine object. On every subsequent reconcile, the cache guard sees a mismatch between the cached task ID and the empty TaskRef in the machine's providerStatus, causing an infinite RequeueAfterError loop. The recovery code in reconciler.create() that handles "cloned but lost taskRef" is never reached.
Fix by clearing the TaskIDCache entry when PatchMachine() fails, so the next Create() call can proceed past the cache guard and reach the existing recovery path.
Summary by CodeRabbit