···81818282- [blocky](https://0xerr0r.github.io/blocky/), fast and lightweight DNS proxy as ad-blocker for local network with many features.
83838484+- [pacemaker](https://clusterlabs.org/pacemaker/) cluster resource manager
8585+8486<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
85878688## Backward Incompatibilities {#sec-release-22.05-incompatibilities}
···11+import ./make-test-python.nix ({ pkgs, lib, ... }: rec {
22+ name = "pacemaker";
33+ meta = with pkgs.lib.maintainers; {
44+ maintainers = [ astro ];
55+ };
66+77+ nodes =
88+ let
99+ node = i: {
1010+ networking.interfaces.eth1.ipv4.addresses = [ {
1111+ address = "192.168.0.${toString i}";
1212+ prefixLength = 24;
1313+ } ];
1414+1515+ services.corosync = {
1616+ enable = true;
1717+ clusterName = "zentralwerk-network";
1818+ nodelist = lib.imap (i: name: {
1919+ nodeid = i;
2020+ inherit name;
2121+ ring_addrs = [
2222+ (builtins.head nodes.${name}.networking.interfaces.eth1.ipv4.addresses).address
2323+ ];
2424+ }) (builtins.attrNames nodes);
2525+ };
2626+ environment.etc."corosync/authkey" = {
2727+ source = builtins.toFile "authkey"
2828+ # minimum length: 128 bytes
2929+ "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest";
3030+ mode = "0400";
3131+ };
3232+3333+ services.pacemaker.enable = true;
3434+3535+ # used for pacemaker resource
3636+ systemd.services.ha-cat = {
3737+ description = "Highly available netcat";
3838+ serviceConfig.ExecStart = "${pkgs.netcat}/bin/nc -l discard";
3939+ };
4040+ };
4141+ in {
4242+ node1 = node 1;
4343+ node2 = node 2;
4444+ node3 = node 3;
4545+ };
4646+4747+ # sets up pacemaker with resources configuration, then crashes a
4848+ # node and waits for service restart on another node
4949+ testScript =
5050+ let
5151+ resources = builtins.toFile "cib-resources.xml" ''
5252+ <resources>
5353+ <primitive id="cat" class="systemd" type="ha-cat">
5454+ <operations>
5555+ <op id="stop-cat" name="start" interval="0" timeout="1s"/>
5656+ <op id="start-cat" name="start" interval="0" timeout="1s"/>
5757+ <op id="monitor-cat" name="monitor" interval="1s" timeout="1s"/>
5858+ </operations>
5959+ </primitive>
6060+ </resources>
6161+ '';
6262+ in ''
6363+ import re
6464+ import time
6565+6666+ start_all()
6767+6868+ ${lib.concatMapStrings (node: ''
6969+ ${node}.wait_until_succeeds("corosync-quorumtool")
7070+ ${node}.wait_for_unit("pacemaker.service")
7171+ '') (builtins.attrNames nodes)}
7272+7373+ # No STONITH device
7474+ node1.succeed("crm_attribute -t crm_config -n stonith-enabled -v false")
7575+ # Configure the cat resource
7676+ node1.succeed("cibadmin --replace --scope resources --xml-file ${resources}")
7777+7878+ # wait until the service is started
7979+ while True:
8080+ output = node1.succeed("crm_resource -r cat --locate")
8181+ match = re.search("is running on: (.+)", output)
8282+ if match:
8383+ for machine in machines:
8484+ if machine.name == match.group(1):
8585+ current_node = machine
8686+ break
8787+ time.sleep(1)
8888+8989+ current_node.log("Service running here!")
9090+ current_node.crash()
9191+9292+ # pick another node that's still up
9393+ for machine in machines:
9494+ if machine.booted:
9595+ check_node = machine
9696+ # find where the service has been started next
9797+ while True:
9898+ output = check_node.succeed("crm_resource -r cat --locate")
9999+ match = re.search("is running on: (.+)", output)
100100+ # output will remain the old current_node until the crash is detected by pacemaker
101101+ if match and match.group(1) != current_node.name:
102102+ for machine in machines:
103103+ if machine.name == match.group(1):
104104+ next_node = machine
105105+ break
106106+ time.sleep(1)
107107+108108+ next_node.log("Service migrated here!")
109109+ '';
110110+})
+6-1
pkgs/misc/logging/pacemaker/default.nix
···1717, pam
1818, pkg-config
1919, python3
2020+, nixosTests
20212122# Pacemaker is compiled twice, once with forOCF = true to extract its
2223# OCF definitions for use in the ocf-resource-agents derivation, then
···8788 rm -r $out/nix
8889 '';
89909191+ passthru.tests = {
9292+ inherit (nixosTests) pacemaker;
9393+ };
9494+9095 meta = with lib; {
9196 homepage = "https://clusterlabs.org/pacemaker/";
9297 description = "Pacemaker is an open source, high availability resource manager suitable for both small and large clusters.";
9398 license = licenses.gpl2Plus;
9499 platforms = platforms.linux;
9595- maintainers = with maintainers; [ ryantm ];
100100+ maintainers = with maintainers; [ ryantm astro ];
96101 };
97102}
+4
pkgs/servers/corosync/default.nix
···6565 --prefix PATH ":" "$out/sbin:${libqb}/sbin"
6666 '';
67676868+ passthru.tests = {
6969+ inherit (nixosTests) pacemaker;
7070+ };
7171+6872 meta = {
6973 homepage = "http://corosync.org/";
7074 description = "A Group Communication System with features for implementing high availability within applications";