fix: clear FailureReason/FailureMessage when VM recovers from terminal state - #382
Merged
k8s-ci-robot merged 1 commit intoApr 9, 2026
Conversation
|
|
qinqon
force-pushed
the
fix/clear-failure-reason-on-recovery
branch
3 times, most recently
from
April 8, 2026 08:49
ce5a12e to
c3806aa
Compare
…l state When a KubeVirt VM is stopped (runStrategy changed to Halted), the VMI reaches a finalized state and IsTerminal() correctly sets FailureReason on the KubevirtMachine. However, when the VM is started back (runStrategy changed to Always), IsTerminal() returns false but the FailureReason/FailureMessage fields are never cleared. This causes the CAPI Machine phase to stay stuck at "Failed" even though all Machine conditions (Ready, InfrastructureReady, NodeHealthy) are True. Downstream consumers that rely on the Machine phase (such as HyperShift's endpointslice reconciler) then permanently mark endpoints as not ready, breaking ingress into hosted clusters. The fix adds an else clause to nil out FailureReason and FailureMessage when IsTerminal() returns false, allowing VMs to properly recover. Signed-off-by: Enrique Llorente <ellorent@redhat.com>
qinqon
force-pushed
the
fix/clear-failure-reason-on-recovery
branch
from
April 8, 2026 08:50
c3806aa to
ef6c89b
Compare
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nunnatsa, qinqon The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Contributor
|
/hold |
Contributor
|
/ok-to-test |
Contributor
|
ci passed /unhold |
Contributor
|
/lgtm |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 a KubeVirt VM is stopped (
virtctl stopchangesrunStrategytoHalted), the VMI reaches a finalized state andIsTerminal()correctly setsFailureReason=UpdateErroron the KubevirtMachine. However, when the VM is started back (virtctl startchangesrunStrategyback toAlways),IsTerminal()returnsfalsebut theFailureReason/FailureMessagefields are never cleared.This causes the CAPI Machine
status.phaseto stay stuck atFailedeven though all Machine conditions (Ready,InfrastructureReady,NodeHealthy) correctly showTrue. Downstream consumers that rely on the Machine phase — such as HyperShift's endpointslice reconciler fordefault-ingress-passthrough-service— then permanently mark endpoints as not ready, breaking ingress into hosted clusters.The fix adds an
elseclause to nil outFailureReasonandFailureMessagewhenIsTerminal()returnsfalse, allowing VMs to properly recover from a previously terminal state.Which issue this PR fixes: OCPBUGS-77929
Special notes for your reviewer:
The bug manifests as follows:
virtctl stop VM→runStrategy: Halted→ VMI finalizes →IsTerminal()=true→FailureReasonsetvirtctl start VM→runStrategy: Always→ new VMI created →IsTerminal()=false→ butFailureReasonNOT cleared (noelseclause)KubevirtMachine.Status.FailureReasonstays set → CAPI Machinephase: Failed→ stuck permanentlyEvidence from the customer environment:
KubevirtMachine:ready=true,failureReason=UpdateError(contradictory)Machine: conditions allTrue,phase=Failed(contradictory)EndpointSlice:ready=false(downstream breakage)Release notes: