File: pacemaker

package info (click to toggle)
booth 1.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 852 kB
  • sloc: ansic: 7,181; sh: 2,166; python: 471; makefile: 280; xml: 7
file content (74 lines) | stat: -rwxr-xr-x 1,630 bytes parent folder | download
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh

set -e

start_service() {
  name=$1
  if ! service $name start; then
    set +e
    service $name status
    if [ -x /bin/journalctl ]; then
      journalctl -b -u $name
    elif [ -f /var/log/syslog ]; then
      grep $name /var/log/syslog
    fi
    exit 1
  fi
}

crm_status_wait() {
  match=$1
  log=$AUTOPKGTEST_TMP/crm.status
  n=0
  printf "Waiting for '$match':"
  while ! crm status | tee $log | grep -q "$match"; do
    if [ "$n" -eq 120 ]; then
      printf " failed.\n"
      cat $log
      return 1
    fi
    sleep 1
    n=$((n+1))
    printf " $n"
  done
  printf " done.\n"
}

printf "=== keygen ===\n"
booth-keygen
cat <<EOF | tee /etc/booth/booth.conf
authfile = /etc/booth/authkey
site = 127.0.0.1
ticket = "ticket-A"
EOF

printf "\n=== cluster ===\n"
start_service corosync
start_service pacemaker
crm_status_wait 'Online:.*node1'

printf "\n=== configure ===\n"
crm configure property stonith-enabled=false 2>&1
crm configure property no-quorum-policy=ignore 2>&1
crm configure primitive booth ocf:pacemaker:booth-site \
                        op start timeout=100s 2>&1
crm configure primitive dummy ocf:heartbeat:Dummy 2>&1
crm configure rsc_ticket ticket-A_dummy ticket-A: dummy 2>&1
crm configure show
crm_status_wait 'booth.*Started'
crm status

printf "\n=== booth ===\n"
booth status
booth list

printf "\n=== grant ===\n"
crm --force site ticket grant ticket-A
crm_status_wait 'dummy.*Started'
crm site ticket show ticket-A

printf "\n=== revoke ===\n"
crm site ticket standby ticket-A
crm_status_wait 'dummy.*Stopped'
crm --force site ticket revoke ticket-A
crm site ticket show ticket-A