Fix outlet_temp_control config parameter

'datasource' should be 'datasources'

Change-Id: Iad337313f5d03b2fef34902950a4b5e41b3e980f
Depends-On: I2bd183e020298a93029f38008619a5bebaed3de4
This commit is contained in:
licanwei
2019-02-20 09:53:11 +08:00
parent e74ab79e81
commit dd3c4d5507
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))