at master 1.6 kB view raw
1{ pkgs, lib, ... }: 2{ 3 name = "kexec"; 4 meta = with lib.maintainers; { 5 maintainers = [ 6 flokli 7 lassulus 8 ]; 9 }; 10 11 nodes = { 12 node1 = 13 { ... }: 14 { 15 virtualisation.vlans = [ ]; 16 virtualisation.memorySize = 4 * 1024; 17 }; 18 19 node2 = 20 { modulesPath, ... }: 21 { 22 virtualisation.vlans = [ ]; 23 environment.systemPackages = [ pkgs.hello ]; 24 imports = [ "${modulesPath}/installer/netboot/netboot.nix" ]; 25 }; 26 }; 27 28 testScript = 29 { nodes, ... }: 30 '' 31 # Test whether reboot via kexec works. 32 node1.wait_for_unit("multi-user.target") 33 node1.succeed('kexec --load /run/current-system/kernel --initrd /run/current-system/initrd --command-line "$(</proc/cmdline)"') 34 node1.execute("systemctl kexec >&2 &", check_return=False) 35 node1.connected = False 36 node1.connect() 37 node1.wait_for_unit("multi-user.target") 38 39 # Check if the machine with netboot-minimal.nix profile boots up 40 node2.wait_for_unit("multi-user.target") 41 node2.shutdown() 42 43 # Kexec node1 to the toplevel of node2 via the kexec-boot script 44 node1.succeed('touch /run/foo') 45 node1.fail('hello') 46 node1.execute('${nodes.node2.system.build.kexecTree}/kexec-boot', check_output=False) 47 node1.connected = False 48 node1.connect() 49 node1.wait_for_unit("multi-user.target") 50 node1.succeed('! test -e /run/foo') 51 node1.succeed('hello') 52 node1.succeed('[ "$(hostname)" = "node2" ]') 53 54 node1.shutdown() 55 ''; 56}