[Drbd-dev] drbd.ocf Split-Brain detection patch
Uwe Grawert
grawert at b1-systems.de
Mon Nov 15 14:53:04 CET 2010
Hello,
the following is a patch for the OCF Agent script, to detect a
Split-Brain and turn the resource into unmanaged mode if a Split-Brain
has been detected. This is not meant as a substitution for a fencing
mechanism but as a help to discover a Split-Brain when setting up a
cluster.
--- /usr/lib/ocf/resource.d/linbit/drbd 2010-10-28 14:58:05.000000000 +0200
+++ drbd.split-brain.patch 2010-11-15 14:28:46.000000000 +0100
@@ -405,6 +405,9 @@
case "${DRBD_ROLE_LOCAL}" in
Primary)
rc=$OCF_RUNNING_MASTER
+ # This Node is Primary but StandAlone, there must be a Split-Brain
+ [[ $OCF_RESKEY_CRM_meta_master_max = 2 && $DRBD_CSTATE = "StandAlone" ]] \
+ && rc=$OCF_ERR_CONFIGURED
;;
Secondary)
rc=$OCF_SUCCESS
@@ -518,6 +521,11 @@
$OCF_RUNNING_MASTER)
ocf_log warn "$DRBD_RESOURCE already Primary, demoting."
do_drbdadm secondary $DRBD_RESOURCE
+ ;;
+ $OCF_ERR_CONFIGURED)
+ ocf_log warn "Split-Brain detected! See DRBD logging output."
+ rc=$status
+ break
esac
$first_try || sleep 1
first_try=false
@@ -560,6 +568,11 @@
$OCF_RUNNING_MASTER)
rc=$OCF_SUCCESS
break
+ ;;
+ $OCF_ERR_CONFIGURED)
+ ocf_log warn "Split-Brain detected! See DRBD logging output."
+ rc=$status
+ break
esac
$first_try || sleep 1
first_try=false
@@ -591,6 +604,11 @@
;;
$OCF_RUNNING_MASTER)
do_drbdadm secondary $DRBD_RESOURCE
+ ;;
+ $OCF_ERR_CONFIGURED)
+ ocf_log warn "Split-Brain detected! See DRBD logging output."
+ rc=$status
+ break
esac
$first_try || sleep 1
first_try=false
@@ -619,6 +637,11 @@
$OCF_RUNNING_MASTER)
ocf_log warn "$DRBD_RESOURCE still Primary, demoting."
do_drbdadm secondary $DRBD_RESOURCE
+ ;;
+ $OCF_ERR_CONFIGURED)
+ ocf_log warn "Split-Brain detected! See DRBD logging output."
+ rc=$status
+ break
esac
$first_try || sleep 1
first_try=false
--
Uwe Grawert
Linux / Unix Consultant & Trainer
Tel.: +49 151 12051100
Mail: grawert at b1-systems.de
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
More information about the drbd-dev
mailing list