Skip to content

Commit

Permalink
Merge pull request #90 from yeoldegrove/feat/resources_maintenance
Browse files Browse the repository at this point in the history
add possibility to run maintenance procedure on resources
  • Loading branch information
yeoldegrove authored Jun 3, 2022
2 parents 19c9b95 + 4026018 commit 51cd7c2
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 1 deletion.
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">habootstrap-formula</param>
<param name="versionformat">0.4.5+git.%ct.%h</param>
<param name="versionformat">0.4.6+git.%ct.%h</param>
<param name="revision">%%VERSION%%</param>
</service>

Expand Down
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
9 changes: 9 additions & 0 deletions cluster/packages.sls
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ patterns-ha-ha_sles:
attempts: 3
interval: 15
install_cluster_packages:
pkg.installed:
- retry:
attempts: 3
interval: 15
- pkgs:
- ClusterTools2
{% else %}
install_cluster_packages:
Expand All @@ -37,6 +45,7 @@ install_cluster_packages:
- pacemaker
- resource-agents
- sbd
- ClusterTools2
{% endif %}
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 %}
7 changes: 7 additions & 0 deletions habootstrap-formula.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Jun 03 11:25:12 UTC 2022 - Eike Waldt <[email protected]>

- Version bump 0.4.6
* install ClusterTools2
* add possibility to run maintenance procedure on resources

-------------------------------------------------------------------
Wed May 25 12:12:57 UTC 2022 - Eike Waldt <[email protected]>

Expand Down

0 comments on commit 51cd7c2

Please sign in to comment.