No subject
Thu Oct 27 00:53:32 UTC 2011
d=0A=0A---=0A tools/ocft/Makefile.am | 1 +=0A tools/ocft/drbd.linbit | =
183 ++++++++++++++++++++++++++++++++++++++++++++++++=0A 2 files changed, =
184 insertions(+), 0 deletions(-)=0A create mode 100644 tools/ocft/drbd.lin=
bit=0A=0Adiff --git a/tools/ocft/Makefile.am b/tools/ocft/Makefile.am=0Aind=
ex 97c2d96..fb54e76 100644=0A--- a/tools/ocft/Makefile.am=0A+++ b/tools/ocf=
t/Makefile.am=0A@@ -31,6 +31,7 @@ ocftcfgs_DATA =3D apache =
\=0A mysql \=0A pgsql =
\=0A db2 \=0A+ drbd.linbi=
t \=0A nfsserver \=0A =
portblock \=0A iscsi \=0Adiff --git =
a/tools/ocft/drbd.linbit b/tools/ocft/drbd.linbit=0Anew file mode =
100644=0Aindex 0000000..4cc5519=0A--- /dev/null=0A+++ b/tools/ocft/drbd.lin=
bit=0A@@ -0,0 +1,183 @@=0A+# linbit: drbd=0A+=0A+CONFIG=0A+ Agent =
drbd=0A+ AgentRoot /usr/lib/ocf/resource.d/linbit=0A+ InstallPack=
age drbd=0A+ HangTimeout 20=0A+=0A+VARIABLE=0A+ DRBDCONF=3D/tmp/ocf=
t_drbd_tmp.conf=0A+=0A+ # should be this machine's hostname/ip, =
please modify it by yourself.=0A+ NAME_1=3DHOSTNAME1=0A+ IP_1=3DIP_A=
DDRESS1=0A+=0A+ # the block device just for test, please modify it =
by yourself.=0A+ DISK_1=3D/dev/DEVICE1=0A+=0A+ PORT_1=3D5735=0A+ =
DEVICE_1=3D/dev/drbd0=0A+ =0A+ #####################################=
###############################=0A+=0A+ # please modify it by =
yourself.=0A+ NAME_2=3DHOSTNAME2=0A+ IP_2=3DIP_ADDRESS2=0A+=0A+ =
# the block device just for test, please modify it by yourself.=0A+ =
DISK_2=3D/dev/DEVICE2=0A+=0A+ PORT_2=3D5735=0A+ DEVICE_2=3D/dev/drb=
d0=0A+=0A+=0A+=0A+SETUP-AGENT=0A+ cat >$DRBDCONF <<EOF=0A+ =
global {=0A+ usage-count no;=0A+ }=0A+ =0A+ resource ocft0 =
{=0A+ protocol C;=0A+ disk {=0A+ on-io-error =
detach;=0A+ }=0A+ on $NAME_1 {=0A+ device =
$DEVICE_1;=0A+ address $IP_1:$PORT_1;=0A+ meta-disk =
internal;=0A+ disk $DISK_1;=0A+ }=0A+ on =
$NAME_2 {=0A+ device $DEVICE_2;=0A+ address $IP_2:$PORT=
_2;=0A+ meta-disk internal;=0A+ disk $DISK_2;=0A+ =
}=0A+ }=0A+EOF=0A+ HOST=3D$(uname -n)=0A+ DRBDADM=3D"drbdadm -c =
$DRBDCONF"=0A+=0A+ # prepare=0A+ modprobe drbd $(drbdadm sh-mod-parm=
s)=0A+ $DRBDADM down ocft0=0A+=0A+ # create meta data block if =
necessary=0A+ $DRBDADM dump-md ocft0 >/dev/null 2>&1=0A+ if [ $? =
-eq 255 ]; then=0A+ $DRBDADM create-md ocft0=0A+ fi=0A+=0A+ =
# start drbd=0A+ $DRBDADM up ocft0=0A+=0A+ # UpToDate=0A+ if =
[ "$HOST" =3D "$NAME_1" ]; then=0A+ $DRBDADM wait-connect =
ocft0=0A+ echo "drbd Syncing .."=0A+ $DRBDADM =
primary --force ocft0=0A+ while true; do=0A+ =
CSTATE=3D$($DRBDADM cstate ocft0)=0A+ DSTATE=3D$($DRBDADM=
dstate ocft0)=0A+ if [ "$CSTATE" =3D "Connected" -a =
"$DSTATE" =3D "UpToDate/UpToDate" ]; then=0A+ =
break=0A+ else=0A+ =
sleep 3=0A+ fi=0A+ done=0A+ =
echo "done"=0A+ fi=0A+=0A+CLEANUP-AGENT=0A+ drbdadm -c $DRBDCONF down =
ocft0=0A+ rm -f $DRBDCONF=0A+=0A+CASE-BLOCK required_args=0A+ =
Env OCF_RESKEY_drbdconf=3D$DRBDCONF=0A+ Env OCF_RESKEY_drbd_resource=3Docft=
0=0A+ Env OCF_RESKEY_CRM_meta_notify=3Dtrue=0A+ Env OCF_RESKEY_CRM_=
meta_clone_max=3D2=0A+=0A+CASE-BLOCK default_status=0A+ AgentRun =
stop=0A+=0A+CASE-BLOCK prepare=0A+ Include required_args=0A+ =
Include default_status=0A+=0A+CASE "check base env"=0A+ Include required_ar=
gs=0A+ AgentRun validate-all OCF_SUCCESS=0A+=0A+CASE "normal start"=0A+ =
Include prepare=0A+ AgentRun start OCF_SUCCESS=0A+=0A+CASE "normal =
stop"=0A+ Include prepare=0A+ AgentRun start=0A+ AgentRun =
stop OCF_SUCCESS=0A+=0A+CASE "wrong path of config file"=0A+ Include =
prepare=0A+ Env OCF_RESKEY_drbdconf=3Dno_such_file=0A+ AgentRun =
start OCF_ERR_INSTALLED=0A+=0A+CASE "wrong resource name"=0A+ Include =
prepare=0A+ Env OCF_RESKEY_drbd_resource=3Dno_such_src=0A+ # =
OCF_RESKEY_drbd_resource is a required parameter in agent meta-data, =0A+ =
# if wrong, I think the agent should return OCF_ERR_CONFIGURED.=0A+ =
AgentRun start OCF_ERR_CONFIGURED=0A+=0A+CASE "double start"=0A+ =
Include prepare=0A+ AgentRun start=0A+ AgentRun start OCF_SUCCESS=
=0A+=0A+CASE "double stop"=0A+ Include prepare=0A+ AgentRun stop =
OCF_SUCCESS=0A+=0A+CASE "running monitor"=0A+ Include prepare=0A+ =
AgentRun start=0A+ AgentRun monitor OCF_SUCCESS=0A+=0A+CASE "not =
running monitor"=0A+ Include prepare=0A+ AgentRun monitor OCF_NOT_RU=
NNING=0A+=0A+CASE "Primary/Secondary monitor"=0A+ Include prepare=0A+=
AgentRun start=0A+ AgentRun promote=0A+ AgentRun monitor =
OCF_RUNNING_MASTER=0A+ AgentRun demote=0A+ AgentRun monitor OCF_SUCCES=
S=0A+=0A+CASE "unimplemented command"=0A+ Include prepare=0A+ =
AgentRun no_cmd OCF_ERR_UNIMPLEMENTED=0A+=0A+CASE "try to 'promote' in =
single-primary mode"=0A+ Include prepare=0A+ Include@$IP_2 =
prepare=0A+=0A+ # start drbd =0A+ AgentRun start=0A+ =
AgentRun@$IP_2 start=0A+=0A+ # promote local drbd first=0A+ AgentRun =
promote OCF_SUCCESS=0A+=0A+ # demote local drbd prepare for remote =
drbd promote=0A+ AgentRun demote=0A+ # remote drbd promote=0A+ =
AgentRun@$IP_2 promote OCF_SUCCESS=0A+=0A+ # promote fails, because =
remote drbd promote first.=0A+ AgentRun promote OCF_ERR_GENERIC=0A-- =
=0A1.6.4.2=0A=0A
--=__Part2708DE29.0__=--
More information about the ha-wg-technical
mailing list