Autostart libvirt's default NAT network

This commit is contained in:
Archipelago 2026-11-17 09:58:13 +00:00
parent 233f3ee21d
commit 54fefef41c
3 changed files with 8 additions and 1 deletions

View file

@ -11,6 +11,11 @@ systemctl --root=/job/core enable libvirtd.service
test -x /job/core/usr/bin/qemu-system-x86_64
test -f /job/core/usr/lib/systemd/system/libvirtd.service
test -f /job/core/usr/share/cockpit/machines/manifest.json
# Start libvirt's stock NAT network on boot. The package ships the definition but
# no autostart link, so a fresh host would otherwise reject a networked guest.
test -f /job/core/etc/libvirt/qemu/networks/default.xml
mkdir -p /job/core/etc/libvirt/qemu/networks/autostart
ln -sfn ../default.xml /job/core/etc/libvirt/qemu/networks/autostart/default.xml
systemctl --root=/job/core set-default multi-user.target
mkdir -p /job/core/etc/cockpit /job/core/etc/NetworkManager/conf.d /job/core/etc/sudoers.d
# Cockpit's stock self-signed certificate; never allow plaintext or unauthenticated use.

View file

@ -31,7 +31,8 @@ Container Runner defaults
- QEMU/KVM and libvirt are installed for Cockpit Machines: qemu-system-x86,
qemu-img, libvirt (+ libvirt-dbus), dnsmasq for the default NAT network,
edk2-ovmf for UEFI guests, swtpm for emulated TPM 2.0 and virt-install for
creating new machines from Cockpit. libvirtd.service is enabled.
creating new machines from Cockpit. libvirtd.service and libvirt's default NAT
network are enabled.
- Hardware virtualisation must be available: check for /dev/kvm. Operators who
manage machines from Cockpit need membership in the kvm group
(usermod -aG kvm <user>); without it only root can start guests.

View file

@ -230,6 +230,7 @@ mod tests {
assert!(finalize.contains("enable libvirtd.service"));
assert!(finalize.contains("qemu-system-x86_64"));
assert!(finalize.contains("share/cockpit/machines/manifest.json"));
assert!(finalize.contains("networks/autostart/default.xml"));
}
#[test]