Merge "Fix uniform airflow strategy config parameter"
This commit is contained in:
@@ -90,12 +90,6 @@ class UniformAirflow(base.BaseStrategy):
|
|||||||
super(UniformAirflow, self).__init__(config, osc)
|
super(UniformAirflow, self).__init__(config, osc)
|
||||||
# The migration plan will be triggered when the airflow reaches
|
# The migration plan will be triggered when the airflow reaches
|
||||||
# threshold
|
# threshold
|
||||||
self.meter_name_airflow = self.METRIC_NAMES[
|
|
||||||
self.config.datasource]['host_airflow']
|
|
||||||
self.meter_name_inlet_t = self.METRIC_NAMES[
|
|
||||||
self.config.datasource]['host_inlet_temp']
|
|
||||||
self.meter_name_power = self.METRIC_NAMES[
|
|
||||||
self.config.datasource]['host_power']
|
|
||||||
self._period = self.PERIOD
|
self._period = self.PERIOD
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -158,11 +152,14 @@ class UniformAirflow(base.BaseStrategy):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_config_opts(cls):
|
def get_config_opts(cls):
|
||||||
return [
|
return [
|
||||||
cfg.StrOpt(
|
cfg.ListOpt(
|
||||||
"datasource",
|
"datasources",
|
||||||
help="Data source to use in order to query the needed metrics",
|
help="Datasources to use in order to query the needed metrics."
|
||||||
default="gnocchi",
|
" If one of strategy metric isn't available in the first"
|
||||||
choices=["ceilometer", "gnocchi"])
|
" 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):
|
def get_available_compute_nodes(self):
|
||||||
@@ -317,6 +314,13 @@ class UniformAirflow(base.BaseStrategy):
|
|||||||
if self.compute_model.stale:
|
if self.compute_model.stale:
|
||||||
raise wexc.ClusterStateStale()
|
raise wexc.ClusterStateStale()
|
||||||
|
|
||||||
|
self.meter_name_airflow = self.METRIC_NAMES[
|
||||||
|
self.datasource_backend.NAME]['host_airflow']
|
||||||
|
self.meter_name_inlet_t = self.METRIC_NAMES[
|
||||||
|
self.datasource_backend.NAME]['host_inlet_temp']
|
||||||
|
self.meter_name_power = self.METRIC_NAMES[
|
||||||
|
self.datasource_backend.NAME]['host_power']
|
||||||
|
|
||||||
LOG.debug(self.compute_model.to_string())
|
LOG.debug(self.compute_model.to_string())
|
||||||
|
|
||||||
def do_execute(self):
|
def do_execute(self):
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import oslo_utils
|
|||||||
|
|
||||||
|
|
||||||
class FakeCeilometerMetrics(object):
|
class FakeCeilometerMetrics(object):
|
||||||
|
NAME = 'ceilometer'
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.emptytype = ""
|
self.emptytype = ""
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import oslo_utils
|
|||||||
|
|
||||||
|
|
||||||
class FakeGnocchiMetrics(object):
|
class FakeGnocchiMetrics(object):
|
||||||
|
NAME = 'gnocchi'
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.emptytype = ""
|
self.emptytype = ""
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ class TestUniformAirflow(base.TestCase):
|
|||||||
|
|
||||||
self.m_model.return_value = model_root.ModelRoot()
|
self.m_model.return_value = model_root.ModelRoot()
|
||||||
self.m_datasource.return_value = mock.Mock(
|
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.UniformAirflow(
|
self.strategy = strategies.UniformAirflow(
|
||||||
config=mock.Mock(datasource=self.datasource))
|
config=mock.Mock(datasource=self.datasource))
|
||||||
self.strategy.input_parameters = utils.Struct()
|
self.strategy.input_parameters = utils.Struct()
|
||||||
@@ -83,6 +84,7 @@ class TestUniformAirflow(base.TestCase):
|
|||||||
self.strategy.threshold_inlet_t = 28
|
self.strategy.threshold_inlet_t = 28
|
||||||
self.strategy.threshold_power = 350
|
self.strategy.threshold_power = 350
|
||||||
self._period = 300
|
self._period = 300
|
||||||
|
self.strategy.pre_execute()
|
||||||
|
|
||||||
def test_calc_used_resource(self):
|
def test_calc_used_resource(self):
|
||||||
model = self.fake_cluster.generate_scenario_7_with_2_nodes()
|
model = self.fake_cluster.generate_scenario_7_with_2_nodes()
|
||||||
|
|||||||
Reference in New Issue
Block a user