Closed waorb closed 1 year ago
I've change the code in construct_vars_stonith.yml like below and tried the role again. With that, the superfluous quotes around pcmk_host_map in the res_fence_ibm_powervs resource definition are gone and fencing works fine.
diff construct_vars_stonith.yml construct_vars_stonith.yml.orig
49c49
< 'value': __sap_ha_pacemaker_cluster_pcmk_host_map
---
> 'value': '"' + __sap_ha_pacemaker_cluster_pcmk_host_map + '"'
However, I don't know whether that is really the fix, because there must have been a reason why someone added those quotes to the __sap_ha_pacemaker_cluster_pcmk_host_map string in construct_vars_stonith.yml.
Hi Walter, many thanks for testing and sharing, this is indeed an interesting observation.
The quotes are required when setting up the resource manually, otherwise the semicolon is interpreted by the shell.
In case of the Ansible role it the quotes may result in superfluous extra quotes due to how the parameters are inherited and used by the underlying ha_cluster
Linux System Role.
We will review the parameter parsing and correct the constructed string.
Hello Janine, that's right, the quotes are needed on that command line, otherwise the pcs stonith create command would fail. Right now, I'm constructing the variable myself, as the test environment are Power Virtual server instances in the IBM cloud and there's support script in the platform directory yet. I'm copying the code that builds the variable for your reference below:
- name: Configure RHEL HA Add-On cluster
when: hsr_configure_ha_addon
block:
- name: Create variable with pcmk host map
ansible.builtin.set_fact:
__sap_ha_pacemaker_cluster_pcmk_host_map: >-
{{ nodes | join(';') }}
vars:
nodes:
- "{{ hsr_node_primary }}:{{ hostvars[hsr_node_primary].pi_instance_id }}"
- "{{ hsr_node_secondary }}:{{ hostvars[hsr_node_secondary].pi_instance_id }}"
- name: Call role to configure RHEL HA Add-On cluster
ansible.builtin.include_role:
name: redhat.sap_install.sap_ha_pacemaker_cluster
Thanks, Walter
Confirmed to be fixed.
After the execution of the role, the defined Stonith device looks like:
Please note the quotes around the pcmk_host_map string. With this pcmk_host_map string, the fencing operations do not work.
I use the pcs stonith command to update the stonith device:
Now the device looks like:
Note that in this output, there are no quotes around the pcmk_host_map string anymore. With this updated fencing device, the fencing operation works just fine.
The question is how the role manages it to end up with the quotes in the definition. The pcs stonith create (or update) command strips them out, you have to either escape the quotes or surround them with single quotes.
In construct_vars_stonith.yml, I can see this code:
So the string is surrounded with additional quotes and I'm not sure whether this code is the cause for the described problem.
Thanks, Walter