Build a disk template
§ 1Purpose
Produce a sealed, reusable qcow2 image in the local store from installer media.
§ 2Prerequisites
- A template {} block exists in vmlab.wcl (or a file passed with -f).
- Its source (ISO/qcow2/template/scratch) is reachable; URL sources have a sha256.
§ 3Flowchart
§ 4Steps
§ 4.11
§ 4.2Define the template
template "linux-modern" {
arch = "x86_64" version = "1.0" profile = "linux-modern" disk = 20GiB
source "iso" { url = "https://.../x.iso" sha256 = "abc123..." }
media { kind = "iso" from = "./cloudinit/" label = "CIDATA" }
nic { nat = true }
provision "scripts/install.ws" { } // drives the installer; installs the guest agent
}
Declare arch, version, profile and the working disk size, exactly one source block, any build media/disks/NIC, and a provision script that drives the installer and installs the QEMU guest agent.
§ 4.32
§ 4.4Build
$ vmlab template build
$ vmlab template build -f templates.wcl linux-modern # one named template
Run vmlab template build. vmlab resolves the source (downloads cached + content-addressed), boots a one-VM build lab, runs the provision, then shuts down, flattens and seals into the store. A failed build leaves nothing behind.
§ 4.53
§ 4.6Confirm it sealed
$ vmlab template list
vmlab template list should show x86_64/linux-modern@1.0. Reference it from a lab as template = "x86_64/linux-modern".
Verification
vmlab template list shows the new <arch>/<name>@<version> ref, and a lab VM referencing it passes vmlab validate.