"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ironic/conductor/cleaning.py" between
ironic-16.0.2.tar.gz and ironic-16.0.3.tar.gz

About: OpenStack Ironic (Optional Service: Bare-Metal Provisioning) aims to provision bare metal machines instead of virtual machines, forked from the Nova baremetal driver.
The "Victoria" series (latest release).

cleaning.py  (ironic-16.0.2):cleaning.py  (ironic-16.0.3)
skipping to change at line 100 skipping to change at line 100
% {'node': node.uuid}) % {'node': node.uuid})
LOG.exception(msg) LOG.exception(msg)
# Allow the deploy driver to set up the ramdisk again (necessary for # Allow the deploy driver to set up the ramdisk again (necessary for
# IPA cleaning) # IPA cleaning)
try: try:
prepare_result = task.driver.deploy.prepare_cleaning(task) prepare_result = task.driver.deploy.prepare_cleaning(task)
except Exception as e: except Exception as e:
msg = (_('Failed to prepare node %(node)s for cleaning: %(e)s') msg = (_('Failed to prepare node %(node)s for cleaning: %(e)s')
% {'node': node.uuid, 'e': e}) % {'node': node.uuid, 'e': e})
LOG.exception(msg) return utils.cleaning_error_handler(task, msg, traceback=True)
return utils.cleaning_error_handler(task, msg)
if prepare_result == states.CLEANWAIT: if prepare_result == states.CLEANWAIT:
# Prepare is asynchronous, the deploy driver will need to # Prepare is asynchronous, the deploy driver will need to
# set node.driver_internal_info['clean_steps'] and # set node.driver_internal_info['clean_steps'] and
# node.clean_step and then make an RPC call to # node.clean_step and then make an RPC call to
# continue_node_clean to start cleaning. # continue_node_clean to start cleaning.
# For manual cleaning, the target provision state is MANAGEABLE, # For manual cleaning, the target provision state is MANAGEABLE,
# whereas for automated cleaning, it is AVAILABLE (the default). # whereas for automated cleaning, it is AVAILABLE (the default).
target_state = states.MANAGEABLE if manual_clean else None target_state = states.MANAGEABLE if manual_clean else None
skipping to change at line 143 skipping to change at line 142
:param task: a TaskManager instance with an exclusive lock :param task: a TaskManager instance with an exclusive lock
:param step_index: The first clean step in the list to execute. This :param step_index: The first clean step in the list to execute. This
is the index (from 0) into the list of clean steps in the node's is the index (from 0) into the list of clean steps in the node's
driver_internal_info['clean_steps']. Is None if there are no steps driver_internal_info['clean_steps']. Is None if there are no steps
to execute. to execute.
""" """
node = task.node node = task.node
# For manual cleaning, the target provision state is MANAGEABLE, # For manual cleaning, the target provision state is MANAGEABLE,
# whereas for automated cleaning, it is AVAILABLE. # whereas for automated cleaning, it is AVAILABLE.
manual_clean = node.target_provision_state == states.MANAGEABLE manual_clean = node.target_provision_state == states.MANAGEABLE
if step_index is None: if step_index is None:
steps = [] steps = []
else: else:
steps = node.driver_internal_info['clean_steps'][step_index:] steps = node.driver_internal_info['clean_steps'][step_index:]
LOG.info('Executing %(state)s on node %(node)s, remaining steps: ' LOG.info('Executing %(state)s on node %(node)s, remaining steps: '
'%(steps)s', {'node': node.uuid, 'steps': steps, '%(steps)s', {'node': node.uuid, 'steps': steps,
'state': node.provision_state}) 'state': node.provision_state})
# Execute each step until we hit an async step or run out of steps # Execute each step until we hit an async step or run out of steps
skipping to change at line 185 skipping to change at line 183
node.driver_internal_info = driver_internal_info node.driver_internal_info = driver_internal_info
target_state = (states.MANAGEABLE if manual_clean target_state = (states.MANAGEABLE if manual_clean
else None) else None)
task.process_event('wait', target_state=target_state) task.process_event('wait', target_state=target_state)
return return
msg = (_('Node %(node)s failed step %(step)s: ' msg = (_('Node %(node)s failed step %(step)s: '
'%(exc)s') % '%(exc)s') %
{'node': node.uuid, 'exc': e, {'node': node.uuid, 'exc': e,
'step': node.clean_step}) 'step': node.clean_step})
LOG.exception(msg)
driver_utils.collect_ramdisk_logs(task.node, label='cleaning') driver_utils.collect_ramdisk_logs(task.node, label='cleaning')
utils.cleaning_error_handler(task, msg) utils.cleaning_error_handler(task, msg, traceback=True)
return return
# Check if the step is done or not. The step should return # Check if the step is done or not. The step should return
# states.CLEANWAIT if the step is still being executed, or # states.CLEANWAIT if the step is still being executed, or
# None if the step is done. # None if the step is done.
if result == states.CLEANWAIT: if result == states.CLEANWAIT:
# Kill this worker, the async step will make an RPC call to # Kill this worker, the async step will make an RPC call to
# continue_node_clean to continue cleaning # continue_node_clean to continue cleaning
LOG.info('Clean step %(step)s on node %(node)s being ' LOG.info('Clean step %(step)s on node %(node)s being '
'executed asynchronously, waiting for driver.', 'executed asynchronously, waiting for driver.',
{'node': node.uuid, 'step': step}) {'node': node.uuid, 'step': step})
target_state = states.MANAGEABLE if manual_clean else None target_state = states.MANAGEABLE if manual_clean else None
task.process_event('wait', target_state=target_state) task.process_event('wait', target_state=target_state)
return return
elif result is not None: elif result is not None:
msg = (_('While executing step %(step)s on node ' msg = (_('While executing step %(step)s on node '
'%(node)s, step returned invalid value: %(val)s') '%(node)s, step returned invalid value: %(val)s')
% {'step': step, 'node': node.uuid, 'val': result}) % {'step': step, 'node': node.uuid, 'val': result})
LOG.error(msg)
return utils.cleaning_error_handler(task, msg) return utils.cleaning_error_handler(task, msg)
LOG.info('Node %(node)s finished clean step %(step)s', LOG.info('Node %(node)s finished clean step %(step)s',
{'node': node.uuid, 'step': step}) {'node': node.uuid, 'step': step})
if CONF.agent.deploy_logs_collect == 'always': if CONF.agent.deploy_logs_collect == 'always':
driver_utils.collect_ramdisk_logs(task.node, label='cleaning') driver_utils.collect_ramdisk_logs(task.node, label='cleaning')
# Clear clean_step # Clear clean_step
node.clean_step = None node.clean_step = None
utils.wipe_cleaning_internal_info(task) utils.wipe_cleaning_internal_info(task)
node.save() node.save()
try: try:
task.driver.deploy.tear_down_cleaning(task) task.driver.deploy.tear_down_cleaning(task)
except Exception as e: except Exception as e:
msg = (_('Failed to tear down from cleaning for node %(node)s, ' msg = (_('Failed to tear down from cleaning for node %(node)s, '
'reason: %(err)s') 'reason: %(err)s')
% {'node': node.uuid, 'err': e}) % {'node': node.uuid, 'err': e})
LOG.exception(msg)
return utils.cleaning_error_handler(task, msg, return utils.cleaning_error_handler(task, msg,
traceback=True,
tear_down_cleaning=False) tear_down_cleaning=False)
LOG.info('Node %s cleaning complete', node.uuid) LOG.info('Node %s cleaning complete', node.uuid)
event = 'manage' if manual_clean or node.retired else 'done' event = 'manage' if manual_clean or node.retired else 'done'
# NOTE(rloo): No need to specify target prov. state; we're done # NOTE(rloo): No need to specify target prov. state; we're done
task.process_event(event) task.process_event(event)
@task_manager.require_exclusive_lock @task_manager.require_exclusive_lock
def do_node_clean_abort(task, step_name=None): def do_node_clean_abort(task, step_name=None):
"""Internal method to abort an ongoing operation. """Internal method to abort an ongoing operation.
:param task: a TaskManager instance with an exclusive lock :param task: a TaskManager instance with an exclusive lock
:param step_name: The name of the clean step. :param step_name: The name of the clean step.
""" """
node = task.node node = task.node
try: try:
task.driver.deploy.tear_down_cleaning(task) task.driver.deploy.tear_down_cleaning(task)
except Exception as e: except Exception as e:
LOG.exception('Failed to tear down cleaning for node %(node)s ' log_msg = (_('Failed to tear down cleaning for node %(node)s '
'after aborting the operation. Error: %(err)s', 'after aborting the operation. Error: %(err)s') %
{'node': node.uuid, 'err': e}) {'node': node.uuid, 'err': e})
error_msg = _('Failed to tear down cleaning after aborting ' error_msg = _('Failed to tear down cleaning after aborting '
'the operation') 'the operation')
utils.cleaning_error_handler(task, error_msg, utils.cleaning_error_handler(task, log_msg,
errmsg=error_msg,
traceback=True,
tear_down_cleaning=False, tear_down_cleaning=False,
set_fail_state=False) set_fail_state=False)
return return
info_message = _('Clean operation aborted for node %s') % node.uuid info_message = _('Clean operation aborted for node %s') % node.uuid
last_error = _('By request, the clean operation was aborted') last_error = _('By request, the clean operation was aborted')
if step_name: if step_name:
msg = _(' after the completion of step "%s"') % step_name msg = _(' after the completion of step "%s"') % step_name
last_error += msg last_error += msg
info_message += msg info_message += msg
 End of changes. 9 change blocks. 
11 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)