Merge "Fix distinguishing between stack-create and stack-update"
[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 stack_action)" = "UPDATE" ]; 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-core
22     check_resource openstack-core 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-core
34     check_resource openstack-core started 1800
35     pcs resource enable httpd
36     check_resource httpd started 800
37
38 fi