Skip to content

Commit c6935e4

Browse files
committed
sap_ha_pacemaker_cluster: fix vip colo score
This fixes the HANA VIP colocation constraint conditional to always apply the base score and recalculate only when HANA-VIP resource groups are present in the definition. Assigning new values inside blocks/loops does not work (anymore) and and a namespace object has to be used instead. Reference: https://jinja.palletsprojects.com/en/latest/templates/#assignments
1 parent 378feb6 commit c6935e4

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,17 @@
128128
{%- endif -%}
129129
130130
## When in a group, increase the default base score by adding 1000 per resource in the group.
131-
__colo_score: >-
131+
__colo_score: |-
132+
{% set score = namespace(value=sap_ha_pacemaker_cluster_constraint_colo_base_score) %}
132133
{% if __sap_ha_pacemaker_cluster_resource_groups | length > 0 -%}
133134
{% for group in __sap_ha_pacemaker_cluster_resource_groups -%}
134135
{% if group.id == (sap_ha_pacemaker_cluster_vip_group_prefix
135136
+ __sap_ha_pacemaker_cluster_vip_hana_primary_resource_name) -%}
136-
{{ (group.resource_ids | length * 1000) + sap_ha_pacemaker_cluster_constraint_colo_base_score }}
137+
{% set score.value = (group.resource_ids | length * 1000) + sap_ha_pacemaker_cluster_constraint_colo_base_score %}
137138
{%- endif %}
138139
{%- endfor %}
139-
{%- else -%}
140-
{{ sap_ha_pacemaker_cluster_constraint_colo_base_score }}
141140
{%- endif %}
141+
{{ score.value }}
142142
143143
when:
144144
- __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower'))

0 commit comments

Comments
 (0)