Test that adding physical devices to containers works, find that network setup then doesn't work because there is no udev in the container to tell systemd that the device is present. Fixed by not depending on the device in the container. Activate the new container test for release Bonds, bridges and other network devices need the underlying not as dependency when used inside the container. Because the device is already there. But the address configuration needs the aggregated device itself.
67 lines
2 KiB
Nix
67 lines
2 KiB
Nix
|
|
import ./make-test.nix ({ pkgs, ...} : {
|
|
name = "containers-physical_interfaces";
|
|
meta = with pkgs.stdenv.lib.maintainers; {
|
|
maintainers = [ kampfschlaefer ];
|
|
};
|
|
|
|
nodes = {
|
|
server = { config, pkgs, ... }:
|
|
{
|
|
virtualisation.memorySize = 256;
|
|
virtualisation.vlans = [ 1 ];
|
|
|
|
containers.server = {
|
|
privateNetwork = true;
|
|
interfaces = [ "eth1" ];
|
|
|
|
config = {
|
|
networking.interfaces.eth1 = {
|
|
ip4 = [ { address = "10.10.0.1"; prefixLength = 24; } ];
|
|
};
|
|
networking.firewall.enable = false;
|
|
};
|
|
};
|
|
};
|
|
client = { config, pkgs, ... }: {
|
|
virtualisation.memorySize = 256;
|
|
virtualisation.vlans = [ 1 ];
|
|
|
|
containers.client = {
|
|
privateNetwork = true;
|
|
interfaces = [ "eth1" ];
|
|
|
|
config = {
|
|
networking.bridges.br0.interfaces = [ "eth1" ];
|
|
networking.interfaces.br0 = {
|
|
ip4 = [ { address = "10.10.0.2"; prefixLength = 24; } ];
|
|
};
|
|
networking.firewall.enable = false;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
startAll;
|
|
|
|
$server->waitForUnit("default.target");
|
|
$server->execute("ip link >&2");
|
|
|
|
$server->succeed("ip link show dev eth1 >&2");
|
|
|
|
$server->succeed("nixos-container start server");
|
|
$server->waitForUnit("container\@server");
|
|
$server->succeed("systemctl -M server list-dependencies network-addresses-eth1.service >&2");
|
|
|
|
$server->succeed("nixos-container run server -- ip a show dev eth1 >&2");
|
|
|
|
$client->waitForUnit("default.target");
|
|
$client->succeed("nixos-container start client");
|
|
$client->waitForUnit("container\@client");
|
|
$client->succeed("systemctl -M client list-dependencies network-addresses-br0.service >&2");
|
|
$client->succeed("systemctl -M client status -n 30 -l network-addresses-br0.service");
|
|
$client->succeed("nixos-container run client -- ping -w 10 -c 1 -n 10.10.0.1");
|
|
'';
|
|
})
|