Exclude event type from targets of alarm evaluator
The new evaluator service will be added to handle 'event' type alarms only. Existing evaluator have to exclude those 'event' type alarms from their targets which will be evaluated periodically. Change-Id: Ia501771ee8d3dcd424c7e415d8aeb3d41a8e8de0 Implements: blueprint event-alarm-evaluator
This commit is contained in:
parent
18637b5c6b
commit
1cc7087af1
@ -259,6 +259,10 @@ class AlarmEvaluationService(AlarmService, os_service.Service):
|
|||||||
self.tg.add_timer(604800, lambda: None)
|
self.tg.add_timer(604800, lambda: None)
|
||||||
|
|
||||||
def _assigned_alarms(self):
|
def _assigned_alarms(self):
|
||||||
all_alarms = self._storage_conn.get_alarms(enabled=True)
|
# NOTE(r-mibu): The 'event' type alarms will be evaluated by the
|
||||||
|
# event-driven alarm evaluator, so this periodical evaluator skips
|
||||||
|
# those alarms.
|
||||||
|
all_alarms = self._storage_conn.get_alarms(enabled=True,
|
||||||
|
exclude=dict(type='event'))
|
||||||
return self.partition_coordinator.extract_my_subset(
|
return self.partition_coordinator.extract_my_subset(
|
||||||
self.PARTITIONING_GROUP_NAME, all_alarms)
|
self.PARTITIONING_GROUP_NAME, all_alarms)
|
||||||
|
@ -135,3 +135,13 @@ class TestAlarmEvaluationService(tests_base.BaseTestCase):
|
|||||||
self.svc.start()
|
self.svc.start()
|
||||||
self.svc._evaluate_assigned_alarms()
|
self.svc._evaluate_assigned_alarms()
|
||||||
self.threshold_eval.evaluate.assert_called_once_with(alarms[1])
|
self.threshold_eval.evaluate.assert_called_once_with(alarms[1])
|
||||||
|
|
||||||
|
def test_check_alarm_query_constraints(self):
|
||||||
|
self.storage_conn.get_alarms.return_value = []
|
||||||
|
with mock.patch('aodh.storage.get_connection_from_config',
|
||||||
|
return_value=self.storage_conn):
|
||||||
|
self.svc.start()
|
||||||
|
self.svc._evaluate_assigned_alarms()
|
||||||
|
expected = [({'enabled': True, 'exclude': {'type': 'event'}},)]
|
||||||
|
self.assertEqual(expected,
|
||||||
|
self.storage_conn.get_alarms.call_args_list)
|
||||||
|
Loading…
Reference in New Issue
Block a user