Skip to content

Commit d70ed7f

Browse files
[crmsh-4.6] Dev: migration: Add check for obsolete SAP ASCS/ERS mount (jsc#SAPSOL-495)
This commit introduces a new check to the "migration" module to detect unsupported, cluster-controlled filesystem setups for SAP ASCS/ERS. The check identifies problematic Filesystem-based ENSA2 setups by inspecting the resource configuration. It detects configurations where: - A `SAPInstance` resource with `IS_ERS=true` is present. - A `Filesystem` resource is in the same group as the `SAPInstance`. - The `Filesystem` resource is implicitly ordered to start before the `SAPInstance`. The check relies on the implicit ordering of resources within a group and does not consider explicit `rsc_order` constraints, assuming users will rely on the default group behavior.
1 parent 52a1e2b commit d70ed7f

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

crmsh/migration.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ def check_unsupported_resource_agents(handler: CheckResultHandler):
341341
('* ' + ':'.join(x for x in resource_agent if x is not None) for resource_agent in class_unsupported_resource_agents)
342342
)
343343
_check_ocfs2(handler, cib)
344+
_check_obseleted_sap_ascs_ers_mount(handler, cib)
344345

345346

346347
def _check_saphana_resource_agent(handler: CheckResultHandler, resource_agents: typing.Iterable[cibquery.ResourceAgent]):
@@ -430,3 +431,60 @@ def _check_ocfs2(handler: CheckResultHandler, cib: lxml.etree.Element):
430431
if cibquery.has_primitive_filesystem_with_fstype(cib, 'ocfs2'):
431432
handler.handle_problem(False, 'OCFS2 is not supported in SLES 16. Please use GFS2.', [
432433
])
434+
435+
436+
def _check_obseleted_sap_ascs_ers_mount(handler: CheckResultHandler, cib: lxml.etree.Element):
437+
"""
438+
Checks for Filesystem resources that are part of a resource group with an
439+
SAPInstance resource where IS_ERS=true, and the Filesystem resource starts
440+
before the SAPInstance resource. This setup is not supported for ENSA2.
441+
"""
442+
# 1. Find all SAPInstance primitives with IS_ERS=true
443+
ers_primitives = cib.xpath(
444+
'/cib/configuration/resources//primitive[@class="ocf" and @provider="suse" and @type="SAPInstance"]'
445+
'[instance_attributes/nvpair[@name="IS_ERS" and @value="true"]]'
446+
)
447+
448+
# 2. Find all Filesystem primitive IDs
449+
fs_ids = {
450+
p.get('id') for p in cib.xpath('/cib/configuration/resources//primitive[@class="ocf" and @provider="heartbeat" and @type="Filesystem"]')
451+
}
452+
453+
if not ers_primitives or not fs_ids:
454+
return
455+
456+
# 3. Find all groups in the CIB
457+
groups = cib.xpath('/cib/configuration/resources//group')
458+
459+
for group in groups:
460+
group_id = group.get('id')
461+
462+
# Get all primitive IDs in the group. This includes primitives in clones inside the group.
463+
group_primitive_ids = {p.get('id') for p in group.xpath('.//primitive')}
464+
465+
# Primitives returned by xpath are in document order
466+
group_primitives_ordered_ids = [p.get('id') for p in group.xpath('.//primitive')]
467+
468+
# Check if the group contains both an ERS instance and a Filesystem resource
469+
ers_in_group = [p for p in ers_primitives if p.get('id') in group_primitive_ids]
470+
fs_in_group = [fs_id for fs_id in fs_ids if fs_id in group_primitive_ids]
471+
472+
if not ers_in_group or not fs_in_group:
473+
continue
474+
475+
# 4. Check ordering constraints for each pair
476+
for ers_primitive in ers_in_group:
477+
ers_id = ers_primitive.get('id')
478+
for fs_id in fs_in_group:
479+
try:
480+
ers_index = group_primitives_ordered_ids.index(ers_id)
481+
fs_index = group_primitives_ordered_ids.index(fs_id)
482+
if fs_index < ers_index:
483+
# Implicit order is fs -> ers
484+
handler.handle_problem(
485+
False,
486+
"Cluster-controlled filesystem setup for SAP ENSA2 is not supported in SLES 16. Please migrate to simple-mount setup.",
487+
[f'* Filesystem resource "{fs_id}" is ordered to start before SAPInstance ERS resource "{ers_id}" in group "{group_id}".']
488+
)
489+
except ValueError:
490+
pass # Should not happen

0 commit comments

Comments
 (0)