Merge "Add new config option optimize.datasource"

This commit is contained in:
Zuul 2025-02-05 14:07:06 +00:00 committed by Gerrit Code Review
commit b75a946b1f
3 changed files with 41 additions and 1 deletions

View File

@ -21,3 +21,15 @@ service_option = cfg.BoolOpt("watcher",
default=True,
help="Whether or not watcher is expected to be "
"available")
optimization_group = cfg.OptGroup(name="optimize",
title="Watcher Service Options")
OptimizationGroup = [
cfg.StrOpt("datasource",
default="gnocchi",
choices=["gnocchi", ""],
help="Name of the data source used with the Watcher Service"
"gnocchi is a supported datasources. use ''"
"for no datasource"),
]

View File

@ -30,5 +30,12 @@ class WatcherTempestPlugin(plugins.TempestPlugin):
conf.register_opt(watcher_config.service_option,
group='service_available')
conf.register_group(watcher_config.optimization_group)
conf.register_opts(watcher_config.OptimizationGroup,
watcher_config.optimization_group)
def get_opt_lists(self):
return [('service_available', [watcher_config.service_option])]
return [('service_available', [watcher_config.service_option]),
(watcher_config.optimization_group.name,
watcher_config.OptimizationGroup)
]

View File

@ -302,6 +302,16 @@ class BaseInfraOptimScenarioTest(manager.ScenarioTest):
return measures_body
def make_host_statistic(self, metrics=dict()):
"""Add host metrics to the datasource
:param metrics: The metrics add to resource when using Gnocchi
"""
if not CONF.optimize.datasource:
pass
else:
self.make_host_statistic_gnocchi(metrics)
def make_host_statistic_gnocchi(self, metrics=dict()):
"""Create host resource and its measures in Gnocchi DB
:param metrics: The metrics add to resource when using Gnocchi
@ -337,6 +347,17 @@ class BaseInfraOptimScenarioTest(manager.ScenarioTest):
return True
def make_instance_statistic(self, instance, metrics=dict()):
"""Add instance resources and its measures to the datasource
:param instance: Instance response body
:param metrics: The metrics add to resource when using datasource
"""
if not CONF.optimize.datasource:
pass
else:
self.make_instance_statistic_gnocchi(instance, metrics)
def make_instance_statistic_gnocchi(self, instance, metrics=dict()):
"""Create instance resource and its measures in Gnocchi DB
:param instance: Instance response body