Move retry information setting from scheduler to engine
As we already splitted scheduler out from engine service, the retry information can't be saved anymore, so move the logic to engine to make it work again. Change-Id: If0ddc339ea705889fc52a84ed190df136abca650
This commit is contained in:
parent
345a382f72
commit
5199d96aa2
@ -313,11 +313,26 @@ class EngineManager(base_manager.BaseEngineManager):
|
||||
if filter_properties is None:
|
||||
filter_properties = {}
|
||||
|
||||
retry = filter_properties.pop('retry', {})
|
||||
|
||||
# update attempt count:
|
||||
if retry:
|
||||
retry['num_attempts'] += 1
|
||||
else:
|
||||
retry = {
|
||||
'num_attempts': 1,
|
||||
'nodes': [] # list of tried nodes
|
||||
}
|
||||
filter_properties['retry'] = retry
|
||||
|
||||
try:
|
||||
node = self.scheduler_rpcapi.select_destinations(
|
||||
context, request_spec, filter_properties)
|
||||
instance.node_uuid = node['node_uuid']
|
||||
instance.save()
|
||||
# Add a retry entry for the selected node
|
||||
nodes = retry['nodes']
|
||||
nodes.append(node['node_uuid'])
|
||||
except Exception as e:
|
||||
utils.process_event(fsm, instance, event='error')
|
||||
LOG.error("Created instance %(uuid)s failed. "
|
||||
|
@ -50,18 +50,6 @@ class FilterScheduler(driver.Scheduler):
|
||||
filter_properties['availability_zone'] = \
|
||||
instance.get('availability_zone')
|
||||
|
||||
def _add_retry_node(self, filter_properties, node):
|
||||
"""Add a retry entry for the selected Ironic node.
|
||||
|
||||
In the event that the request gets re-scheduled, this entry will signal
|
||||
that the given node has already been tried.
|
||||
"""
|
||||
retry = filter_properties.get('retry', None)
|
||||
if not retry:
|
||||
return
|
||||
nodes = retry['nodes']
|
||||
nodes.append(node)
|
||||
|
||||
def _max_attempts(self):
|
||||
max_attempts = CONF.scheduler.scheduler_max_attempts
|
||||
if max_attempts < 1:
|
||||
@ -99,16 +87,6 @@ class FilterScheduler(driver.Scheduler):
|
||||
# re-scheduling is disabled.
|
||||
return
|
||||
|
||||
# retry is enabled, update attempt count:
|
||||
if retry:
|
||||
retry['num_attempts'] += 1
|
||||
else:
|
||||
retry = {
|
||||
'num_attempts': 1,
|
||||
'nodes': [] # list of Ironic nodes tried
|
||||
}
|
||||
filter_properties['retry'] = retry
|
||||
|
||||
instance_id = request_spec.get('instance_id')
|
||||
self._log_instance_error(instance_id, retry)
|
||||
|
||||
@ -187,7 +165,6 @@ class FilterScheduler(driver.Scheduler):
|
||||
|
||||
node = self._choose_top_node(weighed_nodes, request_spec)
|
||||
node.obj.consume_from_request(context)
|
||||
self._add_retry_node(filter_properties, node.obj.node_uuid)
|
||||
dest = dict(node_uuid=node.obj.node_uuid, ports=node.obj.ports)
|
||||
return dest
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user