Skip to content

Concepts ​

This page explains the handful of ideas vz is built on. Once they click, the lab file and the commands read naturally.

Lab and lab file ​

A lab is a set of VMs and the networks between them, described in one YAML file, usually called lab.yaml. Commands look for ./lab.yaml unless you pass -f <file>.

A lab file has a schemaVersion (27, the macOS release the format is for), a name and lists of nodes, switches, links and storages. The name is used for the lab's state directory, for stable MAC addresses and in vz ls, so two labs that run at the same time need different names.

vz describes infrastructure only: CPUs, memory, disks, NICs and cables. It never logs into a guest to configure it. What happens inside a guest is up to you, through cloud-init at first boot or any tool you like afterwards (SSH, Ansible, ...).

Nodes ​

A node is one virtual machine. The lab file describes its hardware: CPUs and memory, its disks, its NICs, and optional extras: shared folders, displays, clipboard, sound, USB devices, Rosetta, nested virtualization and Secure Boot. It always has an entropy device and a memory balloon.

Platforms ​

Apple's Virtualization framework has two machine types, and a node's platform picks one:

platformMachineRuns
generic (default)Apple's generic Arm machine with UEFI and a serial consolewhatever the disks hold: Linux, an installer, your own OS
appleApple's Mac machinemacOS, installed from a restore image on the first start

Everything that differs between the two lives in that platform's code. Most nodes never set platform at all.

Disks, pulled files and USB media ​

A node boots the files under disks. vz image pull downloads a cloud disk or installer ISO and converts it (qcow2, tar.xz, xz) into a file you list there. With overlay: true that file stays read-only and every write goes to a private overlay. A disk on bus: usb can be ejected and inserted while the node runs (vz media eject and vz media insert).

A platform: apple node lists the macOS restore image (.ipsw) under disks too, next to an empty disk: the first start installs macOS, the screen opens with vz node display, and there is no serial console. Every other node is the same generic UEFI machine, whatever disk it boots.

See Images and Storage.

Disks and overlays ​

Disks are files on your Mac: .raw/.img, .asif (Apple's sparse image format) or .iso. With overlay: true the file is a read-only base and every write goes to a private overlay in the lab's state directory. Many nodes, in many labs, can boot from the same pulled image at once, and vz node reset throws the overlay away to get a clean disk.

See Storage.

cloud-init ​

init: points at a user-data file or at a folder of cloud-init seed files. vz packs it into a small read-only disk labelled cidata, which cloud-init in the guest reads at first boot to create users, install packages and configure the network.

See cloud-init.

Networks ​

Every NIC of a node is an interface with a name you choose (mgmt, eth1, p2p, ...). The name is a label for vz commands only; the guest sees ordinary virtio NICs, in the order you list them. A NIC is plugged into one of two things with attach::

Switch (attach: switch/<name>)Link (attach: link/<name>)
IsA vmnet network, like a physical switchA cable between exactly two NICs
MembersAny number of NICs, plus your MacExactly two NICs on two different nodes
ServicesDHCP, DNS proxy, IPv6 router advertisements, NAT, port forwardingNone: frames pass unchanged
Mac reachableYes, the Mac has the first address of the subnetNo, the Mac is not on the path
Typical useManagement network, internet access, LANsRouter-to-router links, VLAN trunks, bonds

A switch with nat4 or nat6 is in shared mode (NAT to the internet). Without either it is in host mode: VMs and the Mac only. A NIC without attach is free: present in the guest, but plugged into nothing.

Each NIC gets a stable MAC address, derived from the lab, node and interface names unless you set mac:. The same names give the same MAC on every Mac and every run.

At runtime you can unplug and plug cables: vz link down <link> affects both ends, vz port down <node>/<interface> one NIC.

See Networking.

The lab process ​

vz up starts a lab process in the background and returns once the nodes are running. That process owns the VMs, the switches and the cables for as long as the lab runs; closing your terminal does not stop it. All other commands (node ls, node console, link down, down, ...) talk to it through a Unix socket in the state directory.

Inside a running lab each node has its own state (running, paused, stopped, ...). vz node stop shuts one node down while the others keep running; the lab ends when every node has stopped or when you run vz down.

See Managing labs.

State ​

Everything a lab creates while it runs goes into its state directory, by default ~/.vz/state/<lab name>/: the control socket, the process id, the log of the lab process, and per node its UEFI variables, machine identifier, disk overlays, cloud-init seed and console logs. Your lab folder stays clean, so it can live in git.

CommandEffect on state
vz downKeeps everything; the next up continues where you left off
vz node reset <node>Deletes that node's overlays, cache layers, UEFI variables and seed
vz destroyDeletes the whole state directory

Pulled images in ~/.vz/images are never changed by any of these.

See Files and environment.

Glossary ​

TermMeaning
LabA set of nodes, switches and links from one lab file
NodeOne VM
ImageA cloud disk, qcow2 or ISO that vz image pull downloads and converts into a file
PlatformThe machine type of a node: generic (UEFI, default) or apple (macOS)
Restore imageA macOS .ipsw: installer media for an apple node, listed under disks
USB mediaA disk with bus: usb, ejected and inserted with vz media
OverlayA private, writable layer on top of a read-only base disk
StorageA named disk in storages: that several nodes can reference
SeedThe cidata disk vz builds from init: for cloud-init
Interface, NICA network card of a node; <node>/<interface> is its port name
SwitchA vmnet network with optional DHCP, DNS, NAT and port forwarding
LinkA point-to-point cable between two NICs
Free NICAn interface without attach
Lab processThe background process that owns a running lab
State directoryWhere a lab keeps its runtime files

See also ​