summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/oneview/management.py
diff options
context:
space:
mode:
Diffstat (limited to 'ironic/drivers/modules/oneview/management.py')
-rw-r--r--ironic/drivers/modules/oneview/management.py32
1 files changed, 4 insertions, 28 deletions
diff --git a/ironic/drivers/modules/oneview/management.py b/ironic/drivers/modules/oneview/management.py
index 5984b906a..b7b18c8ca 100644
--- a/ironic/drivers/modules/oneview/management.py
+++ b/ironic/drivers/modules/oneview/management.py
@@ -49,10 +49,6 @@ BOOT_DEVICE_MAP_ILO = {
BOOT_DEVICE_MAP_ILO_REV = {
v: k for k, v in BOOT_DEVICE_MAP_ILO.items()}
-ILO_SYSTEM_PATH = "/rest/v1/Systems/1"
-
-ILO_REQUEST_HEADERS = {"Content-Type": "application/json"}
-
def set_onetime_boot(task):
"""Set onetime boot to server hardware.
@@ -73,35 +69,15 @@ def set_onetime_boot(task):
server_hardware = task.node.driver_info.get('server_hardware_uri')
ilo_client = common.get_ilorest_client(client, server_hardware)
boot_device = BOOT_DEVICE_MAP_ILO.get(boot_device)
+ path = '/rest/v1/Systems/1'
body = {
"Boot": {
"BootSourceOverrideTarget": boot_device,
"BootSourceOverrideEnabled": "Once"
}
}
- ilo_client.patch(path=ILO_SYSTEM_PATH, body=body,
- headers=ILO_REQUEST_HEADERS)
-
-
-def _is_onetime_boot(task):
- """Check onetime boot from server hardware.
-
- Check if the onetime boot option of an OneView server hardware
- is set to 'Once' in iLO.
-
- :param task: a task from TaskManager.
- :returns: Boolean value. True if onetime boot is 'Once'
- False otherwise.
-
- """
- client = common.get_hponeview_client()
- server_hardware = task.node.driver_info.get('server_hardware_uri')
- ilo_client = common.get_ilorest_client(client, server_hardware)
- response = ilo_client.get(path=ILO_SYSTEM_PATH,
- headers=ILO_REQUEST_HEADERS)
- boot = response.dict.get('Boot')
- onetime_boot = boot.get('BootSourceOverrideEnabled')
- return onetime_boot == 'Once'
+ headers = {"Content-Type": "application/json"}
+ ilo_client.patch(path=path, body=body, headers=headers)
def set_boot_device(task):
@@ -293,7 +269,7 @@ class OneViewManagement(base.ManagementInterface):
boot_device = {
'boot_device': BOOT_DEVICE_MAP_ONEVIEW_REV.get(primary_device),
- 'persistent': not _is_onetime_boot(task)
+ 'persistent': True,
}
return boot_device