Skip to content

Commit 9e58c8e

Browse files
committed
feat: remove redundant checks for HANA process readiness in backup and restore tasks
1 parent 444b14c commit 9e58c8e

5 files changed

Lines changed: 31 additions & 164 deletions

File tree

src/roles/backup_db_hana/tasks/encryption-key-transfer.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,27 +65,6 @@
6565
- backup_tenant_items | length > 0
6666
- encryption_tenant_status.results[idx].stdout | default('') is not search('YES')
6767

68-
- name: "Encryption Key Transfer: Wait for tenant indexserver on source"
69-
become_user: "{{ db_sid | lower }}adm"
70-
ansible.builtin.shell: |
71-
set -o pipefail
72-
source /usr/sap/{{ db_sid | upper }}/home/.sapenv.sh && \
73-
sapcontrol -nr {{ db_instance_number }} -function GetProcessList | grep -i indexserver | grep -i GREEN
74-
args:
75-
executable: /bin/bash
76-
run_once: true
77-
changed_when: false
78-
retries: 30
79-
delay: 10
80-
until: source_indexserver_wait.rc == 0
81-
register: source_indexserver_wait
82-
when:
83-
- backup_encryption_enabled | default(false) | bool
84-
- backup_tenant_items | length > 0
85-
- encryption_tenant_status.results | default([])
86-
| map(attribute='stdout') | select('defined')
87-
| reject('search', 'YES') | list | length > 0
88-
8968
- name: "Encryption Key Transfer: Set root key backup password on tenant '{{ db_item.name }}'"
9069
become_user: "{{ db_sid | lower }}adm"
9170
ansible.builtin.shell: |

src/roles/backup_db_hana/tasks/recover-db-commands.yml

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -214,22 +214,6 @@
214214
run_once: true
215215
changed_when: hana_start_result.rc == 0
216216

217-
- name: "Test Execution: Validate HANA is running"
218-
become_user: "{{ db_sid | lower }}adm"
219-
ansible.builtin.shell: |
220-
set -o pipefail
221-
source /usr/sap/{{ db_sid | upper }}/home/.sapenv.sh && \
222-
sapcontrol -nr {{ db_instance_number }} -function GetProcessList
223-
args:
224-
executable: /bin/bash
225-
register: hana_process_check
226-
delegate_to: "{{ backup_primary_node }}"
227-
run_once: true
228-
retries: 50
229-
delay: 10
230-
until: hana_process_check.rc == 0 or hana_process_check.rc == 3
231-
changed_when: false
232-
233217
- name: "Test Execution: Verify DB consistency post-recovery"
234218
become_user: "{{ db_sid | lower }}adm"
235219
ansible.builtin.shell: |
@@ -263,7 +247,6 @@
263247
run_once: true
264248
changed_when: hsr_enable_result.rc == 0
265249
failed_when: hsr_enable_result.rc not in [0, 102]
266-
when: (hana_process_check.rc | default(1)) in [0, 3]
267250

268251
- name: "Test Execution: HSR - Start HANA on secondary"
269252
become_user: "{{ db_sid | lower }}adm"
@@ -360,7 +343,6 @@
360343
(hana_recover_systemdb_result.rc
361344
| default(hana_recover_recent_result.rc
362345
| default(1))) == 0
363-
and (hana_process_check.rc | default(1)) in [0, 3]
364346
and (db_consistency_check.rc | default(1)) == 0
365347
and hsr_register_result.rc | default(1) == 0
366348
) else 'FAILED' }}"
@@ -373,7 +355,6 @@
373355
(hana_recover_systemdb_result.rc
374356
| default(hana_recover_recent_result.rc
375357
| default(1))) == 0
376-
and (hana_process_check.rc | default(1)) in [0, 3]
377358
and (db_consistency_check.rc | default(1)) == 0
378359
) else 'FAILED' }}"
379360
run_once: true
@@ -388,7 +369,6 @@
388369
test_case_message_from_test_case: >-
389370
HANA DB recovery ({{ 'Catalog-based' if (backup_catalog_result.rc | default(1) == 0) else 'Most-recent-backup' }}):
390371
Recovery succeeded: {{ (hana_recover_systemdb_result.rc | default(hana_recover_recent_result.rc | default(1))) == 0 }},
391-
HANA running: {{ (hana_process_check.rc | default(1)) in [0, 3] }},
392372
DB consistent: {{ (db_consistency_check.rc | default(1)) == 0 }}
393373
test_case_details_from_test_case:
394374
topology: "Standalone"
@@ -398,7 +378,6 @@
398378
hana_recover_systemdb: "{{ hana_recover_systemdb_result | default({}) }}"
399379
hana_recover_recent: "{{ hana_recover_recent_result | default({}) }}"
400380
hana_start: "{{ hana_start_result }}"
401-
hana_process_check: "{{ hana_process_check }}"
402381
db_consistency: "{{ db_consistency_check }}"
403382
run_once: true
404383
when: not (database_high_availability | default(false) | bool)
@@ -408,7 +387,6 @@
408387
test_case_message_from_test_case: >-
409388
HANA DB recovery (HSR, {{ 'Catalog-based' if (backup_catalog_result.rc | default(1) == 0) else 'Most-recent-backup' }}):
410389
Recovery succeeded: {{ (hana_recover_systemdb_result.rc | default(hana_recover_recent_result.rc | default(1))) == 0 }},
411-
HANA running: {{ (hana_process_check.rc | default(1)) in [0, 3] }},
412390
DB consistent: {{ (db_consistency_check.rc | default(1)) == 0 }},
413391
HSR re-established: {{ (hsr_register_result.rc | default(1)) == 0 }}
414392
test_case_details_from_test_case:
@@ -419,7 +397,6 @@
419397
hana_recover_systemdb: "{{ hana_recover_systemdb_result | default({}) }}"
420398
hana_recover_recent: "{{ hana_recover_recent_result | default({}) }}"
421399
hana_start: "{{ hana_start_result }}"
422-
hana_process_check: "{{ hana_process_check }}"
423400
db_consistency: "{{ db_consistency_check }}"
424401
cluster_status_pre: "{{ cluster_status_pre | default({}) }}"
425402
hsr_disable: "{{ hsr_disable_result | default({}) }}"

