Backwards compatibility for node parameter

Adds backwards compatibility for node parameter used by strategies. If
the node value is set by the user configuration it will override the
value for compute_node which is the value used by the strategies now.

This change was introduced in: https://review.opendev.org/#/c/656622/
Resolution discussed in the meeting on the 5th of June 2019
https://eavesdrop.openstack.org/meetings/watcher/2019/watcher.2019-06-05-08.00.log.html

Change-Id: Idaea062789a6b169e64f556fecc34cfbaaee5076
This commit is contained in:
Dantali0n
2019-06-11 11:31:37 +02:00
committed by Matt Riedemann
parent 8000dd650f
commit dd119ca1f8
5 changed files with 133 additions and 11 deletions

View File

@@ -193,8 +193,19 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
"type": "integer",
"minimum": 0
},
"node": {
"type": "integer",
# node is deprecated
"minimum": 0,
"default": 0
},
},
"default": {"instance": 720, "compute_node": 600}
"default": {
"instance": 720,
"compute_node": 600,
# node is deprecated
"node": 0,
}
},
"aggregation_method": {
"description": "Function used to aggregate multiple "
@@ -213,8 +224,18 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
"type": "string",
"default": 'mean'
},
# node is deprecated
"node": {
"type": "string",
"default": ''
},
},
"default": {"instance": 'mean', "compute_node": 'mean'}
"default": {
"instance": 'mean',
"compute_node": 'mean',
# node is deprecated
"node": '',
}
},
"granularity": {
"description": "The time between two measures in an "
@@ -485,6 +506,19 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
self.periods = self.input_parameters.periods
self.aggregation_method = self.input_parameters.aggregation_method
# backwards compatibility for node parameter with aggregate.
if self.aggregation_method['node'] is not '':
LOG.warning('Parameter node has been renamed to compute_node and '
'will be removed in next release.')
self.aggregation_method['compute_node'] = \
self.aggregation_method['node']
# backwards compatibility for node parameter with period.
if self.periods['node'] is not 0:
LOG.warning('Parameter node has been renamed to compute_node and '
'will be removed in next release.')
self.periods['compute_node'] = self.periods['node']
def do_execute(self):
migration = self.check_threshold()
if migration: