3
0
Fork 0
forked from mirrors/nixpkgs

nixos/libvirtd: always start libvirtd

Previously we did socket-activation but this breaks the autostart
feature since upstream expects libvirtd to be started unconditionally on
boot.

Fixes #171623.
This commit is contained in:
Franz Pletz 2022-11-11 01:10:37 +01:00
parent 2a63e4f902
commit d82f52519a
No known key found for this signature in database
GPG key ID: 846FDED7792617B4
2 changed files with 7 additions and 3 deletions

View file

@ -336,6 +336,7 @@ in
};
systemd.services.libvirtd = {
wantedBy = [ "multi-user.target" ];
requires = [ "libvirtd-config.service" ];
after = [ "libvirtd-config.service" ]
++ optional vswitch.enable "ovs-vswitchd.service";

View file

@ -26,7 +26,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
in ''
start_all()
virthost.wait_for_unit("sockets.target")
virthost.wait_for_unit("multi-user.target")
with subtest("enable default network"):
virthost.succeed("virsh net-start default")
@ -46,13 +46,16 @@ import ./make-test-python.nix ({ pkgs, ... }: {
virthost.succeed("virsh pool-start zfs_storagepool")
virthost.succeed("virsh vol-create-as zfs_storagepool disk1 25MB")
with subtest("check if nixos install iso boots and network works"):
with subtest("check if nixos install iso boots, network and autostart works"):
virthost.succeed(
"virt-install -n nixos --osinfo=nixos-unstable --ram=1024 --graphics=none --disk=`find ${nixosInstallISO}/iso -type f | head -n1`,readonly=on --import --noautoconsole"
"virt-install -n nixos --osinfo nixos-unstable --memory 1024 --graphics none --disk `find ${nixosInstallISO}/iso -type f | head -n1`,readonly=on --import --noautoconsole --autostart"
)
virthost.succeed("virsh domstate nixos | grep running")
virthost.wait_until_succeeds("ping -c 1 nixos")
virthost.succeed("virsh ${virshShutdownCmd} nixos")
virthost.wait_until_succeeds("virsh domstate nixos | grep 'shut off'")
virthost.shutdown()
virthost.wait_for_unit("multi-user.target")
virthost.wait_until_succeeds("ping -c 1 nixos")
'';
})