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: service_available:
sg-core: True sg-core: True
telemetry_services: telemetry_services:
aodh_gnocchi: True metric_backends: gnocchi,prometheus
aodh_prometheus: True
telemetry: telemetry:
disable_ssl_certificate_validation: True disable_ssl_certificate_validation: True
tempest_test_regex: telemetry_tempest_plugin tempest_test_regex: telemetry_tempest_plugin

View File

@ -29,7 +29,7 @@ class TelemetryAlarmingAPIGnocchiTest(base.BaseAlarmingTest):
""" """
super(TelemetryAlarmingAPIGnocchiTest, cls).skip_checks() 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" % msg = ("%s: Skipping Gnocchi specific tests withouth Gnocchi" %
cls.__name__) cls.__name__)
raise cls.skipException(msg) raise cls.skipException(msg)

View File

@ -39,7 +39,7 @@ class TelemetryAlarmingNegativeGnocchiTest(base.BaseAlarmingTest):
""" """
super(TelemetryAlarmingNegativeGnocchiTest, cls).skip_checks() 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" % msg = ("%s: Skipping Gnocchi specific tests withouth Gnocchi" %
cls.__name__) cls.__name__)
raise cls.skipException(msg) raise cls.skipException(msg)

View File

@ -31,7 +31,7 @@ class TelemetryAlarmingAPIMysqlTest(base.BaseAlarmingTest):
""" """
super(TelemetryAlarmingAPIMysqlTest, cls).skip_checks() 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" % msg = ("%s: Skipping mysql specific tests withouth mysql" %
cls.__name__) cls.__name__)
raise cls.skipException(msg) raise cls.skipException(msg)

View File

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