From 1948461d953cea893a5b146e700a759dd3dcc744 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 6 Jul 2021 17:13:45 +0900 Subject: [PATCH] Rename [coordination] heartbeat to hearbeat_interval ... so that users can more easily understnad the parameter defines interval. This makes the parameter name consistent with other services like designate or mistral, which provides the similar functionality using the same tooz library. Change-Id: I53cf905d7f643a3dc41f1121404abe3c9f0e61ac --- aodh/coordination.py | 3 ++- aodh/evaluator/__init__.py | 2 +- aodh/tests/unit/test_evaluator.py | 8 ++++---- .../notes/heartbeat_interval-d46e0f5efbd56264.yaml | 7 +++++++ 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/heartbeat_interval-d46e0f5efbd56264.yaml diff --git a/aodh/coordination.py b/aodh/coordination.py index 5aaf5f429..5aec7f4ca 100644 --- a/aodh/coordination.py +++ b/aodh/coordination.py @@ -32,8 +32,9 @@ OPTS = [ 'left empty, alarm evaluation won\'t do workload ' 'partitioning and will only function correctly if a ' 'single instance of the service is running.'), - cfg.FloatOpt('heartbeat', + cfg.FloatOpt('heartbeat_interval', default=1.0, + deprecated_name='heartbeat', help='Number of seconds between heartbeats for distributed ' 'coordination.'), cfg.FloatOpt('check_watchers', diff --git a/aodh/evaluator/__init__.py b/aodh/evaluator/__init__.py index a72daacb9..35e47175e 100644 --- a/aodh/evaluator/__init__.py +++ b/aodh/evaluator/__init__.py @@ -224,7 +224,7 @@ class AlarmEvaluationService(cotyledon.Service): self.periodic.add(evaluate_alarms) if self.partition_coordinator.is_active(): - heartbeat_interval = min(self.conf.coordination.heartbeat, + heartbeat_interval = min(self.conf.coordination.heartbeat_interval, self.conf.evaluation_interval / 4) @periodics.periodic(spacing=heartbeat_interval, diff --git a/aodh/tests/unit/test_evaluator.py b/aodh/tests/unit/test_evaluator.py index 893919d81..47eb34a97 100644 --- a/aodh/tests/unit/test_evaluator.py +++ b/aodh/tests/unit/test_evaluator.py @@ -62,13 +62,13 @@ class TestAlarmEvaluationService(tests_base.BaseTestCase): )) def _do_test_start(self, test_interval=120, - coordination_heartbeat=1.0, + coordination_heartbeat_interval=1.0, coordination_active=False): self.CONF.set_override('evaluation_interval', test_interval) - self.CONF.set_override('heartbeat', - coordination_heartbeat, + self.CONF.set_override('heartbeat_interval', + coordination_heartbeat_interval, group='coordination') self._fake_pc.is_active.return_value = coordination_active @@ -88,7 +88,7 @@ class TestAlarmEvaluationService(tests_base.BaseTestCase): def test_start_coordinated_high_hb_interval(self): self._do_test_start(coordination_active=True, test_interval=10, - coordination_heartbeat=5) + coordination_heartbeat_interval=5) def test_evaluation_cycle(self): alarm = mock.Mock(type='gnocchi_aggregation_by_metrics_threshold', diff --git a/releasenotes/notes/heartbeat_interval-d46e0f5efbd56264.yaml b/releasenotes/notes/heartbeat_interval-d46e0f5efbd56264.yaml new file mode 100644 index 000000000..7552e2b83 --- /dev/null +++ b/releasenotes/notes/heartbeat_interval-d46e0f5efbd56264.yaml @@ -0,0 +1,7 @@ +--- +deprecations: + - | + The ``[coordination] heartbeat`` parameter has been renamed to + the ``[coordination] heartbeat_interval``. + The old ``[coordination] heartbeat`` parameter is deprecated and will be + removed in a future release.