Ensure fencing is correctly handled during update

If overcloud is deployed with fencing enabled, then
we should temporarily disable fencing for the duration of the update.
We are introducing a pre-undercloud update step to disable
it and post-update step to enable it back.

Change-Id: Ie6324fc2c9cdbeac6126e5bdbbce41f23e143be5
(cherry picked from commit 224d964ba7)
This commit is contained in:
Archana Singh 2022-08-19 19:50:27 +05:30
parent 24b382e54a
commit 62359da2ce
3 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,23 @@
---
- name: verify if fencing is enabled before running overcloud update
become: true
become_user: "{{ (overcloud_ssh_user) | ternary(overcloud_ssh_user, 'heat-admin') }}"
delegate_to: "{{ controller_host }}"
shell: "sudo pcs property config stonith-enabled | tail -1"
register: pcs_out
changed_when: false
failed_when: false
- block:
- name: set EnableFencing to false in fencing.yaml
replace:
path: "{{ working_dir }}/fencing.yaml"
regexp: "EnableFencing: true"
replace: "EnableFencing: false"
- name: disable fencing before running update
become: true
become_user: "{{ (overcloud_ssh_user) | ternary(overcloud_ssh_user, 'heat-admin') }}"
delegate_to: "{{ controller_host }}"
shell: "sudo pcs property set stonith-enabled=false"
when: pcs_out.stdout.find('true') != -1

View File

@ -0,0 +1,28 @@
---
- name: Check if fencing.yaml file is present
stat:
path: "{{ working_dir }}/fencing.yaml"
register: fencing_file
- name: verify the fencing status after update
become: true
become_user: "{{ (overcloud_ssh_user) | ternary(overcloud_ssh_user, 'heat-admin') }}"
delegate_to: "{{ controller_host }}"
shell: "sudo pcs property config stonith-enabled | tail -1"
register: pcs_out
changed_when: false
failed_when: false
- block:
- name: set EnableFencing to true in fencing.yaml
replace:
path: "{{ working_dir }}/fencing.yaml"
regexp: "EnableFencing: false"
replace: "EnableFencing: true"
- name: enable fencing after running update
become: true
become_user: "{{ (overcloud_ssh_user) | ternary(overcloud_ssh_user, 'heat-admin') }}"
delegate_to: "{{ controller_host }}"
shell: "sudo pcs property set stonith-enabled=true"
when: pcs_out.stdout.find('false') != -1 and fencing_file.stat.exists

View File

@ -98,6 +98,12 @@
- updates_validations
- pre_update_prepare_validations
- set_fact:
controller_host: "{{ inventory_hostmap[controller_role_name]|first }}"
- name: run pre-update fencing check
import_tasks: disable_fencing.yaml
- name: import oc update prepare tasks
import_tasks: overcloud_update_prepare.yml
tags:
@ -201,6 +207,9 @@
./overcloud_online_data_migration.sh 2>&1 {{ timestamper_cmd }} >> \
overcloud_update_data_migration.log
- name: run post-update fencing check
import_tasks: enable_fencing.yaml
- name: run post-update validation
import_tasks: ../common/validation_group_run.yaml
vars: