"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ironic/conductor/utils.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).

utils.py  (ironic-16.0.2):utils.py  (ironic-16.0.3)
skipping to change at line 390 skipping to change at line 390
def cleanup_cleanwait_timeout(task): def cleanup_cleanwait_timeout(task):
"""Cleanup a cleaning task after timeout. """Cleanup a cleaning task after timeout.
:param task: a TaskManager instance. :param task: a TaskManager instance.
""" """
last_error = (_("Timeout reached while cleaning the node. Please " last_error = (_("Timeout reached while cleaning the node. Please "
"check if the ramdisk responsible for the cleaning is " "check if the ramdisk responsible for the cleaning is "
"running on the node. Failed on step %(step)s.") % "running on the node. Failed on step %(step)s.") %
{'step': task.node.clean_step}) {'step': task.node.clean_step})
logmsg = ("Cleaning for node %(node)s failed. %(error)s" %
{'node': task.node.uuid, 'error': last_error})
# NOTE(rloo): this is called from the periodic task for cleanwait timeouts, # NOTE(rloo): this is called from the periodic task for cleanwait timeouts,
# via the task manager's process_event(). The node has already been moved # via the task manager's process_event(). The node has already been moved
# to CLEANFAIL, so the error handler doesn't need to set the fail state. # to CLEANFAIL, so the error handler doesn't need to set the fail state.
cleaning_error_handler(task, msg=last_error, set_fail_state=False) cleaning_error_handler(task, logmsg, errmsg=last_error,
set_fail_state=False)
def cleaning_error_handler(task, msg, tear_down_cleaning=True, def cleaning_error_handler(task, logmsg, errmsg=None, traceback=False,
set_fail_state=True): tear_down_cleaning=True, set_fail_state=True,
"""Put a failed node in CLEANFAIL and maintenance.""" set_maintenance=None):
"""Put a failed node in CLEANFAIL and maintenance (if needed).
:param task: a TaskManager instance.
:param logmsg: Message to be logged.
:param errmsg: Message for the user. Optional, if not provided `logmsg` is
used.
:param traceback: Whether to log a traceback. Defaults to False.
:param tear_down_cleaning: Whether to clean up the PXE and DHCP files after
cleaning. Default to True.
:param set_fail_state: Whether to set node to failed state. Default to
True.
:param set_maintenance: Whether to set maintenance mode. If None,
maintenance mode will be set if and only if a clean step is being
executed on a node.
"""
if set_maintenance is None:
set_maintenance = bool(task.node.clean_step)
errmsg = errmsg or logmsg
LOG.error(logmsg, exc_info=traceback)
node = task.node node = task.node
node.fault = faults.CLEAN_FAILURE if set_maintenance:
node.maintenance = True node.fault = faults.CLEAN_FAILURE
node.maintenance = True
if tear_down_cleaning: if tear_down_cleaning:
try: try:
task.driver.deploy.tear_down_cleaning(task) task.driver.deploy.tear_down_cleaning(task)
except Exception as e: except Exception as e:
msg2 = ('Failed to tear down cleaning on node %(uuid)s, ' msg2 = ('Failed to tear down cleaning on node %(uuid)s, '
'reason: %(err)s' % {'err': e, 'uuid': node.uuid}) 'reason: %(err)s' % {'err': e, 'uuid': node.uuid})
LOG.exception(msg2) LOG.exception(msg2)
msg = _('%s. Also failed to tear down cleaning.') % msg errmsg = _('%s. Also failed to tear down cleaning.') % errmsg
else:
LOG.error(msg)
if node.provision_state in ( if node.provision_state in (
states.CLEANING, states.CLEANING,
states.CLEANWAIT, states.CLEANWAIT,
states.CLEANFAIL): states.CLEANFAIL):
# Clear clean step, msg should already include current step # Clear clean step, msg should already include current step
node.clean_step = {} node.clean_step = {}
info = node.driver_internal_info info = node.driver_internal_info
# Clear any leftover metadata about cleaning # Clear any leftover metadata about cleaning
info.pop('clean_step_index', None) info.pop('clean_step_index', None)
info.pop('cleaning_reboot', None) info.pop('cleaning_reboot', None)
info.pop('cleaning_polling', None) info.pop('cleaning_polling', None)
info.pop('skip_current_clean_step', None) info.pop('skip_current_clean_step', None)
# We don't need to keep the old agent URL # We don't need to keep the old agent URL
# as it should change upon the next cleaning attempt. # as it should change upon the next cleaning attempt.
info.pop('agent_url', None) info.pop('agent_url', None)
node.driver_internal_info = info node.driver_internal_info = info
# For manual cleaning, the target provision state is MANAGEABLE, whereas # For manual cleaning, the target provision state is MANAGEABLE, whereas
# for automated cleaning, it is AVAILABLE. # for automated cleaning, it is AVAILABLE.
manual_clean = node.target_provision_state == states.MANAGEABLE manual_clean = node.target_provision_state == states.MANAGEABLE
node.last_error = msg node.last_error = errmsg
# NOTE(dtantsur): avoid overwriting existing maintenance_reason # NOTE(dtantsur): avoid overwriting existing maintenance_reason
if not node.maintenance_reason: if not node.maintenance_reason and set_maintenance:
node.maintenance_reason = msg node.maintenance_reason = errmsg
node.save() node.save()
if set_fail_state and node.provision_state != states.CLEANFAIL: if set_fail_state and node.provision_state != states.CLEANFAIL:
target_state = states.MANAGEABLE if manual_clean else None target_state = states.MANAGEABLE if manual_clean else None
task.process_event('fail', target_state=target_state) task.process_event('fail', target_state=target_state)
def wipe_internal_info_on_power_off(node): def wipe_internal_info_on_power_off(node):
"""Wipe information that should not survive reboot/power off.""" """Wipe information that should not survive reboot/power off."""
driver_internal_info = node.driver_internal_info driver_internal_info = node.driver_internal_info
# DHCP may result in a new IP next time. # DHCP may result in a new IP next time.
 End of changes. 7 change blocks. 
12 lines changed or deleted 34 lines changed or added

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