Fix custom STONITH compute names in IHA playbook

Today when STONITH for the compute nodes is already configured in the
TripleO deployment and the name of these STONITH resources is not
"ipmilan-<hostname>" the task will likely fail.
This commit fixes the way STONITH levels are managed, making the task to
not rely anymore on the fact that a user will configure also STONITH
with the instance HA playbooks, but reading dynamically the name of the
resources.
It also takes care about it while removing the IHA steps, preserving the
idempotent principle.

Closes-Bug: #1780434

Change-Id: I2f8351cf62cddd420c257110d60442ca4243a43d
This commit is contained in:
Raoul Scarazzini 2018-07-06 15:21:24 +02:00
parent dd51dee43e
commit 183b16c516
2 changed files with 13 additions and 7 deletions

View File

@ -280,11 +280,6 @@
pcs constraint order start openstack-nova-conductor-clone then nova-compute-checkevacuate-clone require-all=false
when: release in [ 'liberty', 'rhos-8', 'mitaka', 'rhos-9' ]
- name: Check if ipmi exists for all compute nodes
shell: |
pcs stonith show ipmilan-{{ hostvars[item]['ansible_hostname'] }}
with_items: "{{ groups['compute'] }}"
- name: Set requires to fencing as default for all resources (Pike/RHOS-12)
shell: "pcs resource defaults requires=fencing"
when: release in [ 'pike', 'rhos-12' ]
@ -319,8 +314,10 @@
shell: "pcs property set --node {{ hostvars[item]['ansible_hostname'] }} osprole=compute"
with_items: "{{ groups['compute'] }}"
- name: Add pacemaker stonith devices of compute nodes to level 1
shell: "pcs stonith level add 1 {{ hostvars[item]['ansible_hostname'] }} ipmilan-{{ hostvars[item]['ansible_hostname'] }},fence-nova"
- name: Add STONITH level definitions for compute nodes
shell: |
compute_stonith_name=$(cibadmin --query --xpath "//primitive[@class='stonith']/instance_attributes/nvpair[@value='{{ item }}']" | sed 's/.*id="\(.*\)-instance_attributes-pcmk_host_list".*/\1/g')
pcs stonith level add 1 {{ item }} $compute_stonith_name,fence-nova
with_items: "{{ groups['compute'] }}"
- name: Enable keystone resource

View File

@ -1,5 +1,14 @@
---
- block:
- name: Remove STONITH level definitions for compute nodes
shell: |
compute_stonith_name=$(cibadmin --query --xpath "//primitive[@class='stonith']/instance_attributes/nvpair[@value='{{ item }}']" | sed 's/.*id="\(.*\)-instance_attributes-pcmk_host_list".*/\1/g')
for stonith_level in $(cibadmin --query --xpath "//configuration/fencing-topology/fencing-level[@devices='$compute_stonith_name,fence-nova'][@index='1'][@target='{{ item }}']" --node-path)
do
pcs stonith level delete 1 {{ item }} $compute_stonith_name,fence-nova
done
with_items: "{{ groups['compute'] }}"
- name: Remove fence-nova STONITH device
shell: |
for stonithid in $(pcs stonith show | awk '/fence_compute/ {print $1}')