Repository navigation
Include USB devices when connecting the custom-device interface - #1151
Draft
jonathan-conder wants to merge 1 commit into
Draft
jonathan-conder wants to merge 1 commit into
jonathan-conder wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Real USB hardware and supported LXD servers are needed to validate node visibility, workshop-user permissions, and connect/disconnect/restart behavior, which the added profile-construction and decoding tests do not cover.
No open issues 🎉
What changed in this PR
Updates the LXD backend so custom-device connections include USB device nodes, addressing the device-visibility portion of #1046. USB hotplugging and ownership inheritance remain dependent on upstream LXD fixes.
Changes:
- Uses a USB device for
subsystem=usb, and both USB andunix-hotplugdevices when the subsystem is unset. - Preserves custom-device metadata when reading profiles and omits USB ownership inheritance when LXD lacks support.
- Adds unit tests for device generation and profile reconstruction.
| File | Description |
|---|---|
internal/workshop/lxd/lxd_backend_profile.go |
Restores custom-device metadata from placeholders and ignores auxiliary USB entries. |
internal/workshop/lxd/lxd_backend_profile_test.go |
Tests USB-only and unspecified-subsystem profile reconstruction. |
internal/interfaces/lxd_device/spec.go |
Generates USB devices according to subsystem selection. |
internal/interfaces/lxd_device/spec_test.go |
Tests USB, non-USB, and unspecified-subsystem device generation. |
internal/interfaces/lxd_device/backend.go |
Removes unsupported USB ownership-inheritance settings before applying profiles. |
Review effort: Balanced
This branch has not been deployed
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
Fixes #1046, at least the bit about USB devices being completely skipped. It still won't support hotplugging or ownership inheritance until those are fixed in LXD (canonical/lxd#19450, canonical/lxd#19451).
LXD deliberately filters out
subsystem: usbwhen starting aunix-hotplugdevice, because it has a dedicatedusbdevice type. Workshop now uses bothunix-hotplugandusbdevices to back acustom-deviceplug whensubsystemis unset. Whensubsystem=usbit only uses ausbdevice, nounix-hotplug.Self-review quick check
Docs
Procedure:
Content:
tutorial/andhow-to/sections).docs/.coverage.yamlupdated, coverage tags added (.. artefact).Or: