Archived
fix(ha): all 7 acceptance tests pass — targetctl, fencing, failover, data integrity
Check NixOS configurations / eval-hosts (pull_request) Successful in 10m37s
Check NixOS configurations / eval-hosts (pull_request) Successful in 10m37s
Deploy/init fixes: - iscsi-target.nix: targetctl binary is in rtslib-fb (python3 env), not targetcli-fb — fixes ExecStart and ExecStop for the targetctl.service - deploy.sh: _patch_targetctl() applies runtime dropin to both nodes before cluster-init so Pacemaker can manage the iSCSI target from first start - cluster-init.sh: replace crm configure heredoc with cibadmin --replace XML (pacemaker-4.0 schema: globally-unique in meta_attributes, promoted-max/ promoted-node-max, Promoted role in constraints); force_unmount=true on xfs-data; DRBD promote timeout 240s - cluster-config.nix: add crm-fence-peer.sh/crm-unfence-peer.sh handlers; update fencing comment to reflect resource-only + Pacemaker-aware handler replacing STONITH during testing phase - ha-server.nix: add openiscsi to systemPackages for T4 iscsiadm availability Acceptance test fixes: - acceptance-tests.sh: fix ((PASS++)) set -e bug → PASS=$((PASS+1)); detect Active/Standby dynamically via drbdadm role (Pacemaker can promote either node); T4 bash TCP probe instead of iscsiadm; T5 timeout 120s; T6 echo|sudo tee for root-owned XFS write (bash -c redirect runs as nixos not sudo — permission denied); use ns cat / ns rm for root-owned reads Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HaH1cSGvhogRP5ExoF6nD8
This commit is contained in:
@@ -33,9 +33,9 @@ in
|
||||
../beszel/enable-agent.nix
|
||||
];
|
||||
|
||||
# xfsprogs must be in systemPackages so mkfs.xfs/xfs_info are on PATH
|
||||
# for cluster-init.sh (which runs as root via sudo during initial cluster setup).
|
||||
environment.systemPackages = [ pkgs.xfsprogs ];
|
||||
# xfsprogs: mkfs.xfs/xfs_info needed by cluster-init.sh.
|
||||
# openiscsi: iscsiadm needed by acceptance-tests.sh T4 (iSCSI discovery check).
|
||||
environment.systemPackages = [ pkgs.xfsprogs pkgs.openiscsi ];
|
||||
|
||||
services.nfs.server = {
|
||||
enable = true;
|
||||
|
||||
@@ -11,12 +11,16 @@
|
||||
# Both host keys must be registered via sync-host-keys.sh first so both nodes can decrypt it.
|
||||
#
|
||||
# DRBD fencing:
|
||||
# Production setting is resource-only: DRBD waits for the STONITH fence
|
||||
# agent to confirm the peer is dead before promoting to Primary. This
|
||||
# requires a working fence_pve_ssh STONITH resource in Pacemaker
|
||||
# (see scripts/ha/cluster-enable-stonith.sh). On a fresh cluster with
|
||||
# no fence device yet, temporarily change to dont-care and run
|
||||
# cluster-enable-stonith.sh once the fence key is deployed.
|
||||
# resource-only with crm-fence-peer.sh: DRBD calls the Pacemaker-aware
|
||||
# crm-fence-peer.sh handler before promoting. The handler checks the CIB
|
||||
# to confirm the peer's DRBD resource is stopped and returns 7 (successfully
|
||||
# fenced), allowing safe promotion without requiring power-fencing (STONITH).
|
||||
# The unfence handler crm-unfence-peer.sh clears the outdate flag when the
|
||||
# peer reconnects. This is the correct setting for Pacemaker+DRBD clusters
|
||||
# with STONITH disabled; crm-fence-peer.sh replaces the need for a separate
|
||||
# STONITH device during the testing phase. Switch to resource-and-stonith
|
||||
# once the fence_pve_ssh STONITH resource is active (see
|
||||
# scripts/ha/cluster-enable-stonith.sh).
|
||||
{ lib, vars, ... }:
|
||||
{
|
||||
# Root SSH access — same key set as nixos user so all admin keys can reach root.
|
||||
@@ -51,6 +55,10 @@
|
||||
disk {
|
||||
fencing resource-only;
|
||||
}
|
||||
handlers {
|
||||
fence-peer "/run/current-system/sw/lib/drbd/crm-fence-peer.sh";
|
||||
unfence-peer "/run/current-system/sw/lib/drbd/crm-unfence-peer.sh";
|
||||
}
|
||||
}
|
||||
|
||||
resource ha-data {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
let
|
||||
python3 = pkgs.python3.withPackages (ps: [ ps.rtslib-fb ]);
|
||||
targetctl = "${pkgs.targetcli-fb}/bin/targetctl";
|
||||
targetctl = "${python3}/bin/targetctl";
|
||||
|
||||
targetctlStop = pkgs.writeScript "targetctl-stop" ''
|
||||
#!${python3}/bin/python3
|
||||
|
||||
Reference in New Issue
Block a user