Check transfer data flag to skip pacemaker normal upgrade.

When the operating system upgrade is performed a
transfer data step must be executed (to allow the
db import once the operating system upgrades). During
this step the pacemaker cluster is stopped, so we can
create a new cluster with the newly OS upgraded node.
Therefore, as the pacemaker cluster is down we need
to skip some of the tasks which would be executed
during a normal upgrade (check pcs status, stop pcs and
start pcs) from the upgrade_tasks.

This patch removes the use of UpgradeLeappEnabled heat
parameter to identify this and uses the existence of
the flag file created during the transfer_data to skip
the normal pacemaker upgrade tasks by setting a new
fact, cluster_recreate, if this file exists.

Change-Id: Iba85e99f59258ce6ef4e05ccae737b9eeb6cfc57
(cherry picked from commit 5845c0a72a)
This commit is contained in:
Jose Luis Franco Arza 2020-06-02 17:39:13 +02:00 committed by Sergii Golovatiuk
parent fc9af112ab
commit 9ee2f74188
11 changed files with 30 additions and 20 deletions

View File

@ -343,7 +343,7 @@ outputs:
- name: Create hiera data to upgrade cinder_backup in a stepwise manner.
when:
- step|int == 1
- upgrade_leapp_enabled|bool
- cluster_recreate|bool
block:
- name: set cinder_backup upgrade node facts in a single-node environment
set_fact:

View File

@ -330,7 +330,7 @@ outputs:
- name: Create hiera data to upgrade cinder_volume in a stepwise manner.
when:
- step|int == 1
- upgrade_leapp_enabled|bool
- cluster_recreate|bool
block:
- name: set cinder_volume upgrade node facts in a single-node environment
set_fact:

View File

@ -504,7 +504,7 @@ outputs:
- name: Create hiera data to upgrade mysql in a stepwise manner.
when:
- step|int == 1
- upgrade_leapp_enabled|bool
- cluster_recreate|bool
block:
- name: set mysql upgrade node facts in a single-node environment
set_fact:

View File

@ -431,7 +431,7 @@ outputs:
- name: Create hiera data to upgrade redis in a stepwise manner.
when:
- step|int == 1
- upgrade_leapp_enabled|bool
- cluster_recreate|bool
block:
- name: set redis upgrade node facts in a single-node environment
set_fact:

View File

@ -527,7 +527,7 @@ outputs:
- name: Create hiera data to upgrade haproxy in a stepwise manner.
when:
- step|int == 1
- upgrade_leapp_enabled|bool
- cluster_recreate|bool
block:
- name: set haproxy upgrade node facts in a single-node environment
set_fact:

View File

@ -309,7 +309,7 @@ outputs:
- name: Create hiera data to upgrade manila_share in a stepwise manner.
when:
- step|int == 1
- upgrade_leapp_enabled|bool
- cluster_recreate|bool
block:
- name: set manila_share upgrade node facts in a single-node environment
set_fact:

View File

@ -443,7 +443,7 @@ outputs:
- name: Create hiera data to upgrade ovn_dbs in a stepwise manner.
when:
- step|int == 1
- upgrade_leapp_enabled|bool
- cluster_recreate|bool
block:
- name: set ovn_dbs upgrade node facts in a single-node environment
set_fact:

View File

@ -97,10 +97,6 @@ parameters:
tag: system.pacemaker
file: /var/log/host/pacemaker.log
startmsg.regex: "^[a-zA-Z]{3} [0-9]{2} [:0-9]{8}"
UpgradeLeappEnabled:
description: Use Leapp for operating system upgrade
type: boolean
default: false
ContainerCli:
type: string
default: 'podman'
@ -212,19 +208,33 @@ outputs:
- name: upgrade step 0
when: step|int == 0
block:
- name: Set fact upgrade_leapp_enabled
# If performing an upgrade which requires operating system upgrading
# a transfer data step needs to be run. During this step, the whole
# pacemaker cluster is stopped so we can't check the cluster status.
# Once the transfer_data step is executed, a flag file is stored.
# This code checks the existence of this file to know if we should
# avoid doing a normal pacemaker upgrade or not. As with the
# operating system upgrade a new cluster will be created in which
# the other nodes will be added.
- name: check flag file existence in destination host
stat:
path: "/var/lib/tripleo/transfer-flags/var-lib-mysql"
register: tripleo_transfer_flag_stat
become: true
delegate_to: "{{ mysql_short_bootstrap_node_name }}"
- name: Set fact cluster_recreate
set_fact:
upgrade_leapp_enabled: {get_param: UpgradeLeappEnabled}
cluster_recreate: "{{ tripleo_transfer_flag_stat.stat.exists|bool }}"
- name: Check pacemaker cluster running before upgrade
tags: validation
pacemaker_cluster: state=online check_and_fail=true
async: 30
poll: 4
when: not upgrade_leapp_enabled|bool
when: not cluster_recreate|bool
- name: Create hiera data to upgrade pacemaker in a stepwise manner.
when:
- step|int == 1
- upgrade_leapp_enabled|bool
- cluster_recreate|bool
block:
- name: set pacemaker upgrade node facts in a single-node environment
set_fact:
@ -294,13 +304,13 @@ outputs:
block:
- name: Stop pacemaker cluster
pacemaker_cluster: state=offline
when: not upgrade_leapp_enabled
when: not cluster_recreate|bool
- name: upgrade step 4
when: step|int == 4
block:
- name: Start pacemaker cluster
pacemaker_cluster: state=online
when: not upgrade_leapp_enabled
when: not cluster_recreate|bool
external_upgrade_tasks:
- when:
- step|int == 1

View File

@ -378,7 +378,7 @@ outputs:
- name: Create hiera data to upgrade oslo messaging notify in a stepwise manner.
when:
- step|int == 1
- upgrade_leapp_enabled|bool
- cluster_recreate|bool
block:
- name: set oslo_messaging_notify upgrade node facts in a single-node environment
set_fact:

View File

@ -379,7 +379,7 @@ outputs:
- name: Create hiera data to upgrade rabbitmq in a stepwise manner.
when:
- step|int == 1
- upgrade_leapp_enabled|bool
- cluster_recreate|bool
block:
- name: set rabbitmq upgrade node facts in a single-node environment
set_fact:

View File

@ -384,7 +384,7 @@ outputs:
- name: Create hiera data to upgrade oslo messaging rpc in a stepwise manner.
when:
- step|int == 1
- upgrade_leapp_enabled|bool
- cluster_recreate|bool
block:
- name: set oslo_messaging_rpc upgrade node facts in a single-node environment
set_fact: