summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-04-20 15:19:40 +0000
committerGerrit Code Review <review@openstack.org>2021-04-20 15:19:40 +0000
commit5cbf14fee0dc17f61106e024f7d9574e528a7383 (patch)
treee80cf446cbca07bb0af2b396fc9fe2e190029872
parent7590c6858248425852b6ad49b3a05504fba0f370 (diff)
parent99c5d6e9a3038c138633c3052f724aecab8b616b (diff)
downloadironic-5cbf14fee0dc17f61106e024f7d9574e528a7383.tar.gz
Merge "Restrict syncing of boot mode to Supermicro" into stable/train
-rw-r--r--ironic/drivers/modules/redfish/management.py7
-rw-r--r--ironic/tests/unit/drivers/modules/redfish/test_management.py25
-rw-r--r--releasenotes/notes/restrict-sync-mode-after-device-to-supermicro-218e8cb57735c685.yaml11
3 files changed, 30 insertions, 13 deletions
diff --git a/ironic/drivers/modules/redfish/management.py b/ironic/drivers/modules/redfish/management.py
index 0d2d19956..8cdb146b6 100644
--- a/ironic/drivers/modules/redfish/management.py
+++ b/ironic/drivers/modules/redfish/management.py
@@ -232,7 +232,12 @@ class RedfishManagement(base.ManagementInterface):
# Ensure that boot mode is synced with what is set.
# Some BMCs reset it to default (BIOS) when changing the boot device.
- boot_mode_utils.sync_boot_mode(task)
+ # It should only be synced on these vendors as other vendor
+ # implementations will result in an error
+ # (see https://storyboard.openstack.org/#!/story/2008712)
+ vendor = task.node.properties.get('vendor', None)
+ if vendor and vendor.lower() == 'supermicro':
+ boot_mode_utils.sync_boot_mode(task)
def get_boot_device(self, task):
"""Get the current boot device for a node.
diff --git a/ironic/tests/unit/drivers/modules/redfish/test_management.py b/ironic/tests/unit/drivers/modules/redfish/test_management.py
index c167353d4..204f98df3 100644
--- a/ironic/tests/unit/drivers/modules/redfish/test_management.py
+++ b/ironic/tests/unit/drivers/modules/redfish/test_management.py
@@ -92,8 +92,7 @@ class RedfishManagementTestCase(db_base.DbTestCase):
# Asserts
fake_system.set_system_boot_options.assert_has_calls(
[mock.call(expected,
- enabled=sushy.BOOT_SOURCE_ENABLED_ONCE),
- mock.call(mode=sushy.BOOT_SOURCE_MODE_BIOS)])
+ enabled=sushy.BOOT_SOURCE_ENABLED_ONCE)])
mock_get_system.assert_called_with(task.node)
self.assertNotIn('redfish_boot_device',
task.node.driver_internal_info)
@@ -122,7 +121,7 @@ class RedfishManagementTestCase(db_base.DbTestCase):
fake_system.set_system_boot_source.assert_has_calls([
mock.call(expected,
enabled=sushy.BOOT_SOURCE_ENABLED_ONCE)])
- self.assertEqual(3, mock_get_system.call_count)
+ self.assertEqual(1, mock_get_system.call_count)
self.assertNotIn('redfish_boot_device',
task.node.driver_internal_info)
@@ -147,8 +146,7 @@ class RedfishManagementTestCase(db_base.DbTestCase):
fake_system.set_system_boot_options.assert_has_calls(
[mock.call(sushy.BOOT_SOURCE_TARGET_PXE,
- enabled=expected),
- mock.call(mode=sushy.BOOT_SOURCE_MODE_BIOS)])
+ enabled=expected)])
mock_get_system.assert_called_with(task.node)
self.assertNotIn('redfish_boot_device',
task.node.driver_internal_info)
@@ -175,8 +173,7 @@ class RedfishManagementTestCase(db_base.DbTestCase):
task, boot_devices.PXE, persistent=target)
fake_system.set_system_boot_options.assert_has_calls(
- [mock.call(sushy.BOOT_SOURCE_TARGET_PXE, enabled=None),
- mock.call(mode=sushy.BOOT_SOURCE_MODE_BIOS)])
+ [mock.call(sushy.BOOT_SOURCE_TARGET_PXE, enabled=None)])
mock_get_system.assert_called_with(task.node)
# Reset mocks
@@ -282,11 +279,15 @@ class RedfishManagementTestCase(db_base.DbTestCase):
shared=False) as task:
task.driver.management.set_boot_device(
task, boot_devices.PXE, persistent=True)
-
- fake_system.set_system_boot_options.assert_has_calls(
- [mock.call(sushy.BOOT_SOURCE_TARGET_PXE,
- enabled=expected),
- mock.call(mode=sushy.BOOT_SOURCE_MODE_BIOS)])
+ if vendor == 'SuperMicro':
+ fake_system.set_system_boot_options.assert_has_calls(
+ [mock.call(sushy.BOOT_SOURCE_TARGET_PXE,
+ enabled=expected),
+ mock.call(mode=sushy.BOOT_SOURCE_MODE_BIOS)])
+ else:
+ fake_system.set_system_boot_options.assert_has_calls(
+ [mock.call(sushy.BOOT_SOURCE_TARGET_PXE,
+ enabled=expected)])
# Reset mocks
fake_system.set_system_boot_options.reset_mock()
diff --git a/releasenotes/notes/restrict-sync-mode-after-device-to-supermicro-218e8cb57735c685.yaml b/releasenotes/notes/restrict-sync-mode-after-device-to-supermicro-218e8cb57735c685.yaml
new file mode 100644
index 000000000..0436b81e6
--- /dev/null
+++ b/releasenotes/notes/restrict-sync-mode-after-device-to-supermicro-218e8cb57735c685.yaml
@@ -0,0 +1,11 @@
+---
+fixes:
+ - |
+ The fix for story
+ `2008252 <https://storyboard.openstack.org/#!/story/2008252>`_ synced
+ the boot mode after changing the boot device because Supermicro nodes
+ reset the boot mode if not included in the boot device set. However this
+ can cause a problem on Dell nodes when changing the mode uefi->bios or
+ bios->uefi, see `story 2008712
+ <https://storyboard.openstack.org/#!/story/2008712>`_ for details.
+ Restrict the syncing of the boot mode to Supermicro.