Merge "Convert port cidr splitting to str_split"
[apex-tripleo-heat-templates.git] / extraconfig / tasks / major_upgrade_controller_pacemaker_1.sh
1 #!/bin/bash
2
3 set -eu
4
5 cluster_sync_timeout=600
6
7 if pcs status 2>&1 | grep -E '(cluster is not currently running)|(OFFLINE:)'; then
8     echo_error "ERROR: upgrade cannot start with some cluster nodes being offline"
9     exit 1
10 fi
11
12 if [ "$(hiera -c /etc/puppet/hiera.yaml bootstrap_nodeid)" = "$(facter hostname)" ]; then
13     pcs resource disable httpd
14     check_resource httpd stopped 1800
15     if pcs status | grep openstack-keystone; then
16         pcs resource disable openstack-keystone
17         check_resource openstack-keystone stopped 1800
18     fi
19     pcs resource disable redis
20     check_resource redis stopped 600
21     pcs resource disable mongod
22     check_resource mongod stopped 600
23     pcs resource disable rabbitmq
24     check_resource rabbitmq stopped 600
25     pcs resource disable memcached
26     check_resource memcached stopped 600
27     pcs resource disable galera
28     check_resource galera stopped 600
29     pcs cluster stop --all
30 fi
31
32 # Swift isn't controled by pacemaker
33 for S in openstack-swift-account-auditor openstack-swift-account-reaper openstack-swift-account-replicator openstack-swift-account \
34 openstack-swift-container-auditor openstack-swift-container-replicator openstack-swift-container-updater openstack-swift-container \
35 openstack-swift-object-auditor openstack-swift-object-replicator openstack-swift-object-updater openstack-swift-object openstack-swift-proxy; do
36     systemctl stop $S
37 done
38
39 tstart=$(date +%s)
40 while systemctl is-active pacemaker; do
41     sleep 5
42     tnow=$(date +%s)
43     if (( tnow-tstart > cluster_sync_timeout )) ; then
44         echo_error "ERROR: cluster shutdown timed out"
45         exit 1
46     fi
47 done
48
49 yum update -y
50
51 # Pin messages sent to compute nodes to kilo, these will be upgraded later
52 crudini  --set /etc/nova/nova.conf upgrade_levels compute "$upgrade_level_nova_compute"
53 # https://bugzilla.redhat.com/show_bug.cgi?id=1284047
54 # Change-Id: Ib3f6c12ff5471e1f017f28b16b1e6496a4a4b435
55 crudini  --set /etc/ceilometer/ceilometer.conf DEFAULT rpc_backend rabbit
56 # https://bugzilla.redhat.com/show_bug.cgi?id=1284058
57 # Ifd1861e3df46fad0e44ff9b5cbd58711bbc87c97 Swift Ceilometer middleware no longer exists
58 crudini --set /etc/swift/proxy-server.conf pipeline:main pipeline "catch_errors healthcheck cache ratelimit tempurl formpost authtoken keystone staticweb proxy-logging proxy-server"