Project | LXD |
Status | Implemented |
Author(s) | @monstermunchkin |
Approver(s) | @stgraber @tomp |
Release | 5.16 |
Internal ID | LX045 |
Abstract
This introduces the ability to add ISO images as read-only storage volumes which can be attached to VMs.
Rationale
Currently, the only clean way of attaching ISO images to VMs is by adding a disk
device to the instance:
lxc config device add win10 install disk source=/path/to/win.iso
For this to work, LXD needs to have access to /path/to/win.iso
. This however will not work out-of-the-box, if the machines of the client and LXD aren’t the same. First, the ISO would need to be uploaded to the LXD host. Then, the device could be attached to the instance.
There are two unclean ways of performing this task which are via the migration API, and via the custom volume restore.
A clean solution for this task would be to allow importing an ISO image.
This will also make it easier in the LXD UI to import ISOs as storage volumes, as dealing with protobuf and migration makes it slightly harder.
Specification
Design
A new content type iso
for custom storage volumes will be introduced. That is to distinguish normal block volumes from ISOs, as the latter will be attached as cdrom to the instance. Normal block volumes are attached as disks.
In order to upload ISO images, the existing lxc storage volume import
command will be used:
lxc storage volume import <pool> /path/to/win.iso <volume_name> --type=iso
This makes use of the existing POST /1.0/storage-pools/<pool>/volumes/custom
API endpoint which currently handles importing storage volume backups. If LXD detects an ISO header, it will create a new custom volume with the iso
content type.
The created custom volume will be marked as read-only as ISOs shouldn’t be read-write.
Custom volumes of content type iso
cannot be updated. Instead they need to be deleted and re-created. Also, since these volumes are read-only, neither snapshots nor backups will be supported.
Although setting a volume name when importing backups is optional, it is required when import ISOs. Backups contain a special file containing information e.g. volume name, and pool. For ISOs this isn’t the case, therefore the volume name needs to be set explicitly.
If the filepath suffix is .iso
, the --type=iso
flag can be omitted as it is set automatically in this case.
API changes
No API endpoint changes.
There will be a new X-LXD-type
header which needs to be set to iso
when wanting to create an ISO custom volume.
CLI changes
The lxc storage volume import
command will gain a new flag --type
. This needs to be set to iso
if importing an ISO. The default value is backup
which imports the data as a backup.
Database changes
No database changes.
Upgrade handling
No upgrade handling.
Further information
No further information.