Skip to content

[16.0-stable] Configure USB priority in VM boot order#5547

Merged
rene merged 8 commits into
lf-edge:16.0-stablefrom
OhmSpectator:backport/16.0-stable/feature/usb-boot-order-config
Jan 19, 2026
Merged

[16.0-stable] Configure USB priority in VM boot order#5547
rene merged 8 commits into
lf-edge:16.0-stablefrom
OhmSpectator:backport/16.0-stable/feature/usb-boot-order-config

Conversation

@OhmSpectator
Copy link
Copy Markdown
Member

@OhmSpectator OhmSpectator commented Jan 12, 2026

Description

Backport of #5507

How to test and validate this PR

https://docs.google.com/document/d/1kpluHl6q-KTCRXG2k421Smn1l2dF3HxAh7l_GleGAjo/edit?usp=sharing

Changelog notes

Added per-VM USB boot order control. Operators can now configure whether each VM prioritizes or deprioritizes USB devices in its boot order. Setting usb makes the VM boot from USB first, setting nousb makes the VM boot from disk first, and an empty value preserves the default behavior. Configuration takes effect on the next VM restart. See docs/VM-BOOT-ORDER.md for configuration methods and details.

Checklist

  • I've provided a proper description
  • I've added the proper documentation
  • I've tested my PR on amd64 device
  • I've tested my PR on arm64 device
  • I've written the test verification instructions
  • I've set the proper labels to this PR
  • 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.

@OhmSpectator OhmSpectator marked this pull request as draft January 12, 2026 16:18
@github-actions github-actions Bot requested a review from uncleDecart January 12, 2026 16:18
@OhmSpectator OhmSpectator added main-quest The fate of the project rests on this PR. Prioritise review to advance the storyline! stable Should be backported to stable release(s) labels Jan 12, 2026
@OhmSpectator
Copy link
Copy Markdown
Member Author

Setting into Draft until is fully tested locally

@OhmSpectator OhmSpectator self-assigned this Jan 12, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 28.08%. Comparing base (9f69150) to head (97d50e6).
⚠️ Report is 8 commits behind head on 16.0-stable.

Additional details and impacted files
@@               Coverage Diff               @@
##           16.0-stable    #5547      +/-   ##
===============================================
+ Coverage        19.52%   28.08%   +8.55%     
===============================================
  Files               19       19              
  Lines             3021     2314     -707     
===============================================
+ Hits               590      650      +60     
+ Misses            2310     1520     -790     
- Partials           121      144      +23     

☔ View full report in Codecov by Sentry.
📢 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
Copy link
Copy Markdown
Contributor

rene commented Jan 14, 2026

LGTM

@rene
Copy link
Copy Markdown
Contributor

rene commented Jan 14, 2026

just left minor comments in the main one...

@OhmSpectator
Copy link
Copy Markdown
Member Author

@rene, yeah, thanks. I’ll update this PR as well. It’s also queued for a local test run (it can take up to 8 hours and I run now for a different branch + for another fix), so I’m not marking it as ready for review until the test is done.

@OhmSpectator OhmSpectator force-pushed the backport/16.0-stable/feature/usb-boot-order-config branch from 7f2009f to 89e5b71 Compare January 14, 2026 21:28
@OhmSpectator
Copy link
Copy Markdown
Member Author

Update the PR with the changes from the master-PR.

@OhmSpectator OhmSpectator force-pushed the backport/16.0-stable/feature/usb-boot-order-config branch from 89e5b71 to 19dc559 Compare January 15, 2026 11:51
@OhmSpectator OhmSpectator marked this pull request as ready for review January 16, 2026 17:44
@OhmSpectator
Copy link
Copy Markdown
Member Author

All tests are done

Copy link
Copy Markdown
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kick off tests

@christoph-zededa
Copy link
Copy Markdown
Contributor

@OhmSpectator can you rebase? Or should I create then a backport of #5558 (review) ?

@rene
Copy link
Copy Markdown
Contributor

rene commented Jan 16, 2026

@OhmSpectator can you rebase? Or should I create then a backport of #5558 (review) ?

@OhmSpectator , please, rebase.

