Skip to content

Commit

Permalink
Merge pull request #145 from yeoldegrove/takeover_blocker
Browse files Browse the repository at this point in the history
add SAPHanaSR takeover blocker
  • Loading branch information
yeoldegrove authored Aug 9, 2022
2 parents b7c2e25 + 161578e commit 4635f05
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
2 changes: 1 addition & 1 deletion _service
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="filename">saphanabootstrap-formula</param>
<param name="versionformat">0.11.0+git.%ct.%h</param>
<param name="versionformat">0.12.0+git.%ct.%h</param>
<param name="revision">%%VERSION%%</param>
</service>

Expand Down
36 changes: 28 additions & 8 deletions hana/ha_cluster.sls
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
{% set host = grains['host'] %}
{% if hana.scale_out %}
{% set sr_hook_path = '/usr/share/SAPHanaSR-ScaleOut' %}
{% set sr_hook_multi_target = sr_hook_path + '/SAPHanaSrMultiTarget.py' %}
{% set sr_hook = sr_hook_path + '/SAPHanaSR.py' %}
{% set hook_path = '/usr/share/SAPHanaSR-ScaleOut' %}
{% set sr_hook_multi_target = hook_path + '/SAPHanaSrMultiTarget.py' %}
{% set sr_hook = hook_path + '/SAPHanaSR.py' %}
{% set sustkover_hook = hook_path + '/susTkOver.py' %}
remove_SAPHanaSR:
pkg.removed:
Expand All @@ -19,9 +20,10 @@ install_SAPHanaSR:
- SAPHanaSR-ScaleOut-doc
{% else %}
{% set sr_hook_path = '/usr/share/SAPHanaSR' %}
{% set sr_hook_multi_target = sr_hook_path + '/SAPHanaSrMultiTarget.py' %}
{% set sr_hook = sr_hook_path + '/SAPHanaSR.py' %}
{% set hook_path = '/usr/share/SAPHanaSR' %}
{% set sr_hook_multi_target = hook_path + '/SAPHanaSrMultiTarget.py' %}
{% set sr_hook = hook_path + '/SAPHanaSR.py' %}
{% set sustkover_hook = hook_path + '/susTkOver.py' %}
remove_SAPHanaSR:
pkg.removed:
Expand Down Expand Up @@ -71,6 +73,7 @@ sudoers_create_{{ sap_instance }}:
sr_hook: {{ sr_hook }}
sr_hook_multi_target: {{ sr_hook_multi_target }}
sr_hook_string: __slot__:salt:file.grep({{ sr_hook }}, "^srHookGen = ").stdout
sustkover_hook: {{ sustkover_hook }}
# remove old entries from /etc/sudoers (migration to new /etc/sudoers.d/SAPHanaSR file)
sudoers_remove_old_entries_{{ sap_instance }}_srHook:
Expand All @@ -91,7 +94,7 @@ configure_ha_hook_{{ sap_instance }}_multi_target:
- sections:
ha_dr_provider_SAPHanaSrMultiTarget:
provider: 'SAPHanaSrMultiTarget'
path: '{{ sr_hook_path }}'
path: '{{ hook_path }}'
execution_order: '1'
trace:
ha_dr_saphanasrmultitarget: 'info'
Expand All @@ -108,7 +111,7 @@ configure_ha_hook_{{ sap_instance }}:
- sections:
ha_dr_provider_SAPHanaSR:
provider: 'SAPHanaSR'
path: '{{ sr_hook_path }}'
path: '{{ hook_path }}'
execution_order: '1'
trace:
ha_dr_saphanasr: 'info'
Expand Down Expand Up @@ -163,6 +166,23 @@ remove_wrong_ha_hook_{{ sap_instance }}_options:
- unless:
- test -f {{ sr_hook_multi_target }}
configure_susTkOver_hook_{{ sap_instance }}:
ini.options_present:
- name: /hana/shared/{{ node.sid.upper() }}/global/hdb/custom/config/global.ini
- separator: '='
- strict: False # do not touch rest of file
- sections:
ha_dr_provider_sustkover:
provider: 'susTkOver'
path: '{{ hook_path }}'
execution_order: '2'
trace:
ha_dr_sustkover: 'info'
- require:
- pkg: install_SAPHanaSR
- onlyif:
- test -f {{ sustkover_hook }}
# Configure system replication operation mode in the primary site
{% for secondary_node in hana.nodes if node.primary is defined and secondary_node.secondary is defined and secondary_node.secondary.remote_host == host %}
configure_replication_{{ sap_instance }}:
Expand Down
6 changes: 6 additions & 0 deletions saphanabootstrap-formula.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Jul 28 10:03:12 UTC 2022 - Eike Waldt <[email protected]>

- Version bump 0.12.0
* add SAPHanaSR takeover blocker

-------------------------------------------------------------------
Thu Jul 19 11:47:52 UTC 2022 - Eike Waldt <[email protected]>

Expand Down
3 changes: 3 additions & 0 deletions templates/ha_cluster_sudoers.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ Cmnd_Alias SOK_SITEB = /usr/sbin/crm_attribute -n hana_{{ node.sid.lower()
Cmnd_Alias SFAIL_SITEB = /usr/sbin/crm_attribute -n hana_{{ node.sid.lower() }}_site_srHook_{{ sites['b'] }} -v SFAIL -t crm_config -s SAPHanaSR
{{ node.sid.lower() }}adm ALL=(ALL) NOPASSWD: SOK_SITEA, SFAIL_SITEA, SOK_SITEB, SFAIL_SITEB
{%- endif %}
# SAPHanaSR takeover blocker needs for {{ sustkover_hook }}
Cmnd_Alias HOOK_HELPER_TKOVER = /usr/sbin/SAPHanaSR-hookHelper --case checkTakeover --sid={{ node.sid.lower() }}
{{ node.sid.lower() }}adm ALL=(ALL) NOPASSWD: HOOK_HELPER_TKOVER

0 comments on commit 4635f05

Please sign in to comment.