summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/redfish/management.py
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2020-03-03 23:34:10 +0100
committerJulia Kreger <juliaashleykreger@gmail.com>2020-04-06 22:45:18 +0000
commitaad54c245b195f15b19bbc34a0ca22ea0a3422d4 (patch)
tree6ed1cd13cb57f1ee5b2053a03f06c55c070ecd71 /ironic/drivers/modules/redfish/management.py
parent5be4c4f5c505f4c44028f06ff3d92f791b96aa4c (diff)
downloadironic-aad54c245b195f15b19bbc34a0ca22ea0a3422d4.tar.gz
Improve `redfish` set-boot-device behaviour
Makes management interface of `redfish` hardware type not changing current boot frequency if currently set one is the same as the desired one. The goal is to avoid touching potentially faulty BMC option whenever possible. This should hopefully improve interoperability with Redfish BMCs. Depends-On: https://review.opendev.org/710751 Change-Id: I380cd3aae410e05a4519c3764140ced121bf7fe7 Story: 2007355 Task: 38937
Diffstat (limited to 'ironic/drivers/modules/redfish/management.py')
-rw-r--r--ironic/drivers/modules/redfish/management.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/ironic/drivers/modules/redfish/management.py b/ironic/drivers/modules/redfish/management.py
index 3db4b7de2..4026da48c 100644
--- a/ironic/drivers/modules/redfish/management.py
+++ b/ironic/drivers/modules/redfish/management.py
@@ -126,10 +126,17 @@ class RedfishManagement(base.ManagementInterface):
"""
system = redfish_utils.get_system(task.node)
+ desired_persistence = BOOT_DEVICE_PERSISTENT_MAP_REV[persistent]
+ current_persistence = system.boot.get('enabled')
+
+ # NOTE(etingof): this can be racy, esp if BMC is not RESTful
+ enabled = (desired_persistence
+ if desired_persistence != current_persistence else None)
+
try:
system.set_system_boot_options(
- BOOT_DEVICE_MAP_REV[device],
- enabled=BOOT_DEVICE_PERSISTENT_MAP_REV[persistent])
+ BOOT_DEVICE_MAP_REV[device], enabled=enabled)
+
except sushy.exceptions.SushyError as e:
error_msg = (_('Redfish set boot device failed for node '
'%(node)s. Error: %(error)s') %