Skip to content

Commit

Permalink
Make SystemdService never give up on resources
Browse files Browse the repository at this point in the history
Change-Id: Icd202be7cf55f8bd883d102c81881ed15a0e5191
Closes-Bug: #1859044
  • Loading branch information
George Kraft committed Apr 7, 2020
1 parent f658638 commit 302f107
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion common.py
Expand Up @@ -717,7 +717,9 @@ def configure_resource(self, crm):
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)
Expand Down
6 changes: 4 additions & 2 deletions unit_tests/test_common.py
Expand Up @@ -430,7 +430,8 @@ def test_configure_resource(self):
'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'],
Expand All @@ -445,6 +446,7 @@ def test_configure_resource_no_clone(self):
'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'))
5 changes: 4 additions & 1 deletion unit_tests/test_requires.py
Expand Up @@ -532,7 +532,10 @@ def test_add_systemd_service(self):
'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': {},
Expand Down

0 comments on commit 302f107

Please sign in to comment.