OK, here is a recipe to see this problem. I hope all the
steps are here!
(0) Install drbd8-utils and heartbeat.
(1) Create a fake disk
dd if=/dev/zero of=drbd_disk count=1M bs=1
losetup /dev/loop0 ./drbd_disk
(2) Create /etc/drbd.conf. I used:
global {
usage-count yes;
}
common {
protocol C;
}
resource r0 {
device /dev/drbd0;
meta-disk internal;
on maisy {
disk /dev/loop0;
address 192.168.0.4:7788;
}
on hazy {
disk /dev/loop0;
address 192.168.0.5:7788;
}
}
(3) Create the drbd disk:
drbdadm create-md r0
modprobe drbd
drbdadm attach r0
drbdadm syncer r0
drbdadm connect r0
mkfs.ext3 /dev/drbd0
(4) Turned off drbd: /etc/init.d/drbd stop
Stopped the drbd init script from running at startup (to avoid clashes
with heartbeat):
update-rc.d -f drbd remove
(5) Created /etc/ha.d/ha.cf, contents:
autojoin none
mcast eth2 239.0.0.43 694 1 0
warntime 5
deadtime 15
initdead 60
keepalive 2
node maisy
node hazy
crm yes
(6) Created an appropriate /etc/ha.d/authkeys file.
(7) Set up resources and constraints:
cibadmin -o resources -C -x resources.xml
cibadmin -o constraints -C -x constraints.xml
where these files contain:
resources.xml:
constraints.xml:
(8) Started heartbeat: /etc/init.d/heartbeat start
(9) Observed the following failure in the system logs:
May 4 15:09:11 maisy lrmd: [4150]: info: RA output: (drbd_files:0:start:stdout)
May 4 15:09:11 maisy drbd[4491]: [4549]: DEBUG: r0 start: Module loaded.
May 4 15:09:11 maisy drbd[4491]: [4551]: DEBUG: r0: Calling drbdadm -c /etc/drbd.conf state r0
May 4 15:09:11 maisy lrmd: [4150]: info: RA output: (drbd_files:0:start:stderr) local: 586: state': bad variable name
May 4 15:09:11 maisy drbd[4491]: [4558]: ERROR: r0: Called drbdadm -c /etc/drbd.conf state r0
May 4 15:09:11 maisy drbd[4491]: [4559]: ERROR: r0: Exit code 2
(10) Modified /usr/lib/ocf/resource.d/heartbeat/drbd to use "role" rather than "state".
(11) Restarted heartbeat: /etc/init.d/heartbeat restart
(12) Observed that there is no longer such an error in the system logs:
May 4 15:28:06 maisy drbd[6359]: [6370]: DEBUG: r0: Calling drbdadm -c /etc/drbd.conf role r0
May 4 15:28:06 maisy drbd[6359]: [6377]: DEBUG: r0: Exit code 0
May 4 15:28:06 maisy drbd[6359]: [6378]: DEBUG: r0: Command output: Secondary/Unknown