Skip to content

Commit e7d4bae

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 module "migration" to detect the use of cluster-controlled filesystem setups for SAP ASCS/ERS, which is no longer supported in SLES 16. 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 ordered to start before the `SAPInstance`.
1 parent 52a1e2b commit e7d4bae

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

crmsh/migration.py

Lines changed: 51 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,53 @@ 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+
# Check if the group contains both an ERS instance and a Filesystem resource
466+
ers_in_group = [p for p in ers_primitives if p.get('id') in group_primitive_ids]
467+
fs_in_group = [fs_id for fs_id in fs_ids if fs_id in group_primitive_ids]
468+
469+
if not ers_in_group or not fs_in_group:
470+
continue
471+
472+
# 4. Check ordering constraints for each pair
473+
for ers_primitive in ers_in_group:
474+
ers_id = ers_primitive.get('id')
475+
for fs_id in fs_in_group:
476+
# Check for ordering constraints within the group or at the top-level
477+
if (group.xpath(f'.//rsc_order[@first="{fs_id}" and @then="{ers_id}"]') or
478+
cib.xpath(f'/cib/configuration//constraints/rsc_order[@first="{fs_id}" and @then="{ers_id}"]')):
479+
handler.handle_problem(
480+
False,
481+
"Cluster-controlled filesystem setup for SAP ENSA2 is not supported in SLES 16. Please migrate to simple-mount setup.",
482+
[f'* Filesystem resource "{fs_id}" is configured to start before SAPInstance ERS resource "{ers_id}".']
483+
)

0 commit comments

Comments
 (0)