Catch any exception for Cleaning

No exception is used to communicate back, the exceptions
are used to catch failures, and if we don't catch other
possible exceptions leaving cleaning states, we may not clean
up state properly.

So instead of specific exceptions, we just catch any exception
like is used earlier in the same method.

Inspired by https://review.opendev.org/c/openstack/ironic/+/866856
and investigation through the code base as a result of inability
to clean the node.

Change-Id: I2a6bca3550819b98adbaffe315f77427b8a43d62
This commit is contained in:
Julia Kreger 2022-12-07 11:56:32 -08:00
parent 4d66609e95
commit aca8ebc064
2 changed files with 11 additions and 2 deletions

View File

@ -114,8 +114,9 @@ def do_node_clean(task, clean_steps=None, disable_ramdisk=False):
try: try:
conductor_steps.set_node_cleaning_steps( conductor_steps.set_node_cleaning_steps(
task, disable_ramdisk=disable_ramdisk) task, disable_ramdisk=disable_ramdisk)
except (exception.InvalidParameterValue, except Exception as e:
exception.NodeCleaningFailure) as e: # Catch all exceptions and follow the error handling
# path so things are cleaned up properly.
msg = (_('Cannot clean node %(node)s: %(msg)s') msg = (_('Cannot clean node %(node)s: %(msg)s')
% {'node': node.uuid, 'msg': e}) % {'node': node.uuid, 'msg': e})
return utils.cleaning_error_handler(task, msg) return utils.cleaning_error_handler(task, msg)

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Fixes an issue where unexpected exceptions coming from the process to
start cleaning would not trigger the cleaning_error_handler which
performs the needful internal resets to permit cleaning to be retried
again in the future. Now any error which is encountered during the
launch of cleaning will trigger the error handler.