vmspawn: add nvme disk type support

Extend --image-disk-type= and the --extra-drive= disk type prefix to
support nvme in addition to virtio-blk and virtio-scsi:

  systemd-vmspawn --image-disk-type=nvme --image=image.raw
  systemd-vmspawn --image=image.raw --extra-drive=nvme:data.raw

The NVMe serial number is limited to 20 characters by the NVMe spec.
If the image filename exceeds this, it is hashed with SHA-256 and
truncated to 20 hex characters via the disk_serial() helper introduced
in the previous commit.

Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christian Brauner
2026-03-24 16:53:41 +01:00
parent e4a58c38e9
commit b76e1732f7
5 changed files with 28 additions and 7 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ _systemd_vmspawn() {
elif __contains_word "$prev" ${OPTS[IMAGE_FORMAT]}; then
comps='raw qcow2'
elif __contains_word "$prev" ${OPTS[IMAGE_DISK_TYPE]}; then
comps='virtio-blk virtio-scsi'
comps='virtio-blk virtio-scsi nvme'
elif __contains_word "$prev" ${OPTS[ARG]}; then
comps=''
else