Refactor options to enabled backends

Aodh can use only one database so having multiple options per backend
software is very redundant.

Also, gnocchi and prometheus are used for the same purpose so can use
a single option instead.

Change-Id: I134cf61d8137409ef5f5d959177e349781110eaa
This commit is contained in:
Takashi Kajinami 2024-01-31 19:42:42 +09:00
parent 7cb127ad95
commit 0beea18cea
5 changed files with 13 additions and 17 deletions

View File

@ -54,8 +54,7 @@
service_available:
sg-core: True
telemetry_services:
aodh_gnocchi: True
aodh_prometheus: True
metric_backends: gnocchi,prometheus
telemetry:
disable_ssl_certificate_validation: True
tempest_test_regex: telemetry_tempest_plugin

View File

@ -29,7 +29,7 @@ class TelemetryAlarmingAPIGnocchiTest(base.BaseAlarmingTest):
"""
super(TelemetryAlarmingAPIGnocchiTest, cls).skip_checks()
if not CONF.telemetry_services.aodh_gnocchi:
if 'gnocchi' not in CONF.telemetry_services.metric_backends:
msg = ("%s: Skipping Gnocchi specific tests withouth Gnocchi" %
cls.__name__)
raise cls.skipException(msg)

View File

@ -39,7 +39,7 @@ class TelemetryAlarmingNegativeGnocchiTest(base.BaseAlarmingTest):
"""
super(TelemetryAlarmingNegativeGnocchiTest, cls).skip_checks()
if not CONF.telemetry_services.aodh_gnocchi:
if 'gnocchi' not in CONF.telemetry_services.metric_backends:
msg = ("%s: Skipping Gnocchi specific tests withouth Gnocchi" %
cls.__name__)
raise cls.skipException(msg)

View File

@ -31,7 +31,7 @@ class TelemetryAlarmingAPIMysqlTest(base.BaseAlarmingTest):
"""
super(TelemetryAlarmingAPIMysqlTest, cls).skip_checks()
if not CONF.telemetry_services.aodh_mysql:
if CONF.telemetry_services.alarm_backend != 'mysql':
msg = ("%s: Skipping mysql specific tests withouth mysql" %
cls.__name__)
raise cls.skipException(msg)

View File

@ -14,6 +14,7 @@
# under the License.
from oslo_config import cfg
from oslo_config import types
service_option = [cfg.BoolOpt('ceilometer',
@ -86,18 +87,14 @@ TelemetryGroup = [
]
telemetry_services_opts = [
cfg.BoolOpt('aodh_gnocchi',
default=False,
help="Can telemetry plugin expect gnocchi backend"),
cfg.BoolOpt('aodh_mysql',
default=False,
help="Can telemetry plugin expect mysql backend"),
cfg.BoolOpt('aodh_postgre',
default=False,
help="Can telemetry plugin expect postgre backend"),
cfg.BoolOpt('aodh_prometheus',
default=False,
help="Can telemetry plugin expect prometheus backend"),
cfg.ListOpt('metric_backends',
default=[],
item_type=types.String(choices=['gnocchi', 'prometheus']),
help="Backend store used to store metrics"),
cfg.StrOpt('alarm_backend',
default='mysql',
choices=['mysql', 'postgresq'],
help="Database used by the aodh service"),
]
event_opts = [