Migrate evaluation_interval to [evaluator]

... because this parameter is specific to aodh-evaluator and not used
by the other services.

Change-Id: I6a78a749c2b2f03195dae3390c54663632cc8069
This commit is contained in:
Takashi Kajinami 2022-04-14 21:48:15 +09:00
parent 12ee78cdef
commit 9ff2b4e8f4
4 changed files with 20 additions and 10 deletions

View File

@ -215,8 +215,10 @@ class AlarmEvaluationService(cotyledon.Service):
# allow time for coordination if necessary
delay_start = self.partition_coordinator.is_active()
evaluation_interval = self.conf.evaluator.evaluation_interval
if self.evaluators:
@periodics.periodic(spacing=self.conf.evaluation_interval,
@periodics.periodic(spacing=evaluation_interval,
run_immediately=not delay_start)
def evaluate_alarms():
self._evaluate_assigned_alarms()
@ -225,7 +227,7 @@ class AlarmEvaluationService(cotyledon.Service):
if self.partition_coordinator.is_active():
heartbeat_interval = min(self.conf.coordination.heartbeat_interval,
self.conf.evaluation_interval / 4)
evaluation_interval / 4)
@periodics.periodic(spacing=heartbeat_interval,
run_immediately=True)
@ -288,7 +290,7 @@ class AlarmEvaluationService(cotyledon.Service):
def _assigned_alarms(self):
before = (timeutils.utcnow() - datetime.timedelta(
seconds=self.conf.evaluation_interval / 2))
seconds=self.conf.evaluator.evaluation_interval / 2))
selected = self.storage_conn.get_alarms(
enabled=True,
type={'ne': 'event'},

View File

@ -41,11 +41,6 @@ OPTS = [
'effect.'),
help='Timeout seconds for HTTP requests. Set it to None to '
'disable timeout.'),
cfg.IntOpt('evaluation_interval',
default=60,
help='Period of evaluation cycle, should'
' be >= than configured pipeline interval for'
' collection of underlying meters.'),
]
EVALUATOR_OPTS = [
@ -53,7 +48,13 @@ EVALUATOR_OPTS = [
default=1,
min=1,
help='Number of workers for evaluator service. '
'default value is 1.')
'default value is 1.'),
cfg.IntOpt('evaluation_interval',
default=60,
deprecated_group='DEFAULT',
help='Period of evaluation cycle, should'
' be >= than configured pipeline interval for'
' collection of underlying meters.'),
]
NOTIFIER_OPTS = [

View File

@ -66,7 +66,8 @@ class TestAlarmEvaluationService(tests_base.BaseTestCase):
coordination_active=False):
self.CONF.set_override('evaluation_interval',
test_interval)
test_interval,
group='evaluator')
self.CONF.set_override('heartbeat_interval',
coordination_heartbeat_interval,
group='coordination')

View File

@ -0,0 +1,6 @@
---
deprecations:
- |
The ``[DEFAULT] evaluation_interval`` parameter has been migrated to
the ``[evaluator]`` section. The old parameter is still kept for backword
compatibility but will be removed in a future release.