Merge "Customize scheduler_default_filters (nova.conf)"
[apex-tripleo-heat-templates.git] / extraconfig / tasks / major_upgrade_controller_pacemaker_2.sh
1 #!/bin/bash
2
3 set -eu
4
5 cluster_form_timeout=600
6 cluster_settle_timeout=600
7 galera_sync_timeout=600
8
9 if [ "$(hiera -c /etc/puppet/hiera.yaml bootstrap_nodeid)" = "$(facter hostname)" ]; then
10     pcs cluster start --all
11
12     tstart=$(date +%s)
13     while pcs status 2>&1 | grep -E '(cluster is not currently running)|(OFFLINE:)'; do
14         sleep 5
15         tnow=$(date +%s)
16         if (( tnow-tstart > cluster_form_timeout )) ; then
17             echo_error "ERROR: timed out forming the cluster"
18             exit 1
19         fi
20     done
21
22     if ! timeout -k 10 $cluster_settle_timeout crm_resource --wait; then
23         echo_error "ERROR: timed out waiting for cluster to finish transition"
24         exit 1
25     fi
26
27     for vip in $(pcs resource show | grep ocf::heartbeat:IPaddr2 | grep Stopped | awk '{ print $1 }'); do
28       pcs resource enable $vip
29       check_resource $vip started 60
30     done
31
32     pcs resource enable galera
33     check_resource galera started 600
34     pcs resource enable mongod
35     check_resource mongod started 600
36
37     tstart=$(date +%s)
38     while ! clustercheck; do
39         sleep 5
40         tnow=$(date +%s)
41         if (( tnow-tstart > galera_sync_timeout )) ; then
42             echo_error "ERROR galera sync timed out"
43             exit 1
44         fi
45     done
46
47     # Run all the db syncs
48     # TODO: check if this can be triggered in puppet and removed from here
49     ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf
50     cinder-manage db sync
51     glance-manage --config-file=/etc/glance/glance-registry.conf db_sync
52     heat-manage --config-file /etc/heat/heat.conf db_sync
53     keystone-manage db_sync
54     neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head
55     nova-manage db sync
56
57     pcs resource enable memcached
58     check_resource memcached started 600
59     pcs resource enable rabbitmq
60     check_resource rabbitmq started 600
61     pcs resource enable redis
62     check_resource redis started 600
63     pcs resource enable openstack-core
64     check_resource openstack-core started 1800
65     pcs resource enable httpd
66     check_resource httpd started 1800
67 fi
68
69 # Swift isn't controled by heat
70 systemctl_swift start