clusterfuck
This commit is contained in:
parent
1e7317bcb6
commit
e2bd1439e1
|
@ -18,18 +18,18 @@
|
|||
resources = builtins.toFile "cib-resources.xml" ''
|
||||
<resources>
|
||||
${lib.concatMapStrings (container: ''
|
||||
<primitive id="${container}" class="systemd" type="${container}">
|
||||
<primitive id="lxc-${container}" class="systemd" type="lxc@${container}">
|
||||
<operations>
|
||||
<op id=""${container}-start" name="start" interval="0" timeout="10s"/>
|
||||
<op id=""${container}-stop" name="start" interval="0" timeout="10s"/>
|
||||
<op id="${container}-monitor" name="monitor" interval="10s" timeout="10s"/>
|
||||
<op id="stop-${container}" name="start" interval="0" timeout="10s"/>
|
||||
<op id="start-${container}" name="start" interval="0" timeout="10s"/>
|
||||
<op id="monitor-${container}" name="monitor" interval="10s" timeout="10s"/>
|
||||
</operations>
|
||||
</primitive>
|
||||
'') containers}
|
||||
</resources>
|
||||
'';
|
||||
cib-set-resources = writeScriptBin "cib-set-resources" ''
|
||||
!# ${runtimeShell} -e
|
||||
#! ${runtimeShell} -e
|
||||
|
||||
crm_attribute -t crm_config -n stonith-enabled -v false
|
||||
cibadmin --replace --scope resources --xml-file ${resources}
|
||||
|
|
|
@ -131,8 +131,7 @@ let
|
|||
systemctl restart lxc@$c
|
||||
)
|
||||
else
|
||||
echo Starting $c
|
||||
systemctl start lxc@$c
|
||||
echo Ignoring not-running container $c
|
||||
fi
|
||||
done
|
||||
set -e
|
||||
|
@ -236,11 +235,4 @@ in
|
|||
RestartSec = "1s";
|
||||
};
|
||||
};
|
||||
|
||||
# Starts all the containers after boot
|
||||
systemd.targets.lxc-containers = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = map (ctName: "lxc@${ctName}.service")
|
||||
(builtins.attrNames containers);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -85,6 +85,14 @@ in
|
|||
EmitLLDP = true;
|
||||
};
|
||||
};
|
||||
"00-qemu-tap" = {
|
||||
# physical ethernet ports
|
||||
matchConfig.MACAddress = {
|
||||
server1 = "00:02:23:de:ad:41";
|
||||
server2 = "00:02:23:de:ad:42";
|
||||
}.${hostName};
|
||||
networkConfig.Bond = "bond0";
|
||||
};
|
||||
bond0 = {
|
||||
DHCP = "no";
|
||||
matchConfig.Name = "bond0";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Options for running under qemu (vm-packages)
|
||||
{ inputs, lib, options, ... }:
|
||||
{ inputs, config, lib, options, ... }:
|
||||
{
|
||||
# Get internet from qemu user networking
|
||||
systemd.network = lib.optionalAttrs (options.virtualisation ? qemu) {
|
||||
|
@ -23,6 +23,11 @@
|
|||
# keep the store paths built inside the VM across reboots
|
||||
writableStoreUseTmpfs = false;
|
||||
qemu.options = [ "-enable-kvm" ];
|
||||
qemu.networkingOptions = [
|
||||
# Useful for cluster dev
|
||||
"-device" "virtio-net-pci,id=bond,netdev=bond,mac=${config.systemd.network.networks."00-qemu-tap".matchConfig.MACAddress}"
|
||||
"-netdev" "tap,id=bond,ifname=${config.networking.hostName},script=no,downscript=no"
|
||||
];
|
||||
};
|
||||
|
||||
# Let the nix registry point to the state of your local checkout
|
||||
|
|
Loading…
Reference in New Issue