5 pacemaker_status=$(systemctl is-active pacemaker)
8 function check_resource {
14 tend=$(( $tstart + $timeout ))
16 if [ "$state" = "stopped" ]; then
17 match_for_incomplete='Started'
19 match_for_incomplete='Stopped'
22 while (( $(date +%s) < $tend )); do
23 node_states=$(pcs status --full | grep "$service" | grep -v Clone)
24 if echo "$node_states" | grep -q "$match_for_incomplete"; then
25 echo "$service not yet $state, sleeping $check_interval seconds."
28 echo "$service has $state"
33 echo "$service never $state after $timeout seconds" | tee /dev/fd/2
38 # Run if pacemaker is running, we're the bootstrap node,
39 # and we're updating the deployment (not creating).
40 if [ "$pacemaker_status" = "active" -a \
41 "$(hiera bootstrap_nodeid)" = "$(facter hostname)" -a \
42 "$(hiera update_identifier)" != "nil" ]; then
44 pcs resource disable httpd
45 check_resource httpd stopped 300
46 pcs resource disable openstack-keystone
47 check_resource openstack-keystone stopped 1200
49 if pcs status | grep haproxy-clone; then
50 pcs resource restart haproxy-clone
52 pcs resource restart redis-master
53 pcs resource restart mongod-clone
54 pcs resource restart rabbitmq-clone
55 pcs resource restart memcached-clone
56 pcs resource restart galera-master
58 pcs resource enable openstack-keystone
59 check_resource openstack-keystone started 300
60 pcs resource enable httpd
61 check_resource httpd started 800