diff --git a/ironic/drivers/modules/oneview/management.py b/ironic/drivers/modules/oneview/management.py index bedcaada49a..21aebadb49d 100644 --- a/ironic/drivers/modules/oneview/management.py +++ b/ironic/drivers/modules/oneview/management.py @@ -126,7 +126,8 @@ class OneViewManagement(base.ManagementInterface): try: device_to_oneview = BOOT_DEVICE_MAPPING_TO_OV.get(device) self.oneview_client.set_boot_device(oneview_info, - device_to_oneview) + device_to_oneview, + onetime=not persistent) except oneview_exceptions.OneViewException as oneview_exc: msg = (_( "Error setting boot device on OneView. Error: %s") diff --git a/ironic/tests/unit/drivers/modules/oneview/test_management.py b/ironic/tests/unit/drivers/modules/oneview/test_management.py index 8962a00034f..6d9f87e23e7 100644 --- a/ironic/tests/unit/drivers/modules/oneview/test_management.py +++ b/ironic/tests/unit/drivers/modules/oneview/test_management.py @@ -134,7 +134,21 @@ class OneViewManagementDriverTestCase(db_base.DbTestCase): self.driver.management.set_boot_device(task, boot_devices.PXE) oneview_client.set_boot_device.assert_called_once_with( self.info, - management.BOOT_DEVICE_MAPPING_TO_OV[boot_devices.PXE] + management.BOOT_DEVICE_MAPPING_TO_OV[boot_devices.PXE], + onetime=True + ) + + def test_set_boot_device_persistent(self, mock_get_ov_client): + oneview_client = mock_get_ov_client() + self.driver.management.oneview_client = oneview_client + + with task_manager.acquire(self.context, self.node.uuid) as task: + self.driver.management.set_boot_device(task, boot_devices.PXE, + persistent=True) + oneview_client.set_boot_device.assert_called_once_with( + self.info, + management.BOOT_DEVICE_MAPPING_TO_OV[boot_devices.PXE], + onetime=False ) def test_set_boot_device_invalid_device(self, mock_get_ov_client): diff --git a/releasenotes/notes/oneview-onetime-boot-64a68e135a45f5e2.yaml b/releasenotes/notes/oneview-onetime-boot-64a68e135a45f5e2.yaml new file mode 100644 index 00000000000..b9665fc0a6f --- /dev/null +++ b/releasenotes/notes/oneview-onetime-boot-64a68e135a45f5e2.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - Previously (python-oneviewclient < 2.4.0), due to limitations of + python-oneviewclient, boot device was always set persistenly with + OneView drivers. Now that one-time boot is implemented in python-oneviewclient, + changing the oneview driver to exhibit the expected behavior when + set_boot_device is called with persistent=False.