Skip to content

Commit 941a0ab

Browse files
Refactor: cibquery: has_primitive_filesystem_ocfs2 to has_primitive_filesystem_with_fstype
(cherry picked from commit 48aca45)
1 parent a3464fc commit 941a0ab

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

crmsh/cibquery.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def get_configured_resource_agents(cib: lxml.etree.Element) -> typing.Set[Resour
1919
)
2020

2121

22-
def has_primitive_filesystem_ocfs2(cib: lxml.etree.Element) -> bool:
22+
def has_primitive_filesystem_with_fstype(cib: lxml.etree.Element, fstype: str) -> bool:
2323
return bool(cib.xpath(
2424
'/cib/configuration/resources//primitive[@class="ocf" and @provider="heartbeat" and @type="Filesystem"]'
25-
'/instance_attributes/nvpair[@name="fstype" and @value="ocfs2"]'
25+
f'/instance_attributes/nvpair[@name="fstype" and @value="{fstype}"]'
2626
))

crmsh/migration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ def _check_removed_resource_agents(
594594

595595

596596
def _check_ocfs2(handler: CheckResultHandler, cib: lxml.etree.Element):
597-
if cibquery.has_primitive_filesystem_ocfs2(cib):
597+
if cibquery.has_primitive_filesystem_with_fstype(cib, 'ocfs2'):
598598
handler.handle_problem(False, 'OCFS2 is not supported in SLES 16.', [
599599
'* Before migrating to SLES 16, replace it with GFS2.',
600600
])

test/unittests/test_cibquery.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,6 @@ def test_get_resource_agents(self):
105105
cibquery.get_configured_resource_agents(self.cib),
106106
)
107107

108-
def test_has_primitive_filesystem_ocfs2(self):
109-
self.assertTrue(cibquery.has_primitive_filesystem_ocfs2(self.cib))
108+
def test_has_primitive_filesystem_with_fstype(self):
109+
self.assertTrue(cibquery.has_primitive_filesystem_with_fstype(self.cib, 'ocfs2'))
110+
self.assertFalse(cibquery.has_primitive_filesystem_with_fstype(self.cib, 'foo'))

0 commit comments

Comments
 (0)