Skip to content

Commit 52a8f5d

Browse files
committed
HanaSR log collection script
Create a bash script to debug the 16.0 SFAIL issue by collecting relevant logs. Extend the hana_prevalidate playbook.
1 parent 7a21c70 commit 52a8f5d

3 files changed

Lines changed: 721 additions & 2 deletions

File tree

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
---
22
- name: SAP HANA site failure test
33
hosts: "{{ node_name | default('no_host_provided')}}"
4-
gather_facts: false
4+
gather_facts: true
5+
remote_user: cloudadmin
6+
pre_tasks:
7+
- name: Include HANA variables
8+
ansible.builtin.include_vars: ./vars/hana_vars.yaml
9+
vars:
10+
sap_sid: "{{ sap_hana_install_sid }}"
11+
instance_num: "{{ sap_hana_install_instance_number }}"
12+
# Determine if the current host is the primary based on inventory order
13+
is_primary: "{{ ansible_play_hosts[0] == inventory_hostname }}"
14+
primary_hostname: "{{ ansible_play_hosts[0] }}"
515
roles:
616
- hana_prevalidate

ansible/playbooks/roles/hana_prevalidate/tasks/main.yaml

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
ansible.builtin.set_fact:
8484
hana_prevalidate_pacemaker_ge_2_1_7: "{{ ansible_facts.packages['pacemaker'][0].version is version('2.1.7', '>=') }}"
8585

86-
# Wait for sync and healthy cluster
8786
- name: Wait for cluster idle
8887
ansible.builtin.command: cs_wait_for_idle --sleep 5
8988
retries: 48
@@ -203,3 +202,68 @@
203202
register: hana_prevalidate_crm_mon_report
204203
changed_when: false
205204
become: true
205+
206+
- name: Run HDBSettings.sh landscapeHostConfiguration.py for HANA landscape validation
207+
ansible.builtin.command: "su - {{ sap_sid | lower }}adm -c 'HDBSettings.sh landscapeHostConfiguration.py'"
208+
register: hana_landscape_config
209+
changed_when: false
210+
failed_when: "'overall host status: ok' not in hana_landscape_config.stdout"
211+
become: true
212+
environment:
213+
HANA_HOME: "/usr/sap/{{ sap_sid | default('HA0') }}/HDB{{ instance_num | default('00') }}"
214+
tags:
215+
- hana_config_validation
216+
217+
- name: Check for inconsistencies in HANA landscapeHostConfiguration output
218+
ansible.builtin.assert:
219+
that:
220+
- hana_landscape_config.stdout is not search('inconsistent')
221+
- hana_landscape_config.stdout is not search('ERROR')
222+
fail_msg: "HANA landscapeHostConfiguration.py reported inconsistencies or errors. Output:\n{{ hana_landscape_config.stdout }}"
223+
success_msg: "HANA landscapeHostConfiguration.py reported a consistent landscape configuration."
224+
when: hana_landscape_config.rc == 0
225+
tags:
226+
- hana_config_validation
227+
228+
- name: Run hdbnsutil -sr_stateConfiguration for HSR control plane validation
229+
ansible.builtin.command: "su - {{ sap_sid | lower }}adm -c '/usr/sap/{{ sap_sid | default('HA0') }}/HDB{{ instance_num | default('00') }}/exe/hdbnsutil -sr_stateConfiguration'"
230+
register: hdbnsutil_sr_state_configuration_output
231+
changed_when: false
232+
become: true
233+
environment:
234+
HANA_HOME: "/usr/sap/{{ sap_sid | default('HA0') }}/HDB{{ instance_num | default('00') }}"
235+
tags:
236+
- hana_config_validation
237+
238+
- name: Check hdbnsutil -sr_stateConfiguration output for primary master / mode
239+
ansible.builtin.assert:
240+
that:
241+
- >-
242+
(is_primary and hdbnsutil_sr_state_configuration_output.stdout is search('mode: primary')) or
243+
(not is_primary and hdbnsutil_sr_state_configuration_output.stdout is search('primary masters: {{ primary_hostname }}'))
244+
fail_msg: "hdbnsutil -sr_stateConfiguration output does not show expected configuration for {{ ansible_hostname }}. Output:\n{{ hdbnsutil_sr_state_configuration_output.stdout }}"
245+
success_msg: "hdbnsutil -sr_stateConfiguration output confirms expected configuration for {{ ansible_hostname }}."
246+
when: hdbnsutil_sr_state_configuration_output.rc == 0
247+
tags:
248+
- hana_config_validation
249+
250+
- name: Run HDBSettings.sh systemReplicationStatus.py for replication data path validation
251+
ansible.builtin.command: "su - {{ sap_sid | lower }}adm -c 'HDBSettings.sh systemReplicationStatus.py'"
252+
register: system_replication_status_output
253+
changed_when: false
254+
failed_when: "system_replication_status_output.stderr | length > 0" # Fail only if stderr is not empty
255+
become: true
256+
environment:
257+
HANA_HOME: "/usr/sap/{{ sap_sid | default('HA0') }}/HDB{{ instance_num | default('00') }}"
258+
tags:
259+
- hana_config_validation
260+
261+
- name: Check HDBSettings.sh systemReplicationStatus.py output for overall active status
262+
ansible.builtin.assert:
263+
that:
264+
- system_replication_status_output.stdout is search('status system replication site "\\d+": ACTIVE') # Checks for ACTIVE status of any site
265+
- system_replication_status_output.stdout is search('overall system replication status: ACTIVE')
266+
fail_msg: "HDBSettings.sh systemReplicationStatus.py reported inactive or non-synced status. Output:\n{{ system_replication_status_output.stdout }}"
267+
success_msg: "HDBSettings.sh systemReplicationStatus.py reported ACTIVE system replication status."
268+
tags:
269+
- hana_config_validation

0 commit comments

Comments
 (0)