From ef1f8503f4de4edbbd8a03c8a67bae4f10a59e5a Mon Sep 17 00:00:00 2001 From: George Kraft Date: Tue, 7 Apr 2020 13:07:40 -0500 Subject: [PATCH] Make SystemdService never give up on resources Change-Id: Icd202be7cf55f8bd883d102c81881ed15a0e5191 Closes-Bug: #1859044 --- common.py | 4 +++- unit_tests/test_common.py | 6 ++++-- unit_tests/test_requires.py | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/common.py b/common.py index a982442..1db250b 100644 --- a/common.py +++ b/common.py @@ -717,7 +717,9 @@ class SystemdService(ResourceDescriptor): self.service_name.replace('-', '_'), self.systemd_service_name.replace('-', '_')) res_type = 'systemd:{}'.format(self.systemd_service_name) - crm.primitive(res_key, res_type, op='monitor interval="5s"') + _meta = 'migration-threshold="INFINITY" failure-timeout="5s"' + crm.primitive( + res_key, res_type, op='monitor interval="5s"', meta=_meta) crm.systemd_services(self.systemd_service_name) if self.clone: clone_key = 'cl_{}'.format(res_key) diff --git a/unit_tests/test_common.py b/unit_tests/test_common.py index eb883fe..0356a26 100644 --- a/unit_tests/test_common.py +++ b/unit_tests/test_common.py @@ -430,7 +430,8 @@ class TestHAClusterCommonSystemdService(unittest.TestCase): 'systemd:apache2') self.assertEqual( crm['resource_params']['res_apache_apache2'], - (' op monitor interval="5s"')) + (' meta migration-threshold="INFINITY" failure-timeout="5s"' + ' op monitor interval="5s"')) self.assertEqual(crm['systemd_services'], ('apache2',)) self.assertEqual( crm['clones']['cl_res_apache_apache2'], @@ -445,6 +446,7 @@ class TestHAClusterCommonSystemdService(unittest.TestCase): 'systemd:apache2') self.assertEqual( crm['resource_params']['res_apache_apache2'], - (' op monitor interval="5s"')) + (' meta migration-threshold="INFINITY" failure-timeout="5s"' + ' op monitor interval="5s"')) self.assertEqual(crm['systemd_services'], ('apache2',)) self.assertFalse(crm['clones'].get('cl_res_apache_apache2')) diff --git a/unit_tests/test_requires.py b/unit_tests/test_requires.py index 6cea5ae..9df043a 100644 --- a/unit_tests/test_requires.py +++ b/unit_tests/test_requires.py @@ -532,7 +532,10 @@ class TestHAClusterRequires(unittest.TestCase): 'res_mysql_telnetd': 'systemd:telnetd'}, 'delete_resources': [], 'resource_params': { - 'res_mysql_telnetd': ' op monitor interval="5s"'}, + 'res_mysql_telnetd': + (' meta migration-threshold="INFINITY" ' + 'failure-timeout="5s"' + ' op monitor interval="5s"')}, 'groups': {}, 'ms': {}, 'orders': {},