LXD 4.3 has been released

Introduction

The LXD team is very excited to announce the release of LXD 4.3!

This release comes with a lot of improvements especially for those using virtual machines. It also comes with quite a few bugfixes for our cluster users and general performance improvements.

Enjoy!

New features and highlights

Block custom storage volumes

Up until now, all custom storage volumes were filesystems. Either a directory/subvolume/dataset on a storage backend which supports that or as a formatted block on the other backends.

Now with virtual machines being supported by LXD, we found ourselves needing to support attaching both our traditional filesystem backed volumes to virtual machines (which has been possible for a while and uses 9p) as well as allowing for additional raw disks to be attached to virtual machines.

This can now be done with block custom storage volumes.

stgraber@castiana:~$ lxc storage volume create default my-fs size=10GiB
Storage volume my-fs created
stgraber@castiana:~$ lxc storage volume create default my-block size=10GiB --type=block
Storage volume my-block created

stgraber@castiana:~$ lxc storage volume list default
+-----------------+------------------------------------------------------------------+-------------+--------------+---------+
|      TYPE       |                               NAME                               | DESCRIPTION | CONTENT TYPE | USED BY |
+-----------------+------------------------------------------------------------------+-------------+--------------+---------+
| custom          | my-block                                                         |             | block        | 0       |
+-----------------+------------------------------------------------------------------+-------------+--------------+---------+
| custom          | my-fs                                                            |             | filesystem   | 0       |
+-----------------+------------------------------------------------------------------+-------------+--------------+---------+
| image           | a4dc839edd35d50158d57818938775669265a3af004bd93b8281115ee0abd29d |             | block        | 1       |
+-----------------+------------------------------------------------------------------+-------------+--------------+---------+
| virtual-machine | f1                                                               |             | block        | 1       |
+-----------------+------------------------------------------------------------------+-------------+--------------+---------+

stgraber@castiana:~$ lxc config device add f1 my-fs disk source=my-fs pool=default path=/srv/my-fs
Device my-fs added to f1
stgraber@castiana:~$ lxc config device add f1 my-block disk source=my-block pool=default
Device my-block added to f1

