Merge #54
54: Improve network logging r=Mic92 a=Mic92 Co-authored-by: Jörg Thalheim <joerg@thalheim.io>
This commit is contained in:
commit
db6dd03a3c
3 changed files with 34 additions and 5 deletions
10
bors.toml
Normal file
10
bors.toml
Normal file
|
@ -0,0 +1,10 @@
|
|||
cut_body_after = "" # don't include text from the PR body in the merge commit message
|
||||
status = [
|
||||
# garnix
|
||||
"Evaluate flake.nix",
|
||||
"package netboot-nixos-2211 [x86_64-linux]",
|
||||
"package kexec-installer-nixos-2211 [x86_64-linux]",
|
||||
"package kexec-installer-nixos-unstable [x86_64-linux]",
|
||||
"check kexec-installer-unstable [x86_64-linux]",
|
||||
"package netboot-nixos-unstable [x86_64-linux]"
|
||||
]
|
|
@ -1,6 +1,6 @@
|
|||
{ config, lib, modulesPath, pkgs, ... }:
|
||||
let
|
||||
restoreNetwork = pkgs.writers.writePython3 "restore-network" {
|
||||
restore-network = pkgs.writers.writePython3 "restore-network" {
|
||||
flakeIgnore = ["E501"];
|
||||
} ./restore_routes.py;
|
||||
|
||||
|
@ -106,7 +106,7 @@ in {
|
|||
pkgs.jq
|
||||
];
|
||||
|
||||
systemd.services.restoreNetwork = {
|
||||
systemd.services.restore-network = {
|
||||
before = [ "network-pre.target" ];
|
||||
wants = [ "network-pre.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
@ -115,7 +115,7 @@ in {
|
|||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStart = [
|
||||
"${restoreNetwork} /root/network/addrs.json /root/network/routes-v4.json /root/network/routes-v6.json /etc/systemd/network"
|
||||
"${restore-network} /root/network/addrs.json /root/network/routes-v4.json /root/network/routes-v6.json /etc/systemd/network"
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -126,6 +126,25 @@ in {
|
|||
];
|
||||
};
|
||||
|
||||
systemd.services.log-network-status = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
# No point in restarting this. We just need this after boot
|
||||
restartIfChanged = false;
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
StandardOutput = "journal+console";
|
||||
ExecStart = [
|
||||
# Allow failures, so it still prints what interfaces we have even if we
|
||||
# not get online
|
||||
"-${pkgs.systemd}/lib/systemd/systemd-networkd-wait-online"
|
||||
"${pkgs.iproute2}/bin/ip -c addr"
|
||||
"${pkgs.iproute2}/bin/ip -c -6 route"
|
||||
"${pkgs.iproute2}/bin/ip -c -4 route"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Restore ssh host and user keys if they are available.
|
||||
# This avoids warnings of unknown ssh keys.
|
||||
boot.initrd.postMountCommands = ''
|
||||
|
|
|
@ -140,7 +140,7 @@ in makeTest' {
|
|||
# Kexec node1 to the toplevel of node2 via the kexec-boot script
|
||||
node1.succeed('touch /run/foo')
|
||||
node1.fail('hello')
|
||||
node1.succeed('tar -xf ${nodes.node2.config.system.build.kexecTarball}/nixos-kexec-installer-${pkgs.system}.tar.gz -C /root')
|
||||
node1.succeed('tar -xf ${nodes.node2.system.build.kexecTarball}/nixos-kexec-installer-${pkgs.system}.tar.gz -C /root')
|
||||
node1.execute('/root/kexec/run')
|
||||
# wait for machine to kexec
|
||||
node1.execute('sleep 9999', check_return=False)
|
||||
|
@ -156,7 +156,7 @@ in makeTest' {
|
|||
assert root_ed25519_before == root_ed25519_after, f"{root_ed25519_before} != {root_ed25519_after}"
|
||||
|
||||
# See if we can reach the router after kexec
|
||||
node1.wait_for_unit("restoreNetwork.service")
|
||||
node1.wait_for_unit("restore-network.service")
|
||||
node1.wait_until_succeeds("cat /etc/systemd/network/eth1.network >&2")
|
||||
node1.wait_until_succeeds("ping -c1 10.0.0.1")
|
||||
node1.wait_until_succeeds("ping -c1 2001:db8::1")
|
||||
|
|
Loading…
Reference in a new issue