Repository navigation
[17.0-stable] kubevirt: keep domain bookkeeping until Cleanup - #6812
Merged
rene merged 4 commits intoOct 16, 2026
Merged
Conversation
domainmgr asks the hypervisor to shut a domain down and then polls Info() until it reports the domain gone, before creating any replacement. Stop() dropped the vmiList entry Info() needs in order to read the guest's phase, so after Stop every poll could only answer SCHEDULING -- never the HALTED that ends the wait. domainmgr therefore polls out the entire graceful-shutdown budget and escalates to a forced shutdown even when KubeVirt stopped the guest promptly. Leave the entry in place in Stop and remove it in Cleanup, the unconditional tail of doInactivate. Delete cannot own the removal: it only runs while DomainId is still set, which is no longer true once the domain goes away during the graceful wait, and Cleanup's IsMetaReplicaVMI path did not remove it either. The removal is deferred so a Cleanup that fails partway still releases the entry. On EVE-kvm the same sequence polls real domain state throughout, because the containerd-backed Stop it inherits keeps no such bookkeeping. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 6b6adca)
Delete asked scheduledOnMe() which node the domain is placed on and then discarded its error. A failed lookup -- a failed config load, a missing node name, an unreachable client, or a ReplicaSet Get that did not answer -- reports onMe=false, which is indistinguishable from the legitimate "scheduled on another node" case tested on the next line. Delete therefore returned nil, reporting a successful teardown to domainmgr while deleting nothing, whenever the Kubernetes API was briefly unavailable. Check the error and return it, as Stop already does with the same call. domainmgr logs a Delete failure and waits for the domain regardless, so the retry behaviour is unchanged. Note this also surfaces an already-deleted ReplicaSet as a Delete error rather than a silent success, since the lookup's Get reports NotFound through the same path. That is a louder log on a teardown that had nothing left to do; softening it would need the lookup to distinguish NotFound from a genuine API failure, which it currently does not. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit e320223)
A failed VMIRS delete logged only the error, so an operator reading the log could not tell which app's replicaset failed to go away -- and this path fires during every teardown that races the Kubernetes API. Include the replicaset name, and drop the trailing newline that logrus adds itself. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 512a8a8)
Info confirms the replicaset exists and then fetches it again to read the guest's phase. A workload deleted between those two calls made the second lookup fail with NotFound, which Info reported as an error alongside a still-scheduling state; domainmgr's wait for the domain to disappear treats any such error as "already gone" and stops waiting. That is the same early return the graceful wait exists to prevent, reached through a narrower window. Absence is now reported identically wherever it is observed, which also drops a redundant lookup of an object already known to be gone. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> (cherry picked from commit 551d449)
4 of 7 tasks
eriknordmark
requested review from
andrewd-zededa
and removed request for
OhmSpectator
October 15, 2026 21:41
Contributor
Author
|
@rene @andrewd-zededa please review: this is a dependency for the 17.0-stable backport of #6505. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 17.0-stable #6812 +/- ##
===============================================
+ Coverage 22.66% 23.04% +0.38%
===============================================
Files 512 522 +10
Lines 94634 96423 +1789
===============================================
+ Hits 21449 22224 +775
- Misses 71358 72186 +828
- Partials 1827 2013 +186 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rene
approved these changes
Oct 16, 2026
Merged
3 tasks done
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.
Description
Backport of #6271 to
17.0-stable, needed as a dependency for the17.0-stablebackport of #6505.On EVE-k,
kubevirtContext.Stop()dropped the domain's bookkeeping entry, sodomainmgr's graceful-shutdown poll saw the domain as gone on its first tick
and created the replacement VMIRS while KubeVirt was still shutting the old
VMI down. The entry now lives until
Cleanup. The set also stopsDeletefrom ignoring a failed scheduling lookup, names the replicaset in the delete
error, and treats a
NotFoundbetweenInfo's two lookups as gone.All four commits cherry-picked with
-x, no adaptations: the picks appliedclean and the diff is identical to master's apart from hunk-header line
numbers.
PR dependencies
None.
How to test and validate this PR
Under
pkg/pillar:go build -tags k ./hypervisor/,go vet -tags k ./hypervisor/andgo test -tags k ./hypervisor/(thektag is required;hypervisor/kubevirt.gois behind//go:build k). As on master,TestCreateReplicaPodConfigfails in a non-root host run because it writes/run/.kube/k3s/k3s.yaml; it fails the same way on the unpatched branch, andCI runs as root.
On an EVE-k device, restart an app instance and watch
waitForDomainGone: itshould back off on
state still RUNNINGrather than ending after onewaiting for 1s, andkubectl get pods -n eve-kube-appshould not show twovirt-launcherpods for the same app.Changelog notes
On EVE-k, an app restart or deactivate no longer creates the replacement while
the previous instance is still shutting down.
PR Backports
Checklist
check them.
No documentation change. The source PR was run on an amd64 EVE-k device; this
clean pick was build-, vet-, test- and gofmt-checked on the branch, not re-run
on a device.