File: fence-agents

package info (click to toggle)
sbd 1.5.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 548 kB
  • sloc: ansic: 5,290; sh: 653; makefile: 119
file content (41 lines) | stat: -rwxr-xr-x 1,100 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh

set -e

if [ "$AUTOPKGTEST_REBOOT_MARK" = fenced ]; then
    echo "fence was successfull"
    exit 0
fi

# create test disk
echo "=== losetup ==="
DISK=$AUTOPKGTEST_TMP/disk
dd if=/dev/zero of=$DISK bs=1M count=10 2>&1
LOOP=$(losetup --find --show $DISK)

echo "=== create ==="
hostname node1 # must match corosync for fence to work
sbd -d $LOOP create
sed -i "s|^#\\?\\(SBD_DEVICE=\\).*|\\1$LOOP|" /etc/default/sbd
sed -i "s|^\\(SBD_WATCHDOG_DEV=\\).*|\\1/dev/null|" /etc/default/sbd

echo "=== cluster ==="
apt-get --yes --quiet install pacemaker crmsh fence-agents
service sbd status

echo -n "Waiting for cluster to start... "
for x in `seq 60 -1 1`; do echo -n "$x "; sleep 1; done; echo

echo "=== configure ==="
crm configure primitive sbd stonith:fence_sbd \
  params devices=$LOOP plug=node1 sbd_path=/usr/sbin/sbd \
  op monitor interval=10 timeout=10
crm configure show

echo -n "Waiting for resource to start... "
for x in `seq 10 -1 1`; do echo -n "$x "; sleep 1; done; echo
crm status

echo "=== fence ==="
/tmp/autopkgtest-reboot-prepare fenced
crm --force node fence node1