Skip to content

[14.5-stable] kvm force stop, evetpm and unit-test fixes - #6996

Merged
rene merged 7 commits into
lf-edge:14.5-stablefrom
eriknordmark:backports-2026-10-30-14.5-stable
Oct 31, 2026
Merged

rene merged 7 commits into
lf-edge:14.5-stablefrom
eriknordmark:backports-2026-10-30-14.5-stable

Conversation

@eriknordmark

@eriknordmark eriknordmark commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Backport of #6441, #6691, #6953 to 14.5-stable, combined into one PR to save
CI runs. Every commit is cherry-picked with -x, in master merge order:

Adaptations:

PR dependencies

None.

How to test and validate this PR

  • gofmt, go build ./... (with and without -tags k), go vet and
    go test of every touched pillar package pass on this branch.
  • kvm_force_test.go covers terminateQemu, which the forced stop calls.
    TestTerminateQemuKillsWhenMonitorUnreachable fails with its SIGKILL
    removed.
  • The evetpm tests run against swtpm (tests/tpm/prep-and-run.sh).
    TestDiskKeyPresentFailsOnTPMError fails on this branch when diskKeyPresent
    treats a TPM error as an absent key again.
  • Device-level validation is described in each source PR.

Changelog notes

  • Fixed forced stop and deletion of an application whose guest ignores the
    ACPI power-off request: the QEMU process is now killed if it does not exit.
  • A transient TPM error at boot no longer replaces the vault's disk key with a
    new one.

PR Backports

Checklist

  • I've provided a proper description
  • I've added the proper documentation — no documentation change needed.
  • I've tested my PR on amd64 device — unit tests on this branch only; the
    device testing is on the source PRs.
  • I've tested my PR on arm64 device — not tested.
  • I've written the test verification instructions
  • I've set the proper labels to this PR — none apply to a backport.

For backport PRs:

  • I've added a reference link to the original PR

  • PR's title follows the template

  • I've checked the boxes above, or I've provided a good reason why I didn't
    check them.

🤖 Generated with Claude Code

eriknordmark and others added 7 commits October 30, 2026 11:54
A forced stop was the same ACPI poweroff request as a graceful one, which a
guest that cannot service it yet - one still early in boot, for instance -
simply ignores. Nothing then made the domain go away until domainmgr gave up
waiting and deleted it, so an application stopped shortly after it started
stayed reported as halting for as long as those waits took, and its memory and
any assigned devices stayed held.

A forced stop now terminates the process, which is what the interface promises
and what the xen and containerd implementations of the same method already do.
The termination path Delete already used, a monitor quit followed by a kill if
that does not take, is shared rather than duplicated.

Termination reports whether it worked, so a stop that could not make the
process go away - an unusable pid file leaving nothing to signal, or a process
that outlives the SIGKILL - reaches the caller rather than only the log, and
domainmgr's Shutdown(force) succeeded line means what it says. Delete carries
the same outcome, so a domain whose process is still there is not reported as
deleted just because its state directory was removed.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit dbb5dc5)
Signed-off-by: Milan Lenco <milan@zededa.com>
(cherry picked from commit f7f4757)
When the vault key is fetched, a TPM error while checking for the sealed
disk key was read as "no key present", so EVE generated and sealed a
fresh key over the existing one. Data encrypted with the old key, such as
a reused etcd zvol after a kvm-to-k vault migration redo, then could not
be opened by any key. The check now distinguishes an undefined NV index
from a TPM error, retries the error twice with a log line per attempt,
and fails the fetch rather than generating a key if it persists. An index
that is defined but never written still counts as absent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: eriknordmark <erik@zededa.com>
(cherry picked from commit e3969c3)
Fetching the vault key must not take a TPM error for an absent key, or
it seals a fresh key over the one the vault is encrypted with. The tests
put a proxy between EVE and the TPM simulator that fails the disk-key
presence check while every other command, sealing included, keeps
working. A transient failure must yield the sealed key, and a persistent
one an error with the sealed key left in place. Against the earlier
presence check, the transient case replaces the key.

The proxy answers TPM_RC_NV_UNAVAILABLE rather than TPM_RC_RETRY because
go-tpm retries TPM_RC_RETRY itself and never returns it to the caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: eriknordmark <erik@zededa.com>
(cherry picked from commit aaaaab0)
TestSingleEthInterface and TestSingleEthInterfaceWithIPv6 failed
intermittently on loaded CI runners, with DNS servers still reported
after the interface lost its addresses. One simulated interface update
publishes address, DNS and route events, and the first of them wakes
the test. The reconciler's watcher picks randomly between a queued
event and the pause request from Reconcile, so Reconcile could run
before the DNS change was processed and skip the DNS state.

Wait until the watcher has received every published event before
reconciling. The mock network monitor reports the number of events
still queued for its subscribers for this purpose.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 5c2a208)
TestManageStatFileSizeTargetSizesAvgThreshold asserted that rewriting a
6.8 MB stat file takes under 5 s. Under -race on a loaded CI runner it
sometimes does not, failing the test although the trimmed file is
correct. The test checks the result, which is what it is for; log the
duration and drop the bound.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 30428f1)
Probe latency is measured in real time around the mock's simulated
RTT, so a slow scheduler only inflates it, and the fixed headroom the
tests allowed was exceeded on loaded CI runners. A probe that outlasts
UserProbeTimeout fails instead of reporting latency, so use that as
the upper bound.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 50fd414)
The send and verify tests reached google.com and postman-echo.com, so
a slow resolver or a CI runner without Internet access failed them; a
5 s DNS timeout did so on CI. Serve them from an httptest TLS server
bound to the port's IPv4 address instead. The URL is an IP literal,
so these tests no longer exercise DNS resolution.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit b81f434)
@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.18519% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.98%. Comparing base (272ffae) to head (5296325).
⚠️ Report is 296 commits behind head on 14.5-stable.

Files with missing lines Patch % Lines
pkg/pillar/evetpm/tpm.go 85.18% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           14.5-stable    #6996      +/-   ##
===============================================
+ Coverage        24.97%   26.98%   +2.00%     
===============================================
  Files                8       14       +6     
  Lines             1185     2898    +1713     
===============================================
+ Hits               296      782     +486     
- Misses             820     1958    +1138     
- Partials            69      158      +89     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rene
rene merged commit aeed125 into lf-edge:14.5-stable Oct 31, 2026
51 of 52 checks passed
@eriknordmark
eriknordmark deleted the backports-2026-10-30-14.5-stable branch November 6, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants