You can now do a fast reboot (bypassing the BIOS, which may take several minutes on servers) by running ‘systemctl kexec’. Unfortunately the QEMU test for this is unreliable due to a QEMU bug (it randomly crashes with a message like ‘Guest moved used index from 8 to 0’), so it's commented out.wip/yesman
parent
5332480454
commit
b825169404
@ -0,0 +1,21 @@ |
||||
{ config, pkgs, ... }: |
||||
|
||||
{ |
||||
environment.systemPackages = [ pkgs.kexectools ]; |
||||
|
||||
systemd.services."prepare-kexec" = |
||||
{ description = "Preparation for kexec"; |
||||
wantedBy = [ "kexec.target" ]; |
||||
before = [ "systemd-kexec.service" ]; |
||||
unitConfig.DefaultDependencies = false; |
||||
serviceConfig.Type = "oneshot"; |
||||
path = [ pkgs.kexectools ]; |
||||
script = |
||||
'' |
||||
p=$(readlink -f /nix/var/nix/profiles/system) |
||||
if ! [ -d $p ]; then exit 1; fi |
||||
exec kexec --load $p/kernel --initrd=$p/initrd --append="$(cat $p/kernel-params) init=$p/init" |
||||
''; |
||||
}; |
||||
|
||||
} |
@ -0,0 +1,18 @@ |
||||
# Test whether fast reboots via kexec work. |
||||
|
||||
{ pkgs, ... }: |
||||
|
||||
{ |
||||
|
||||
machine = { config, pkgs, ... }: |
||||
{ virtualisation.vlans = [ ]; }; |
||||
|
||||
testScript = |
||||
'' |
||||
$machine->waitForUnit("multi-user.target"); |
||||
$machine->execute("systemctl kexec &"); |
||||
$machine->{connected} = 0; |
||||
$machine->waitForUnit("multi-user.target"); |
||||
''; |
||||
|
||||
} |
Loading…
Reference in new issue