Fix race during major-upgrade-pacemaker step
authorMichele Baldessari <michele@acksyn.org>
Wed, 9 Nov 2016 08:05:08 +0000 (09:05 +0100)
committerMichele Baldessari <michele@acksyn.org>
Wed, 9 Nov 2016 13:51:51 +0000 (14:51 +0100)
commitdde12b075ff51d4def4f49e635dd390a7f1f2cac
treef0a7183a7e5d454a97d66f3df1adce08ca434fc3
parent465324cb6aa85b56b4390b01425190b23a64acf3
Fix race during major-upgrade-pacemaker step

Currently when we call the major-upgrade step we do the following:
"""
...
if [[ -n $(is_bootstrap_node) ]]; then
    check_clean_cluster
fi
...
if [[ -n $(is_bootstrap_node) ]]; then
    migrate_full_to_ng_ha
fi
...
for service in $(services_to_migrate); do
    manage_systemd_service stop "${service%%-clone}"
    ...
done
"""

The problem with the above code is that it is open to the following race
condition:
1. Code gets run first on a non-bootstrap controller node so we start
stopping a bunch of services
2. Pacemaker notices will notice that services are down and will mark
the service as stopped
3. Code gets run on the bootstrap node (controller-0) and the
check_clean_cluster function will fail and exit
4. Eventually also the script on the non-bootstrap controller node will
timeout and exit because the cluster never shut down (it never actually
started the shutdown because we failed at 3)

Let's make sure we first only call the HA NG migration step as a
separate heat step. Only afterwards we start shutting down the systemd
services on all nodes.

We also need to move the STONITH_STATE variable into a file because it
is being used across two different scripts (1 and 2) and we need to
store that state.

Co-Authored-By: Athlan-Guyot Sofer <sathlang@redhat.com>
Closes-Bug: #1640407
Change-Id: Ifb9b9e633fcc77604cca2590071656f4b2275c60
extraconfig/tasks/major_upgrade_check.sh
extraconfig/tasks/major_upgrade_controller_pacemaker_1.sh
extraconfig/tasks/major_upgrade_controller_pacemaker_2.sh
extraconfig/tasks/major_upgrade_controller_pacemaker_3.sh
extraconfig/tasks/major_upgrade_controller_pacemaker_4.sh
extraconfig/tasks/major_upgrade_controller_pacemaker_5.sh
extraconfig/tasks/major_upgrade_controller_pacemaker_6.sh [new file with mode: 0755]
extraconfig/tasks/major_upgrade_pacemaker.yaml