stgraber@castiana:~$ lxc start f1
stgraber@castiana:~$ lxc exec f1 bash
root@f1:~# gdisk -l /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_lxd_my-block
GPT fdisk (gdisk) version 1.0.5

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries in memory.
Disk /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_lxd_my-block: 20971520 sectors, 10.0 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): EA616112-9C49-4809-AA68-53895E752A34
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 20971486
Partitions will be aligned on 2048-sector boundaries
Total free space is 20971453 sectors (10.0 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
root@f1:~# df -h /srv/my-fs/
Filesystem      Size  Used Avail Use% Mounted on
lxd_my-fs        10G  128K   10G   1% /srv/my-fs
root@f1:~# 

VM: Initial work for graphical console

All LXD VMs now come with virtio-gpu and virtio-input devices out of the box as well as a spice channel currently tied to a local unix socket.

One can directly connect to that socket using a client like spicy but this will soon change and instead have LXD allow remote access to this through websocket using lxc console.

VM: Rework of PCIe layout

We’ve now made sure that every virtio device we expose to the VM is on the PCIe bus, devices have been merged into functions when possible to save the number of slots.

Logic has also been put in place so that network devices should always show up in the same slot and so get a stable name when hardware based naming is enabled.

VM: GPU passthrough

It is now possible to attach gpu type devices to VM, passing a physical GPU through VFIO. Do note that unlike containers that can share GPU with their host, virtual machines cannot.

Direct console attach on lxc start and lxc restart

Both lxc start and lxc restart can now be passed --console when interacting with a single instance. This will cause the command line to immediately attach to the console letting you observe the instance boot sequence.

Isolated CPUs reporting in resources API

A new isolated field is present on all CPU threads now in the /1.0/resources API, this will be set to true if the particular thread is specified as an isolated CPU.

This usually happens when one starts the system with isolcpus= on the kernel command line.

Complete changelog

Here is a complete list of all changes in this release:

Full commit list
  • lxd/instance/drivers/driver/lxc: Adds debug logging to deviceStop
  • lxd/instance/drivers/driver/lxc: Adds driver revert on failed start in startCommon
  • lxd/instance/drivers/driver/qemu: Adds debug logging to deviceStop
  • lxd/instance/drivers/driver/qemu: Simplifies failed start device cleanup in Start
  • lxd/storage/drivers/driver/ceph/utils: Removes getRBDFilesystem
  • lxd/storage/drivers/driver/ceph: Replaces use of d.getRBDFilesystem with vol.ConfigBlockFilesystem
  • lxd/storage/drivers/volume: Adds ConfigBlockMountOptions function
  • lxd/storage/drivers/driver/ceph/utils: Removes getRBDMountOptions in place of vol.ConfigBlockMountOptions()
  • lxd/storage/drivers/driver/lvm/utils: Removes volumeMountOptions in place of vol.ConfigBlockMountOptions()
  • lxd/storage/drivers: Replaces driver specific mount options resolution with vol.ConfigBlockMountOptions()
  • lxd/rbac: Don’t close body when missing
  • doc/storage: Cover host/disk/loop setups
  • lxd/init: Tweak default loop sizing
  • lxd/vm: Rename some functions
  • client: Expand snap path in ConnectLXDUnix
  • lxd/vm: Add virtio-vga card
  • lxd/vm: Add spice channel
  • client: Fix ConnectLXDUnix regression
  • lxd/vm: Fix PCIe slot for physical/sriov nic
  • lxd/network: Make setting bridge VLAN filtering & default PVID optional
  • lxd/instance/drivers/driver/qemu: Integrates built in GPU device PCI range with future passthrough GPU devices
  • lxd/instance/drivers/driver/qemu/templates: Updates built in GPU device to use GPU address range prefix
  • lxd/vm: Move to separate devices
  • lxd/vm: Remove tiny wrapper functions
  • lxd/vm: Per-architecture bus type
  • add type to specify the instance type on creation Signed-off-by: Salem Yaslem s@sy.sa
  • lxd/vm: Centralize port generation
  • lxd/device: Sort nic devices ahead of others
  • lxd/device/device/utils/generic: Adds PCI management functions for overriding driver
  • lxd/device/device/utils/network: Removes network specific PCI bind/unbind functions
  • lxd/device/nic/physical: Updates to use generic PCI management functions
  • lxd/device/nic/sriov: Updates to use generic PCI management functions
  • lxd/vm: Separate template keys in global/local
  • lxd/vm: Use virtio-gpu-pci on non-x86
  • lxd/vm: Rename qemuVGA to qemuGPU
  • lxd/vm: Add virtio-input keyboard/mouse
  • lxd/vm: Move bus allocator to own file
  • lxc/volume: Fix typo in help message
  • i18n: Update translation templates
  • lxc/snapshot: Allow using snapshot delimiter
  • i18n: Update translation templates
  • doc/instances: Updates GPU device docs to show VM support
  • lxd/device/gpu: Updates validation for VM support
  • lxd/device/config/device/runconfig: Adds GPU field to RunConfig
  • lxd/device/device/utils/generic: pciDeviceDriverOverride only check for driver binding if specified
  • lxd/device/gpu: Adds VM GPU passthrough support
  • lxd/instance/drivers/driver/qemu/templates: Consistent naming and casing for net dev templates
  • lxd/instance/drivers/driver/qemu: Consistent net dev naming usage
  • lxd/instance/drivers/driver/qemu/templates: Adds qemuGPUDevPhysical template
  • lxd/instance/drivers/driver/qemu: Adds GPU passthrough support
  • lxd/instance/drivers/driver/qemu/bus: Adds comments, clarifies var names, and constants for defined multi-function groups
  • lxd/instance/drivers/driver/qemu: Switches to multi-function group constants and adds comments
  • lxd/instance/drivers/qmp/monitor: Allow serial char device name to be passed in
  • lxd/instance/drivers/driver/qemu: Defines qemuSerialChardevName to share with qemu and qmp
  • lxd/instance/drivers/driver/qemu: qemuSerialChardevName usage
  • lxd/instance/drivers/driver/qemu/templates: Add serial chardev name injection
  • lxd/storage/quota/projectquota: Only set quota on directories and regular files
  • lxd/db: Automatically strip ?project=default
  • lxc/action: Properly handle --all with remotes
  • lxd/projects: Properly clear empty keys
  • lxd/db: Add missing feature to default project
  • lxd/instance/drivers/driver/qemu: Pass-through GPU VGA mode status from host
  • lxd/storage/drivers/driver/zfs/volumes: Remove snapshot when migrating as main volume
  • lxd/cluster/heartbeat: Fix race in HeartbeatNode
  • lxc/console: Split Console to own function
  • lxc/start: Allow direct console attach
  • i18n: Update translation templates
  • lxd/instance/drivers/driver/qemu: Only enable GPU vga mode on x86_64 systems
  • lxd/resources: Fix golint warning
  • doc/api-extensions: Fix escaping
  • api: resource_cpu_isolated
  • lxd/resources: Add Isolated property
  • lxd/resources: Don’t use shared
  • lxd/devices: Use resources for cpuset parsing
  • lxc: Don’t over-escape URLs
  • lxd: Don’t over-escape URLs
  • lxd/db/storage: Rework UsedBy for pools
  • lxd/instance/drivers/driver/qemu: Adds trans=virtio to 9p mounts
  • lxc/action: Also add --console to restart
  • lxd/resources/net: More flexible PCI detection
  • lxc/query: Add path check
  • i18n: Update translation templates
  • tests: Fix bad lxc query call
  • lxd/storage-pools: Tweak UsedBy URLs
  • lxd/networks: Reports profiles in UsedBy
  • lxd/db: Tweak joins
  • lxd/db: Fix UsedBy on projects
  • lxd/storage_volumes: Fix UsedBy
  • api: usedby_consistency
  • lxd-agent/main/agent: Fix 9p mount when relative target path is supplied
  • test: Updates udhcpd args to ensure process quits one lease acquired
  • util_linux: update terminology
  • lxd: Fix snapshot index retrieval
  • lxd/backups: Use backups dir for unpack
  • lxd/vm: Add udev rule fallback
  • lxd/images: Set arch names when downloading
  • lxd: More flexible compression algorithms
  • tests: Add test for compression options
  • doc/rest-api: Rename rootfs to root
  • doc/rest-api: Fix instance PATCH example
  • lxd: Fix building with clang
  • lxd/db: Add missing criteria for querying a specific public image
  • lxd/db: Add the Errored storage state when rendering the Status field
  • lxd/cluster: If raft node 1 gets remove during recovery, add it back
  • lxd/db: Make GetNework() return an error if the network is pending
  • lxd/db: Rename NetworkCreatePending to CreatePendingNetwork
  • lxd/db: Make GetStoragePool() return an error if the pool is pending
  • lxd/db: Rename StoragePoolCreatePending to CreatePendingStoragePool
  • lxd/firewall: Filter unwanted ethernet frame types when IP filtering is enabled
  • lxd/storage/drivers: Bump VM fs size to 100MB
  • lxd/db: Fix UsedBy for profiles on storage pools
  • lxd/storage: Use Truncate to create/grow VM files
  • lxd/db: Consider personalities in GetNodeWithLeastInstances
  • lxd/db: Avoid test failure in arch matching
  • lxd/storage: Better handle broken volumes
  • client: Handle unknown image sizes
  • lxd/response: Stream multi-part responses
  • lxd/device/disk: Fixes cloud-init errors for VMs
  • lxc/action: Show usage on missing target
  • lxd/storage: Rely on UsedBy for deletion error
  • lxd/instances/qemu: Use images dir during compression
  • lxd/storage/drivers: Rename fs to filesystem
  • api: custom_block_volumes
  • shared/api: Add ContentType to storage volume structs
  • lxd/migration: Add ContentType to structs
  • lxd/db/cluster: Add content type to storage volumes
  • lxd/db: Add content type constants
  • lxd/db: Add content type to storage volumes
  • lxd/storage/utils: Add content type conversion functions
  • lxd: Support custom block volumes
  • lxd/storage: Show type in error
  • lxd/device/disk: Handle custom block volumes
  • client: Support custom block volumes
  • lxc/storage_volume: Support custom block volumes
  • test/suites: Add tests for custom block volumes
  • po: Update translations
  • lxd/storage: Backward compatibility for content types
  • doc/storage: Document block storage volumes
  • lxd/util: Detect hugetlbfs mount point
  • lxd/cluster: Always check for dqlite protocol version mismatches
  • lxd/cluster: Don’t run unncessary HEAD probe upon dqlite connections
  • forksyscall: use nsids for shiftfs syscall intercepts
  • lxd/db: Drop ClusterRoleDatabase records from the database
  • lxd/cluster: Fetch database role information directly from raft
  • lxd/storage: Fix regression in truncate handling
  • lxd/cluster: Only look up raft_nodes for resolving the address of node 1
  • i18n: Update translations from weblate

Try it for yourself

This new LXD release is already available for you to try on our demo service.

Downloads

The release tarballs can be found on our download page.

Binary builds are also available for:

  • Linux: snap install lxd
  • MacOS: brew install lxc
  • Windows: choco install lxc
5 Likes

Should be available in the candidate channel in the next couple of hours and depending on feedback will either be release to stable tomorrow or on Monday.

Submitted to openSUSE. :smiley:

1 Like

I <3 this.

Could I suggest adding --console to lxc launch in addition to lxc start/restart?

1 Like

Whilst applying above to a vm might work, attaching to a container throws:
Custom block volumes cannot be used on containers

Manually creating a unix loop device or a zfs zvol and mounting as unix-block /dev/xyz to a container still works.

Any reason, why custom block volume cant be added to container?

No particular reason, it would work a bit differently, effectively requiring a path property be set so we know where to make the block device available.

It would likely be confusing to some users who would then assume that it can be freely partitioned and mounted, which it won’t, but if you’re just looking at running something against a block device, we could make that work.

Feel free to file a bug at Issues · lxc/lxd · GitHub and we’ll likely find someone to make this work soon.

That would be fantastic.

It would make the storage volume mounting procedure unified and consistent throughout instance types and storage types.

Then by now, it breaks somehow and make the custom block storage sort of useless for containers, as it cant be directly mounted or losetup.