src/roles/backup_db_hana/tasks/restore-cross-vm.yml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,6 @@
167167
run_once: true
168168
changed_when: alr_hana_start_for_tenant.rc == 0
169169

170-
- name: "Test Execution: ALR - Wait for HANA ready on target"
171-
become_user: "{{ db_sid | lower }}adm"
172-
ansible.builtin.shell: |
173-
set -o pipefail
174-
source /usr/sap/{{ db_sid | upper }}/home/.sapenv.sh && \
175-
sapcontrol -nr {{ db_instance_number }} -function GetProcessList
176-
args:
177-
executable: /bin/bash
178-
register: alr_hana_ready_check
179-
delegate_to: "{{ backup_target_vm_name }}"
180-
run_once: true
181-
retries: 30
182-
delay: 10
183-
until: alr_hana_ready_check.rc == 0 or alr_hana_ready_check.rc == 3
184-
changed_when: false
185-
186170
- name: "Test Execution: ALR - Restore tenant '{{ db_item.name }}' to {{ backup_target_vm_name }}"
187171
delegate_to: localhost
188172
azure_backup_hana:
@@ -252,22 +236,6 @@
252236
run_once: true
253237
changed_when: alr_hana_start.rc == 0
254238

255-
- name: "Test Execution: Validate HANA on target VM"
256-
become_user: "{{ db_sid | lower }}adm"
257-
ansible.builtin.shell: |
258-
set -o pipefail
259-
source /usr/sap/{{ db_sid | upper }}/home/.sapenv.sh && \
260-
sapcontrol -nr {{ db_instance_number }} -function GetProcessList
261-
args:
262-
executable: /bin/bash
263-
register: alr_process_check
264-
delegate_to: "{{ backup_target_vm_name }}"
265-
run_once: true
266-
retries: 50
267-
delay: 10
268-
until: alr_process_check.rc == 0 or alr_process_check.rc == 3
269-
changed_when: false
270-
271239
- name: "Test Execution: Verify DB on target VM"
272240
become_user: "{{ db_sid | lower }}adm"
273241
ansible.builtin.shell: |
@@ -312,7 +280,6 @@
312280
ansible.builtin.set_fact:
313281
test_execution_status: "{{ 'PASSED' if (
314282
alr_tenant_ok | bool
315-
and (alr_process_check.rc | default(1)) in [0, 3]
316283
) else 'FAILED' }}"
317284
run_once: true
318285

@@ -326,15 +293,13 @@
326293
test_case_message_from_test_case: >-
327294
Cross-VM Restore (ALR) for {{ backup_tenant_items | length }} tenant DB(s) to {{ backup_target_vm_name }}:
328295
Tenants: {{ alr_tenant_ok }},
329-
Target HANA running: {{ (alr_process_check.rc | default(1)) in [0, 3] }},
330296
DB consistent: {{ (alr_db_check.rc | default(1)) == 0 }}
331297
test_case_details_from_test_case:
332298
target_vm: "{{ backup_target_vm_name }}"
333299
databases_restored: "{{ backup_tenant_items | map(attribute='name') | list }}"
334300
tenant_results: "{{ alr_tenant_results.results | default([]) }}"
335301
tenant_job_statuses: "{{ alr_tenant_job_statuses.results | default([]) }}"
336302
hana_target_start: "{{ alr_hana_start }}"
337-
hana_target_process: "{{ alr_process_check }}"
338303
target_db_check: "{{ alr_db_check }}"
339304
run_once: true
340305

src/roles/backup_db_hana/tasks/restore-to-db.yml

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -276,22 +276,6 @@
276276
changed_when: hana_start_for_tenant.rc == 0
277277
when: backup_tenant_items | length > 0
278278

