diff --git a/scripts/ha/cluster-init.sh b/scripts/ha/cluster-init.sh index b226f7b..449c19a 100755 --- a/scripts/ha/cluster-init.sh +++ b/scripts/ha/cluster-init.sh @@ -232,12 +232,13 @@ log "Bringing up DRBD on both nodes..." drbdadm up ha-data 2>/dev/null || true n2_ssh "drbdadm up ha-data" 2>/dev/null || true -log "Clearing Pacemaker standby — DRBD is up, letting Pacemaker resume..." -crm_standby -N "$NODE1" -v off 2>/dev/null || true -crm_standby -N "$NODE2" -v off 2>/dev/null || true - log "Forcing $NODE1 to DRBD Primary for initial sync..." drbdadm primary ha-data --force +# NOTE: Pacemaker standby is intentionally kept ON until after the sync +# completes. Clearing it here races with the OCF DRBD agent: Pacemaker +# sees DRBD in WFConnection/SyncSource and may call drbdadm-down thinking +# something went wrong, killing the sync. Standby is cleared below, after +# UpToDate/UpToDate is confirmed. log "Waiting for DRBD initial sync to complete (32 GB may take 10–20 min)..." log " (monitor with: watch -n3 cat /proc/drbd)" @@ -271,6 +272,10 @@ while true; do sleep 3 done +log "Clearing Pacemaker standby — sync complete, handing DRBD back to Pacemaker..." +crm_standby -N "$NODE1" -v off 2>/dev/null || true +crm_standby -N "$NODE2" -v off 2>/dev/null || true + # ── 3. XFS filesystem ───────────────────────────────────────────────────── log "Creating XFS on ${DRBD_DEVICE}..." if ! xfs_info "${DRBD_DEVICE}" &>/dev/null; then