Onetime boot when set_boot_device isn't persistent

Due to a lack of feature of OneView, python-oneviewclient always set the boot
device persistently. Now that one-time boot is implemented, we must use it
to save some time deploying instances with *_oneview drivers.

Change-Id: I01e6f2917d3077d0dddc298e0810574a5450fe09
Depends-On: I1163048b6edf8778c3a84414804b73eef2c0fd5f
Co-Authored-By: Hugo Nicodemos <nicodemos@lsd.ufcg.edu.br>
This commit is contained in:
Thiago Paiva 2016-07-11 19:18:46 -03:00 committed by Hugo Nicodemos
parent 55f23aa26c
commit 1018fd5926
3 changed files with 24 additions and 2 deletions

View File

@ -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")

View File

@ -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):

View File

@ -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.