Refresh dependencies and vendor tree to include boot order fields from
lf-edge/eve-api. Update go.mod/go.sum, regenerate vendored protobuf
artifacts, and sync modules.txt. No Pillar code changes; dependency sync
only.

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
Extend EveBootOrderLib to read the opt/eve.bootorder fw_cfg file, log
the boot options, and push USB entries forward or remove them depending
on the “usb”/“nousb” value. This patch adds the fw_cfg reader,
prioritization logic, and the necessary UefiLib dependency so future
firmware builds can respond to the boot-order hints.

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
@OhmSpectator OhmSpectator force-pushed the backport/16.0-stable/feature/usb-boot-order-config branch from 19dc559 to 00cce65 Compare January 18, 2026 02:42
@OhmSpectator
Copy link
Copy Markdown
Member Author

Rebased

@github-actions github-actions Bot requested a review from eriknordmark January 18, 2026 02:42
Point the xen-tools and pillar Dockerfiles at the new eve-uefi image
that contains the EveBootOrderLib enhancements, ensuring qemu guests
pick up the fw_cfg opt/eve.bootorder changes. This is the image hash
produced after applying the usb/nousb patch in the UEFI tree.

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
Introduce boot order plumbing in Pillar types so VMs can apply a
consistent boot device priority and report where it came from.

This adds a BootOrder field to VmConfig and defines a new global setting
(app.boot.order) with validation for supported values. It also extends
AppInstanceConfig to keep the controller-provided boot order alongside
the effective value and track the selected source, and introduces
LPS-facing structs to cache per-app boot config and publish effective
boot order + source without triggering unnecessary domain restarts.

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
Wire zedagent and localcommand together to let the Local Profile Server
override per-app VM boot order and keep the effective value consistent
across restarts and config refreshes.

This adds a small boot order resolver that applies precedence (LPS over
controller over device property) and stores the raw controller value so
the effective boot order can be re-evaluated when LPS clears an override
or app.boot.order changes. Boot order source is tracked alongside the
effective setting for LPS reporting.

Localcommand gains a dedicated /api/v1/appbootinfo task that
periodically posts the effective boot order and processes any boot
config returned by LPS, with persistence to disk, cache-based change
detection, and throttling behavior when LPS indicates the feature is not
configured. A mutex guards the AppInstanceConfig publish
read-modify-write path since updates can now arrive from multiple
goroutines.

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
Enable VM boot device prioritization by exporting the resolved boot
order into the QEMU config as an OVMF-readable fw_cfg entry.

This maps the BootOrder enum to the string values expected by
EveBootOrderLib and injects opt/eve.bootorder only for FML/OVMF guests
(skipping the virt machine type). Unit tests cover USB and NoUSB
settings, absence of the section when unset, and the ARM/virt exclusion.

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
Handle boot order updates as a special-case FixedResources change so
users get a clear, non-fatal indication that a restart is needed to
apply the new setting.

When the diff between configs shows that only FixedResources.BootOrder
changed, zedmanager now records a warning-level status message instead
of failing the modify path for missing restart commands. Other
FixedResources changes keep the existing stricter behavior and still
require an explicit restart request.

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
@OhmSpectator OhmSpectator force-pushed the backport/16.0-stable/feature/usb-boot-order-config branch from 00cce65 to 5285a77 Compare January 18, 2026 02:46
@OhmSpectator
Copy link
Copy Markdown
Member Author

/rerun red

Add user- and developer-facing documentation for runtime VM boot order
control, with a focus on USB boot priority and how the setting flows
from configuration into OVMF.

This expands the firmware docs with the fw_cfg-based mechanism and its
interaction with custom OVMF builds, registers the app.boot.order device
property in CONFIG-PROPERTIES, and documents the new bidirectional LPS
/api/v1/appbootinfo endpoint, including status codes, persistence, and
restart semantics. It also introduces a dedicated VM boot order guide
plus an internal architecture note covering precedence, data flow, and
concurrency protections.

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
@OhmSpectator OhmSpectator force-pushed the backport/16.0-stable/feature/usb-boot-order-config branch from 5285a77 to 97d50e6 Compare January 18, 2026 19:43
@OhmSpectator
Copy link
Copy Markdown
Member Author

Rebased by mistake... All was already green...

@OhmSpectator
Copy link
Copy Markdown
Member Author

/rerun red

@rene rene merged commit 158c67e into lf-edge:16.0-stable Jan 19, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

main-quest The fate of the project rests on this PR. Prioritise review to advance the storyline! stable Should be backported to stable release(s)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants