diff --git a/adapters/container-runner-finalize.sh b/adapters/container-runner-finalize.sh index ee87bd5..02bb17b 100644 --- a/adapters/container-runner-finalize.sh +++ b/adapters/container-runner-finalize.sh @@ -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. diff --git a/adapters/container-runner-package.sh b/adapters/container-runner-package.sh index ba63cf5..32b0c3e 100644 --- a/adapters/container-runner-package.sh +++ b/adapters/container-runner-package.sh @@ -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 ); without it only root can start guests. diff --git a/src/lib.rs b/src/lib.rs index 0a5bca5..61d6f3b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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]