From da4d808c6a8d0356448a3c60ae52afddad1bfc20 Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Tue, 28 Jul 2026 17:57:49 +1000 Subject: [PATCH] fix(ha/cluster-init): use crm configure instead of cibadmin XML for resources cibadmin raw XML fails schema validation under pacemaker-4.0: globally-unique is not a valid direct attribute, and master-max/master-node-max are renamed. Switch to crm configure commands which are schema-version-aware: - promotable clone with promoted-max/promoted-node-max - order/colocation constraints using Promoted role (Pacemaker 4.0 naming) - crm configure handles schema differences automatically Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01HaH1cSGvhogRP5ExoF6nD8 --- scripts/ha/cluster-init.sh | 124 ++++++++++++++----------------------- 1 file changed, 47 insertions(+), 77 deletions(-) diff --git a/scripts/ha/cluster-init.sh b/scripts/ha/cluster-init.sh index 6d850fd..4d04d17 100755 --- a/scripts/ha/cluster-init.sh +++ b/scripts/ha/cluster-init.sh @@ -224,84 +224,54 @@ log "Configuring Pacemaker cluster properties..." crm_attribute -t crm_config -n stonith-enabled -v false crm_attribute -t crm_config -n no-quorum-policy -v ignore -log "Creating DRBD promotable clone resource..." -cibadmin --replace --scope resources --xml-text " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" +log "Creating Pacemaker resources via crm configure..." +# Use crm configure (schema-aware) instead of raw cibadmin XML to avoid +# pacemaker-4.0 schema incompatibilities with direct clone attributes. +# --force skips the interactive prompt; crm configure exits 0 on success. +crm configure <<'CRM_EOF' +primitive drbd0 ocf:linbit:drbd \ + params drbd_resource=ha-data \ + op start timeout=240s interval=0 \ + op stop timeout=120s interval=0 \ + op promote timeout=90s interval=0 \ + op demote timeout=90s interval=0 \ + op monitor interval=20s timeout=20s role=Promoted \ + op monitor interval=30s timeout=20s role=Unpromoted -log "Adding ordering and colocation constraints..." -cibadmin --replace --scope constraints --xml-text " - - - - -" +clone ms-drbd0 drbd0 \ + meta promotable=true promoted-max=1 promoted-node-max=1 \ + clone-max=2 clone-node-max=1 \ + notify=true interleave=true globally-unique=false + +primitive xfs-data ocf:heartbeat:Filesystem \ + params device=/dev/drbd0 directory=/srv/ha-data fstype=xfs options=defaults \ + force_unmount=false \ + op start timeout=60s interval=0 \ + op stop timeout=60s interval=0 \ + op monitor interval=20s timeout=40s + +primitive iscsi-target systemd:targetctl \ + op start timeout=60s interval=0 \ + op stop timeout=60s interval=0 \ + op monitor interval=20s timeout=40s + +primitive nfs-server systemd:nfs-server \ + op start timeout=60s interval=0 \ + op stop timeout=60s interval=0 \ + op monitor interval=30s timeout=40s + +primitive vip ocf:heartbeat:IPaddr2 \ + params ip=192.168.2.229 cidr_netmask=24 \ + op start timeout=20s interval=0 \ + op stop timeout=20s interval=0 \ + op monitor interval=10s timeout=20s + +group ha-group xfs-data iscsi-target nfs-server vip + +order order-drbd-group Mandatory: ms-drbd0:promote ha-group:start +colocation coloc-group-with-drbd INFINITY: ha-group ms-drbd0:Promoted +commit +CRM_EOF log "Waiting for resources to start..." for i in $(seq 1 60); do