Skip to content

Commit

Permalink
add possibility to run maintenance procedure on resources
Browse files Browse the repository at this point in the history
  • Loading branch information
yeoldegrove committed Jun 3, 2022
1 parent 149d832 commit 422fd57
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions cluster/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ include:
{% endif %}
{% if host not in cluster.remove %}
- .configure_resources
- .resources_maintenance
{% endif %}
{% if cluster.hacluster_password is defined %}
- .hacluster_user
Expand Down
50 changes: 50 additions & 0 deletions cluster/resources_maintenance.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This is e.g. needed to be run on the initial HANA cluster node to detect a running HANA correctly.
# It follows the maintenance procedures from `man 7 SAPHanaSR_maintenance_examples`.
# Without it, a "end action monitor_clone with rc=8 (0.155.0)" might happen.
# This is somewhat a new behaviour in SAPHanaSR-0.155.0-4.17.1.
#
# It might also be used by any other cluster resource, this is why it is generally available.
#
{%- from "cluster/map.jinja" import cluster with context -%}
{% set host = grains['host'] %}
{% if cluster.init == host %}
{% if cluster.configure is defined and cluster.configure.template is defined and cluster.configure.template.parameters is defined %}
{% set resources = cluster.configure.template.parameters.resources_maintenance|default([]) %}
{% for resource in resources %}
resource_maintenance:
cmd.run:
- name: crm resource maintenance {{ resource }} on
# start after resources are defined
- require:
- configure-the-cluster
wait_after_resource_maintenance:
cmd.run:
- name: cs_wait_for_idle --sleep 5
- require:
- resource_maintenance
resource_refresh:
cmd.run:
- name: crm resource refresh {{ resource }}
- require:
- wait_after_resource_maintenance
wait_after_resource_refresh:
cmd.run:
- name: cs_wait_for_idle --sleep 5
- require:
- resource_refresh
resource_maintenance_off:
cmd.run:
- name: crm resource maintenance {{ resource }} off
- require:
- wait_after_resource_refresh
{% endfor %}
{% endif %}
{% endif %}

0 comments on commit 422fd57

Please sign in to comment.