Merge "Fix outlet_temp_control config parameter"

This commit is contained in:
Zuul 2019-02-26 02:29:09 +00:00 committed by Gerrit Code Review
commit c7fe13e9e3
2 changed files with 11 additions and 7 deletions

View File

@ -144,11 +144,14 @@ class OutletTempControl(base.ThermalOptimizationBaseStrategy):
@classmethod
def get_config_opts(cls):
return [
cfg.StrOpt(
"datasource",
help="Data source to use in order to query the needed metrics",
default="gnocchi",
choices=["ceilometer", "gnocchi"])
cfg.ListOpt(
"datasources",
help="Datasources to use in order to query the needed metrics."
" If one of strategy metric isn't available in the first"
" datasource, the next datasource will be chosen.",
item_type=cfg.types.String(choices=['gnocchi', 'ceilometer',
'monasca']),
default=['gnocchi', 'ceilometer', 'monasca']),
]
def get_available_compute_nodes(self):
@ -181,7 +184,7 @@ class OutletTempControl(base.ThermalOptimizationBaseStrategy):
hosts_need_release = []
hosts_target = []
metric_name = self.METRIC_NAMES[
self.config.datasource]['host_outlet_temp']
self.datasource_backend.NAME]['host_outlet_temp']
for node in nodes.values():
resource_id = node.uuid
outlet_temp = None

View File

@ -72,7 +72,8 @@ class TestOutletTempControl(base.TestCase):
self.m_model.return_value = model_root.ModelRoot()
self.m_datasource.return_value = mock.Mock(
statistic_aggregation=self.fake_metrics.mock_get_statistics)
statistic_aggregation=self.fake_metrics.mock_get_statistics,
NAME=self.fake_metrics.NAME)
self.strategy = strategies.OutletTempControl(
config=mock.Mock(datasource=self.datasource))