09a452e69a45353b820c4419d613d66e2484b5ba
[apex-tripleo-heat-templates.git] / extraconfig / tasks / pacemaker_resource_restart.sh
1 #!/bin/bash
2
3 set -eux
4
5 pacemaker_status=$(systemctl is-active pacemaker)
6
7 # Run if pacemaker is running, we're the bootstrap node,
8 # and we're updating the deployment (not creating).
9 if [ "$pacemaker_status" = "active" -a \
10      "$(hiera bootstrap_nodeid)" = "$(facter hostname)" -a \
11      "$(hiera update_identifier)" != "nil" ]; then
12
13     #ensure neutron constraints like
14     #https://review.openstack.org/#/c/245093/
15     if  pcs constraint order show  | grep "start neutron-server-clone then start neutron-ovs-cleanup-clone"; then
16         pcs constraint remove order-neutron-server-clone-neutron-ovs-cleanup-clone-mandatory
17     fi
18
19     pcs resource disable httpd
20     check_resource httpd stopped 300
21     pcs resource disable openstack-keystone
22     check_resource openstack-keystone stopped 1800
23
24     if pcs status | grep haproxy-clone; then
25         pcs resource restart haproxy-clone
26     fi
27     pcs resource restart redis-master
28     pcs resource restart mongod-clone
29     pcs resource restart rabbitmq-clone
30     pcs resource restart memcached-clone
31     pcs resource restart galera-master
32
33     pcs resource enable openstack-keystone
34     check_resource openstack-keystone started 1800
35     pcs resource enable httpd
36     check_resource httpd started 800
37
38 fi
39
40 if [ "$pacemaker_status" = "active" ]; then
41     # TODO(marios): remove this once +bug/1561012
42     # need this on all controllers:
43     systemctl reload haproxy
44 fi