Testing in QEMU
Try the USB installer, a cloud seed or the role in a virtual machine before using real hardware.
provision/bin/qemu.py in the provisioning source boots an installer image, an installed disk or a cloud image in QEMU with UEFI firmware. It is the safe place to test a disk policy or a seed.
What you need
QEMU, OVMF firmware and cloud-image-utils on your machine. Optionally Canonical's autoinstall validator. Image file names and OVMF paths differ between distributions, so pass the files you really have, not the example paths below.
Make a test host
Create a separate host with target: cloud and the recovery SSH CIDR 10.0.2.2/32, QEMU's address for your machine. For the USB installer, use disk mode auto, or serial with the virtual serial ROOKERY_TEST_DISK. Check the virtio disk's udev identifier in the VM installer if it differs.
Never put a physical machine's disk serial into a VM seed, or a VM's into a physical one.
Run it
Build the test ISO, then install from it:
python3 provision/bin/qemu.py install --directory build/vm-install \
--image build/agent-qemu-autoinstall.iso \
--code /path/to/OVMF_CODE.fd --vars /path/to/OVMF_VARS.fdAfter the installer powers off, boot the installed disk without the ISO:
python3 provision/bin/qemu.py boot --directory build/vm-install \
--code /path/to/OVMF_CODE.fd --vars /path/to/OVMF_VARS.fdThe runner creates its own qcow2 disk and writable firmware variables and refuses to overwrite an existing test directory. By default the VM has 4 vCPUs and 8 GiB RAM, with port 2222 on loopback forwarded to the guest's SSH.
| Option | Effect |
|---|---|
--headless | No window; the guest's serial console on standard input and output |
--tcg | Run without KVM |
--memory, --cpus, --port | Change the defaults above |
--serial | The virtual disk's serial, ROOKERY_TEST_DISK by default |
Without the tailnet, reach the desktop and T3 through the forwarded SSH port:
ssh -p 2222 -L 16080:127.0.0.1:6080 -L 13773:127.0.0.1:3773 ops@127.0.0.1What to check
- Provision twice. The second run should not change anything.
- Reboot without logging in, and check that the desktop, noVNC, T3 and Docker come back.
- Reconnect to the same desktop.
- Run
rookery run HOST smokeand check the sandboxed browser, sudo from a command T3 started, and GUI input. - Give a wrong disk serial and check that the installer refuses.
- On a laptop, also test the lid, AC and battery.
From a source checkout, ci/run.sh boot cloud and ci/run.sh boot iso run the cloud seed and the installer this way unattended and check most of the list above. See Validation.
Last updated on