summaryrefslogtreecommitdiff
path: root/ironic/conductor/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'ironic/conductor/utils.py')
-rw-r--r--ironic/conductor/utils.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/ironic/conductor/utils.py b/ironic/conductor/utils.py
index 643bc4d10..b43de8e55 100644
--- a/ironic/conductor/utils.py
+++ b/ironic/conductor/utils.py
@@ -302,9 +302,11 @@ def node_power_action(task, new_state, timeout=None):
# Set the target_power_state and clear any last_error, if we're
# starting a new operation. This will expose to other processes
- # and clients that work is in progress.
- node['target_power_state'] = target_state
- node['last_error'] = None
+ # and clients that work is in progress. Keep the last_error intact
+ # if the power action happens as a result of a failure.
+ node.target_power_state = target_state
+ if node.provision_state not in states.FAILURE_STATES:
+ node.last_error = None
node.timestamp_driver_internal_info('last_power_state_change')
# NOTE(dtantsur): wipe token on shutting down, otherwise a reboot in
# fast-track (or an accidentally booted agent) will cause subsequent