summaryrefslogtreecommitdiff
path: root/ironic/tests/unit
diff options
context:
space:
mode:
authorBob Fournier <bfournie@redhat.com>2021-01-24 19:48:21 -0500
committerBob Fournier <bfournie@redhat.com>2021-02-02 12:29:39 +0000
commit7d74ea0eee8f935f5b6c8406e6997d4143fce01e (patch)
treecbcb8b3df4448db1996dc480b14927a765fcffcc /ironic/tests/unit
parent1e8e54041a64b72a1cc785eeb39c0bd9da9f678a (diff)
downloadironic-7d74ea0eee8f935f5b6c8406e6997d4143fce01e.tar.gz
For Supermicro BMCs set enable when changing boot device
When setting the boot settings on Supermicro BMCs, the BootSourceOverrideEnabled must be set to the desired value whenever the BootSourceOverrideTarget is set or it will revert to the default value (Once). This is different than what is currently implemented for other BMCs in which the BootSourceOverrideEnabled is not set if it matches the current setting. This change uses the vendor setting to determine if it's a Supermicro BMC. Story: 2008547 Task: 41652 Change-Id: I1b1a6baafd4cc4daa2fbdb82f69ded6253b1fcbf (cherry picked from commit 4a7d50ce56b88c82e95665ac6df44666d3e647ed)
Diffstat (limited to 'ironic/tests/unit')
-rw-r--r--ironic/tests/unit/drivers/modules/redfish/test_management.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/ironic/tests/unit/drivers/modules/redfish/test_management.py b/ironic/tests/unit/drivers/modules/redfish/test_management.py
index dc67e17d6..98f3b75f7 100644
--- a/ironic/tests/unit/drivers/modules/redfish/test_management.py
+++ b/ironic/tests/unit/drivers/modules/redfish/test_management.py
@@ -245,6 +245,36 @@ class RedfishManagementTestCase(db_base.DbTestCase):
sushy.BOOT_SOURCE_TARGET_PXE,
task.node.driver_internal_info['redfish_boot_device'])
+ @mock.patch.object(redfish_utils, 'get_system', autospec=True)
+ def test_set_boot_device_persistency_vendor(self, mock_get_system):
+ fake_system = mock_get_system.return_value
+ fake_system.boot.get.return_value = \
+ sushy.BOOT_SOURCE_ENABLED_CONTINUOUS
+
+ values = [
+ ('SuperMicro', sushy.BOOT_SOURCE_ENABLED_CONTINUOUS),
+ ('SomeVendor', None)
+ ]
+
+ for vendor, expected in values:
+ properties = self.node.properties
+ properties['vendor'] = vendor
+ self.node.properties = properties
+ self.node.save()
+ with task_manager.acquire(self.context, self.node.uuid,
+ 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)])
+
+ # Reset mocks
+ fake_system.set_system_boot_options.reset_mock()
+ mock_get_system.reset_mock()
+
def test_restore_boot_device(self):
fake_system = mock.Mock()
with task_manager.acquire(self.context, self.node.uuid,