agent: support systemd device group specifiers#456
Merged
Conversation
Copilot
AI
changed the title
[WIP] Add support for systemd device group specifier in additional hosts
agent: support systemd device group specifiers
Jul 10, 2026
bcho
marked this pull request as ready for review
July 13, 2026 22:32
bcho
approved these changes
Jul 13, 2026
bcho
enabled auto-merge
July 13, 2026 22:34
jwilder
approved these changes
Jul 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the agent’s AdditionalHostDevices handling to support systemd DeviceAllow= device-group specifiers (e.g. char-input, char-pts, block-*) in addition to bind-mounted /dev/... paths, and updates nspawn rendering, validation, and documentation accordingly.
Changes:
- Add parsing/validation for
char-*/block-*device-group specifiers alongside/dev/...validation. - Split host device rendering so group specifiers become
DeviceAllow=... rwmonly (noBind=). - Add tests for validation, grouping, and template rendering; update docs to describe the new behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/agent/phases/rootfs/nspawn.go | Plumbs device-group specifiers into nspawn template data for rendering. |
| pkg/agent/phases/rootfs/nspawn_render_test.go | Adds template-rendering coverage for device-group specifiers. |
| pkg/agent/phases/rootfs/assets/service-override.conf | Renders DeviceAllow= lines for both device paths and device-group specifiers. |
| pkg/agent/goalstates/resolve_test.go | Updates goalstate resolution test to include a device-group specifier. |
| pkg/agent/goalstates/hostdevices.go | Splits additional host devices into bind-mountable paths vs DeviceAllow group specifiers. |
| pkg/agent/goalstates/hostdevices_test.go | Adds unit test verifying specifier extraction and path filtering. |
| pkg/agent/config/config.go | Extends AdditionalHostDevices validation and adds helper for recognizing group specifiers. |
| pkg/agent/config/config_test.go | Adds tests for group-specifier detection and validation behavior. |
| docs/content/reference/agent/nspawn.md | Documents the new AdditionalHostDevices behavior and rendering differences. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
AdditionalHostDevicesonly accepted/dev/...paths, preventing use of systemdDeviceAllow=groups such aschar-inputandchar-pts.Configuration
char-*andblock-*device-group specifiers./dev/...entries.nspawn rendering
DeviceAllow=... rwm.Bind=directives.Coverage
{ "AdditionalHostDevices": [ "char-input", "char-pts", "/dev/uinput" ] }This renders group access through: