Weekly news #375

Weekly status for the week of 2nd December to 8th December.

Introduction

This past week LXD received some bug fixes and new options for unix-hotplug devices, enabling matching devices by their subsystem, and allowing device ownership to be inherited from the host.

Thanks to all the contributors!

New options for unix-hotplug devices

LXD introduced two new options for unix-hotplug devices: subsystem and ownership.inherit.

The first option subsystem enables matching devices by their subsystem. It also supports matching subsets of devices with a specific vendor ID or devices without product and vendor IDs.

Example:

# Add all devices from a specific subsystem.
lxc config device add <instance_name> <device_name> unix-hotplug subsystem=<subsystem>

# Add all devices from a specific subsystem with a specific vendor ID.
lxc config device add <instance_name> <device_name> unix-hotplug subsystem=<subsystem> vendorid=<vendor_ID>

The second option ownership.inherit, when enabled, inherits device ownership from the host. The option can be enabled only when gid and uid are not configured manually. By default, this option is set to false, which means the ownership is set to configured uid and gid, or 0 (root) if not specified.

Example:

lxc config device add <instance_name> <device_name> unix-hotplug productid=<product_ID> --config ownership.inherit=true

Documentation: Device unix-hotplug - Device options

Option scope in metadata configuration API

The metadata API now includes a configuration scope for certain settings, indicating whether the option is member-specific (local) or applies to all cluster members (global).

The metadata configuration is accessible on GET /1.0/metadata/configuration.

lxc query /1.0/metadata/configuration

Bugfixes

  • Fixed an issue where instance conversion would fail on clustered LXD during selection of suitable cluster member with an error message Unknown instance source type "conversion". The source type conversion is now correctly handled.

  • Fixed an issue where an already initialized LXD incorrectly displayed the initialization help message.

All changes

The items listed below is all of the work which happened over the past week and which will be included in the next release.

LXD

LXD UI

LXD Charm

  • Nothing to report this week

LXD Terraform provider

  • Nothing to report this week

PyLXD

  • Nothing to report this week

Distribution work

This section is used to track the work done in downstream Linux distributions to ship the latest LXD as well as work to get various software to work properly inside containers.

Ubuntu

  • Nothing to report this week.

LXD snap

4 Likes

Hi,
Could you elaborate on this ?
Where can I find documentation on that subsystem topic ?
I tried to google USB subsystem and there is a lot of explanations, but it still not clear what would be the use case here.
Can you give me an example of such use ?
Thanks a lot, in advance,

In the context of udev and Linux device management, a subsystem is a classification or grouping of devices based on their functionality or purpose within the Linux kernel’s device model. The subsystem parameter helps distinguish devices that belong to a particular category. An example use case is adding v4l2loopback devices which don’t include a vendorid .

2 Likes

Where can I get a list of these subsystems ?

Unfortunately, a comprehensive list is not readily available. However, you can use udevadm info --query=all --name=/dev/<name> to query the subsystem information for a device.

OK thanks,

ex

P: /devices/pci0000:00/0000:00:1d.0/0000:3a:00.0/nvme/nvme0
M: nvme0
R: 0
U: nvme
D: c 241:0
N: nvme0
L: 0
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/0000:3a:00.0/nvme/nvme0
E: DEVNAME=/dev/nvme0
E: NVME_TRTYPE=pcie
E: MAJOR=241
E: MINOR=0
E: SUBSYSTEM=nvme

I could hotplug this nvme just by passing subsystem=nvme then right ?

I haven’t personally tested this, but in theory, yes. Please note that if you have multiple nvme devices nodes, all of them will be accessible to the container.

1 Like

Yeah I get that.
The topic is of interest because we had discussed this in an earlier thread,
https://discuss.linuxcontainers.org/t/cannot-use-usb-dev-inside-container-anymore/15661/30
But I couldn’t use hotplug, only unix-char (cf. end of the thread).
Maybe this new feature could allow me to do so now.

1 Like