Skip to content

Schema reference ​

Every object and field of lab.yaml, generated from the JSON Schema (https://raw.githubusercontent.com/rayanparsa/vz/refs/heads/main/schema/27.json).

  • Lab file reference explains what each part does, with examples.
  • Validation lists the checks vz validate runs beyond the schema, such as names that must exist, subnets that must not overlap and MACs that must be unique.

Keys not listed here are errors. Paths are relative to the lab file, and ~ is your home folder.

Map ​

text
lab.yaml
├── storages.<name>                 Storage
├── nodes[]                         Node
│   ├── disks[]                     Disk
│   ├── shares[]                    Share
│   ├── displays[]                  Display
│   ├── sound                       Sound
│   ├── usb[]                       USB device
│   └── interfaces[]                Interface
├── links.<name>                    Link
└── switches.<name>                 Switch
    ├── dhcpReservations[]          DHCP reservation
    └── portForwarding[]            Port forwarding rule

Contents ​

Lab ​

The top level of lab.yaml.

Declarative lab for vz: Linux and macOS VMs, vmnet switches and socketpair links on macOS 27 Virtualization.framework. Only infrastructure is described; nothing inside the guests is configured, except an optional cloud-init seed supplied by the user.

FieldTypeRequiredDefaultDescription
schemaVersion27yesVersion of the lab file format, named after the macOS release it is for: 27 is macOS 27, matching this file's name (27.json).
namenameyesLab name. Used for stable MAC addresses, cloud-init instance-id, the background process and 'vz ls'. Must be unique among running labs.
statestring, not emptyDirectory for per-node runtime state: UEFI variable store, machine identifier, disk overlays and cache layers, console logs, cloud-init seeds, control socket. Relative to the lab file. Default: ~/.vz/state/<name>. Two labs must never share a state directory.
storagesmap of name to storage{}Named, reusable disks. A writable storage can be used by only one running node at a time; read-only use can be shared (checked by vz).
nodeslist of nodeyesVirtual machines: generic UEFI machines that boot their disks, or macOS guests (platform: apple). Node names must be unique (checked by vz).
linksmap of name to link{}Point-to-point cables (socketpair + VZFileHandleNetworkDeviceAttachment). Each link must be referenced by exactly two interfaces on two different nodes (checked by vz).
switchesmap of name to switch{}Virtual switches backed by vmnet networks (vmnet_network_create + VZVmnetNetworkDeviceAttachment). The Mac host is always a member.

Storage ​

Where: storages.<name>

A named disk file. Nodes use it from disks with storage: <name>.

FieldTypeRequiredDefaultDescription
pathstring, not emptyyesDisk file. Format is inferred from the extension (.asif, .raw/.img, .iso, .ipsw). Created if missing and size is set (.asif and .raw/.img only).
sizesizeSize used when creating the file.
yaml
storages:
  shared:
    path: disks/shared.asif
    size: 20GiB

Node ​

Where: nodes[]

A VM. platform picks the machine type (generic by default). Generic nodes boot with UEFI (VZEFIBootLoader) and a serial console (live via 'vz node console'). Apple nodes run macOS: Mac graphics (vz node display), no serial console, and an install from the listed IPSW on the first start. Always present, no keys: entropy (VZVirtioEntropyDeviceConfiguration), memory balloon (VZVirtioTraditionalMemoryBalloonDeviceConfiguration). Keyboard and pointer are added automatically with a display (one by default).

FieldTypeRequiredDefaultDescription
namenameyesNode name. Also the guest hostname cloud-init sets, and the name vz node commands take.
platformgeneric | applegenericMachine type. generic: Apple's generic Arm machine with UEFI firmware and the virtio serial console; it boots whatever the disks hold (Linux, an installer ISO, your own OS). apple: Apple's Mac machine for macOS; list a .ipsw restore image under disks and macOS installs onto the first other disk on the first start. Experimental.
cpusinteger, at least 11VZVirtualMachineConfiguration.cpuCount
memorysize1GiBVZVirtualMachineConfiguration.memorySize
nestedVirtualizationbooleanfalseVZGenericPlatformConfiguration.isNestedVirtualizationEnabled. Requires M3 or newer. Generic platform only.
secureBootbooleanfalseUEFI Secure Boot for Linux guests (macOS 27). Only signed bootloaders and kernels will boot. Generic platform only.
rosettabooleanfalseExpose Rosetta to the guest (VZLinuxRosettaDirectoryShare) with tag 'rosetta'. Generic platform only.
consoleLogbooleanfalseAlso write the serial console to <state>/<node>/console-<timestamp>.log, one file each time the lab starts the node (a reboot inside the guest keeps writing to the same file).
diskslist of disk, at least 1yesStorage devices in boot order. UEFI boots from the first bootable one. A .ipsw (platform apple) is installer media: read by the installer, never attached, and it keeps its index.
initstring, not emptyFirst-boot data. generic: a cloud-init NoCloud seed, attached as a read-only 'cidata' disk after all other disks; a file is used as user-data (vz generates meta-data with instance-id and local-hostname), a directory is packed as-is (user-data, meta-data, network-config, vendor-data). apple: the same #cloud-config user-data, read by vz: the first user (name, plain_text_passwd or chpasswd, gecos) becomes the account macOS creates on its first boot, and ssh_pwauth turns Remote Login on (default) or off.
shareslist of share[]VirtioFS shares (VZVirtioFileSystemDeviceConfiguration + VZSingleDirectoryShare), one folder per item. Mount in guest with: mount -t virtiofs <tag> <dir>. Tags must be unique per node and 'rosetta' is reserved (checked by vz).
displayslist of display[{width: 1280, height: 800}]VZVirtioGraphicsDeviceConfiguration scanouts. 2D only, no GPU acceleration. Shown in a vz window (VZVirtualMachineView) by 'vz node display'. Without this key a node gets one 1280x800 display; [] turns graphics off.
clipboardbooleanfalseClipboard sharing via SPICE agent port (VZSpiceAgentPortAttachment). Needs displays and spice-vdagent in the guest. Generic platform only.
soundsoundVZVirtioSoundDeviceConfiguration. Uses the macOS default output and input devices.
usblist of usb device[]USB passthrough via Accessory Access (macOS 27). Needs a vz signed with a Developer ID and the com.apple.developer.accessory-access.usb entitlement; ad-hoc signed builds cannot claim USB devices. Isochronous devices (webcams, USB audio) are not expected to work.
interfaceslist of interface[]NICs (VZVirtioNetworkDeviceConfiguration). List order is PCI order in the guest. Interface names must be unique within the node (checked by vz).

Rules:

  • When clipboard: true: displays needs at least 1 entry.
yaml
nodes:
  - name: vm1
    cpus: 2
    memory: 2GiB
    disks:
      - path: ~/.vz/images/debian-13-genericcloud-arm64.raw
        overlay: true
        size: 20GiB
    init: init/vm1
    interfaces:
      - name: mgmt
        attach: switch/mgmt
        mac: "52:54:00:30:01:00"

Disk ​

Where: nodes[].disks[]

A disk of a node: a file (path) or a named storage (storage).

FieldTypeRequiredDefaultDescription
busvirtio | nvme | usbvirtiovirtio: VZVirtioBlockDeviceConfiguration (/dev/vdX). nvme: VZNVMExpressControllerDeviceConfiguration (/dev/nvmeXn1). usb: VZUSBMassStorageDeviceConfiguration (removable at runtime).
pathstring, not emptyDisk file. Format is inferred from the extension (.asif, .raw/.img, .iso, .ipsw). Created if missing and size is set (.asif and .raw/.img only).
storagenameName of an entry in storages.
sizesizeWith path: size of a new file when the file is missing. With overlay: the size the guest sees, 10GiB when not set (or the base image size, if larger). At least the base image; can grow later, never shrink. The guest grows its partition itself, e.g. cloud-init growpart on boot.
readOnlybooleanfalseAttach the disk read-only: the guest cannot write to it.
overlaybooleanfalseDiskImageKit stack: the file is a read-only base, writes go to a private ASIF overlay in the state directory.
cachebooleanfalseAdd an ASIF cache layer between base and overlay, for bases on slow storage (NAS). Requires overlay.
cachingautomatic | cached | uncachedautomaticVZDiskImageCachingMode
syncfull | fsync | nonefullVZDiskImageSynchronizationMode
connectedbooleantrueUSB disks only: plugged in at boot. Can be detached and attached at runtime.

Rules:

  • When cache: true: overlay: true is needed.
  • When connected is set: bus: usb is needed.
  • Set exactly one of path and storage.
  • size is not allowed with storage.
yaml
nodes:
  - name: vm1
    disks:
      - path: ~/.vz/images/debian-13-genericcloud-arm64.raw
        overlay: true
        size: 20GiB

Share ​

Where: nodes[].shares[]

A folder on the Mac shared with the guest over VirtioFS.

FieldTypeRequiredDefaultDescription
tagstring matching ^[A-Za-z0-9][A-Za-z0-9._-]{0,35}$yesVirtioFS tag used by the guest to mount the share.
pathstring, not emptyyesFolder on the Mac. Relative to the lab file; ~ allowed.
readOnlybooleanfalseThe guest can read the folder but not write to it.
yaml
nodes:
  - name: vm1
    shares:
      - tag: code
        path: ~/src
        readOnly: true

Display ​

Where: nodes[].displays[]

A virtual display. Open its window with vz node display.

FieldTypeRequiredDefaultDescription
widthinteger, 320 to 8192yesWidth in pixels.
heightinteger, 200 to 8192yesHeight in pixels.
yaml
nodes:
  - name: vm1
    displays:
      - width: 1920
        height: 1080

Sound ​

Where: nodes[].sound

VZVirtioSoundDeviceConfiguration. Uses the macOS default output and input devices.

FieldTypeRequiredDefaultDescription
outputbooleanfalsePlay guest audio on the Mac's default output device.
inputbooleanfalseGive the guest the Mac's default input device (microphone).
yaml
nodes:
  - name: vm1
    sound:
      output: true

USB device ​

Where: nodes[].usb[]

USB passthrough via Accessory Access (macOS 27). Needs a vz signed with a Developer ID and the com.apple.developer.accessory-access.usb entitlement; ad-hoc signed builds cannot claim USB devices. Isochronous devices (webcams, USB audio) are not expected to work.

FieldTypeRequiredDefaultDescription
vendorIdusbIdyesUSB vendor id of the device, as lsusb or System Information shows it.
productIdusbIdyesUSB product id of the device.
yaml
nodes:
  - name: vm1
    usb:
      - vendorId: "0x0403"
        productId: "0x6001"

Interface ​

Where: nodes[].interfaces[]

A network card (virtio). attach decides what it is plugged into.

FieldTypeRequiredDefaultDescription
namestring matching ^[a-zA-Z][a-zA-Z0-9._-]{0,14}$yesLabel used by vz to reference this NIC. Not pushed into the guest.
attachstring matching ^(switch|link)/[a-z][a-z0-9-]{0,62}$What this NIC is plugged into: switch/<name> or link/<name>. Omit for a free NIC.
macmacMAC address (VZMACAddress). If omitted, vz derives a stable one from lab, node and interface names.
connectedbooleantrueWhether the cable is plugged in at boot. Toggled at runtime by swapping the NIC attachment.

Rules:

  • connected needs attach.
yaml
nodes:
  - name: vm1
    interfaces:
      - name: eth1
        attach: link/r1-r2
        connected: true

Where: links.<name>

A point-to-point cable between two NICs on two different nodes. The Mac is not a member.

FieldTypeRequiredDefaultDescription
mtumtu1500VZFileHandleNetworkDeviceAttachment.maximumTransmissionUnit, applied to both ends.
buffersizeAdvanced: SO_SNDBUF/SO_RCVBUF of the socketpair. vz picks a default.
yaml
links:
  r1-r2:
    mtu: 9000

Switch ​

Where: switches.<name>

A vmnet network. The Mac is always a member and gets the first address of the subnet.

FieldTypeRequiredDefaultDescription
nat4booleanfalseIPv4 NAT to the internet. false -> vmnet_network_configuration_disable_nat44. If nat4 and nat6 are both false the switch uses VMNET_HOST_MODE, otherwise VMNET_SHARED_MODE.
nat6booleanfalseIPv6 NAT to the internet. false -> vmnet_network_configuration_disable_nat66.
ipv4Subnetipv4Cidrvmnet_network_configuration_set_ipv4_subnet. The Mac gets the first address. Must not overlap other switches (checked by vz).
ipv6Prefixipv6Prefixvmnet_network_configuration_set_ipv6_prefix
mtumtu1500vmnet_network_configuration_set_mtu
dhcpbooleantrueBuilt-in DHCP server. false -> vmnet_network_configuration_disable_dhcp.
dhcpReservationslist of dhcp reservation[]Optional fixed IPv4 addresses by MAC (vmnet_network_configuration_add_dhcp_reservation, IPv4 only). Without them, guests get addresses from the DHCP pool. MAC should match an interface attached to this switch (checked by vz).
dnsProxybooleantrueBuilt-in DNS proxy. false -> vmnet_network_configuration_disable_dns_proxy.
routerAdvertisementbooleantrueIPv6 router advertisement. false -> vmnet_network_configuration_disable_router_advertisement.
portForwardinglist of port forwarding rule[]vmnet_network_configuration_add_port_forwarding_rule. Only valid when NAT is enabled.

Rules:

  • When nat4: false (also when not set) and nat6: false (also when not set): portForwarding is not allowed.
  • When dhcp: false: dhcpReservations is not allowed.
yaml
switches:
  mgmt:
    nat4: true
    ipv4Subnet: "10.30.0.0/24"
    dhcpReservations:
      - mac: "52:54:00:30:01:00"
        ipv4: "10.30.0.11"
    portForwarding:
      - protocol: tcp
        hostPort: 2222
        address: "10.30.0.11"
        guestPort: 22

DHCP reservation ​

Where: switches.<name>.dhcpReservations[]

Optional fixed IPv4 addresses by MAC (vmnet_network_configuration_add_dhcp_reservation, IPv4 only). Without them, guests get addresses from the DHCP pool. MAC should match an interface attached to this switch (checked by vz).

FieldTypeRequiredDefaultDescription
macmacyesMAC of a NIC on this switch.
ipv4IPv4 addressyesAddress the DHCP server always gives that MAC. Must be inside ipv4Subnet.
yaml
switches:
  mgmt:
    dhcpReservations:
      - mac: "52:54:00:30:01:00"
        ipv4: "10.30.0.11"

Port forwarding rule ​

Where: switches.<name>.portForwarding[]

vmnet_network_configuration_add_port_forwarding_rule. Only valid when NAT is enabled.

FieldTypeRequiredDefaultDescription
protocoltcp | udpyestcp or udp.
familyipv4 | ipv6Address family. If omitted, inferred from address.
hostPortportyesPort on the Mac.
addressIPv4 address or IPv6 addressyesGuest address on this switch.
guestPortportyesPort on the guest.
yaml
switches:
  mgmt:
    portForwarding:
      - protocol: tcp
        hostPort: 2222
        address: "10.30.0.11"
        guestPort: 22

Value formats ​

Fields above that link here share these formats.

name ​

Name of a lab, node, storage, link or switch: a lowercase letter, then lowercase letters, digits and hyphens, 63 characters at most.

  • Type: string matching ^[a-z][a-z0-9-]{0,62}$
  • Examples: lab, web-1

size ​

Byte size with binary unit, e.g. 512MiB, 2GiB.

  • Type: string matching ^[0-9]+(B|KiB|MiB|GiB|TiB)$
  • Examples: 512MiB, 2GiB, 20GiB

mac ​

MAC address (VZMACAddress). If omitted, vz derives a stable one from lab, node and interface names.

  • Type: string matching ^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$
  • Examples: "52:54:00:0a:00:01"

ipv4Cidr ​

IPv4 subnet in CIDR notation.

  • Type: string matching ^((25[0-5]|2[0-4][0-9]|1?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]?[0-9])/([0-9]|[12][0-9]|3[0-2])$
  • Examples: "10.30.0.0/24"

ipv6Prefix ​

IPv6 prefix with its length.

  • Type: string matching ^[0-9a-fA-F:]+/([0-9]|[1-9][0-9]|1[01][0-9]|12[0-8])$
  • Examples: fd00:30::/64

port ​

TCP or UDP port number.

  • Type: integer, 1 to 65535
  • Examples: 22, 8080

mtu ​

Maximum transmission unit in bytes, from 1280 (the IPv6 minimum) to 65535.

  • Type: integer, 1280 to 65535
  • Examples: 1500, 9000

usbId ​

16-bit USB id, as a YAML integer (0x0403) or a hex string ("0x0403").

  • Type: integer, 0 to 65535 or string matching ^0x[0-9a-fA-F]{4}$
  • Examples: "0x0403", 1027