279-
- name: "Test Execution: Wait for HANA to be ready"
280-
become_user: "{{ db_sid | lower }}adm"
281-
ansible.builtin.shell: |
282-
set -o pipefail
283-
source /usr/sap/{{ db_sid | upper }}/home/.sapenv.sh && \
284-
sapcontrol -nr {{ db_instance_number }} -function GetProcessList
285-
args:
286-
executable: /bin/bash
287-
register: hana_ready_check
288-
delegate_to: "{{ backup_primary_node }}"
289-
run_once: true
290-
retries: 30
291-
delay: 10
292-
until: hana_ready_check.rc == 0 or hana_ready_check.rc == 3
293-
when: backup_tenant_items | length > 0
294-
295279
- name: "Test Execution: Restore tenant database '{{ db_item.name }}'"
296280
delegate_to: localhost
297281
azure_backup_hana:
@@ -360,21 +344,6 @@
360344
run_once: true
361345
changed_when: hana_start_result.rc == 0
362346

363-
- name: "Test Execution: Validate HANA is running"
364-
become_user: "{{ db_sid | lower }}adm"
365-
ansible.builtin.shell: |
366-
set -o pipefail
367-
source /usr/sap/{{ db_sid | upper }}/home/.sapenv.sh && \
368-
sapcontrol -nr {{ db_instance_number }} -function GetProcessList
369-
args:
370-
executable: /bin/bash
371-
register: hana_process_check
372-
delegate_to: "{{ backup_primary_node }}"
373-
run_once: true
374-
retries: 50
375-
delay: 10
376-
until: hana_process_check.rc == 0 or hana_process_check.rc == 3
377-
378347
- name: "Test Execution: HSR - Re-establish replication"
379348
when: database_high_availability | default(false) | bool
380349
block:
@@ -392,7 +361,6 @@
392361
run_once: true
393362
changed_when: hsr_enable_result.rc == 0
394363
failed_when: hsr_enable_result.rc not in [0, 102]
395-
when: (hana_process_check.rc | default(1)) in [0, 3]
396364

397365
- name: "Test Execution: HSR - Start HANA on secondary"
398366
become_user: "{{ db_sid | lower }}adm"
@@ -485,7 +453,6 @@
485453
test_execution_status: "{{ 'PASSED' if (
486454
systemdb_all_ok | bool
487455
and tenant_all_ok | bool
488-
and (hana_process_check.rc | default(1)) in [0, 3]
489456
and hsr_register_result.rc | default(1) == 0
490457
) else 'FAILED' }}"
491458
run_once: true
@@ -496,7 +463,6 @@
496463
test_execution_status: "{{ 'PASSED' if (
497464
systemdb_all_ok | bool
498465
and tenant_all_ok | bool
499-
and (hana_process_check.rc | default(1)) in [0, 3]
500466
) else 'FAILED' }}"
501467
run_once: true
502468

@@ -510,7 +476,6 @@
510476
test_case_message_from_test_case: >-
511477
Restore to DB (OLR) for {{ backup_source_items | length }} DB(s):
512478
SYSTEMDB: {{ systemdb_all_ok }}, Tenants: {{ tenant_all_ok }},
513-
HANA DB running: {{ (hana_process_check.rc | default(1)) in [0, 3] }}
514479
test_case_details_from_test_case:
515480
topology: "Standalone"
516481
databases_restored: "{{ backup_source_items | map(attribute='name') | list }}"
@@ -520,7 +485,6 @@
520485
tenant_job_statuses: "{{ tenant_job_statuses.results | default([]) }}"
521486
hana_stop: "{{ hana_stop_result }}"
522487
hana_start: "{{ hana_start_result }}"
523-
hana_process_check: "{{ hana_process_check }}"
524488
run_once: true
525489
when: not (database_high_availability | default(false) | bool)
526490

@@ -529,7 +493,6 @@
529493
test_case_message_from_test_case: >-
530494
Restore to DB (HSR - AlternateWorkloadRestore) for {{ backup_source_items | length }} DB(s):
531495
SYSTEMDB: {{ systemdb_all_ok }}, Tenants: {{ tenant_all_ok }},
532-
HANA DB running: {{ (hana_process_check.rc | default(1)) in [0, 3] }},
533496
HSR re-established: {{ (hsr_register_result.rc | default(1)) == 0 }}
534497
test_case_details_from_test_case:
535498
topology: "HSR"
@@ -540,7 +503,6 @@
540503
tenant_job_statuses: "{{ tenant_job_statuses.results | default([]) }}"
541504
hana_stop: "{{ hana_stop_result }}"
542505
hana_start: "{{ hana_start_result }}"
543-
hana_process_check: "{{ hana_process_check }}"
544506
cluster_status_pre: "{{ cluster_status_pre | default({}) }}"
545507
hsr_disable: "{{ hsr_disable_result | default({}) }}"
546508
hsr_unregister: "{{ hsr_unregister_result | default({}) }}"

0 commit comments

Comments
 (0)