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

@@ -95,8 +95,12 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
@property
def aggregation_method(self):
return self.input_parameters.get(
'aggregation_method',
{"instance": 'mean', "compute_node": 'mean'})
'aggregation_method', {
"instance": 'mean',
"compute_node": 'mean',
"node": ''
}
)
@classmethod
def get_display_name(cls):
@@ -148,8 +152,18 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
"type": "string",
"default": 'mean'
},
"node": {
"type": "string",
# node is deprecated
"default": ''
},
},
"default": {"instance": 'mean', "compute_node": 'mean'}
"default": {
"instance": 'mean',
"compute_node": 'mean',
# node is deprecated
"node": '',
}
},
},
}
@@ -391,6 +405,13 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
def pre_execute(self):
self._pre_execute()
# backwards compatibility for node parameter.
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']
def do_execute(self):
unsuccessful_migration = 0