Add set_boot_device hook in redfish
boot interface
Added `_set_boot_device()` method to `redfish` boot interface to let future fishy hardware types reusing standard `redfish` implementation modulo setting boot device procedure. With Redfish, it seems, setting node to boot from Cd implies booting from either virtual or physical CD depending on media presence in either of the devices. Change-Id: I576b90be46f9cadf1a051e17c95a98aefc83fe1f
This commit is contained in:
parent
9fab96fc37
commit
b73420ec53
@ -613,7 +613,7 @@ class RedfishVirtualMediaBoot(base.BootInterface):
|
||||
|
||||
boot_mode_utils.sync_boot_mode(task)
|
||||
|
||||
manager_utils.node_set_boot_device(task, boot_devices.CDROM)
|
||||
self._set_boot_device(task, boot_devices.CDROM)
|
||||
|
||||
LOG.debug("Node %(node)s is set to one time boot from "
|
||||
"%(device)s", {'node': task.node.uuid,
|
||||
@ -672,7 +672,7 @@ class RedfishVirtualMediaBoot(base.BootInterface):
|
||||
self.clean_up_instance(task)
|
||||
iwdi = node.driver_internal_info.get('is_whole_disk_image')
|
||||
if boot_option == "local" or iwdi:
|
||||
manager_utils.node_set_boot_device(
|
||||
self._set_boot_device(
|
||||
task, boot_devices.DISK, persistent=True)
|
||||
|
||||
LOG.debug("Node %(node)s is set to permanently boot from local "
|
||||
@ -690,7 +690,7 @@ class RedfishVirtualMediaBoot(base.BootInterface):
|
||||
"The UUID of the root partition could not be found for "
|
||||
"node %s. Booting instance from disk anyway.", node.uuid)
|
||||
|
||||
manager_utils.node_set_boot_device(
|
||||
self._set_boot_device(
|
||||
task, boot_devices.DISK, persistent=True)
|
||||
|
||||
return
|
||||
@ -704,7 +704,7 @@ class RedfishVirtualMediaBoot(base.BootInterface):
|
||||
|
||||
boot_mode_utils.sync_boot_mode(task)
|
||||
|
||||
manager_utils.node_set_boot_device(
|
||||
self._set_boot_device(
|
||||
task, boot_devices.CDROM, persistent=True)
|
||||
|
||||
LOG.debug("Node %(node)s is set to permanently boot from "
|
||||
@ -816,3 +816,20 @@ class RedfishVirtualMediaBoot(base.BootInterface):
|
||||
for v_media in manager.virtual_media.get_members():
|
||||
if boot_device in v_media.media_types:
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _set_boot_device(cls, task, device, persistent=False):
|
||||
"""Set the boot device for a node.
|
||||
|
||||
This is a hook to allow other boot interfaces, inheriting from standard
|
||||
`redfish` boot interface, implement their own weird ways of setting
|
||||
boot device.
|
||||
|
||||
:param task: a TaskManager instance.
|
||||
:param device: Boot device. Values are vendor-specific.
|
||||
:param persistent: Whether to set next-boot, or make the change
|
||||
permanent. Default: False.
|
||||
:raises: InvalidParameterValue if the validation of the
|
||||
ManagementInterface fails.
|
||||
"""
|
||||
manager_utils.node_set_boot_device(task, device, persistent)
|
||||
|
@ -432,7 +432,7 @@ class RedfishVirtualMediaBootTestCase(db_base.DbTestCase):
|
||||
task, expected_params, 'deploy')
|
||||
|
||||
mock_manager_utils.node_set_boot_device.assert_called_once_with(
|
||||
task, boot_devices.CDROM)
|
||||
task, boot_devices.CDROM, False)
|
||||
|
||||
mock_boot_mode_utils.sync_boot_mode.assert_called_once_with(task)
|
||||
|
||||
@ -501,7 +501,7 @@ class RedfishVirtualMediaBootTestCase(db_base.DbTestCase):
|
||||
task, expected_params, 'deploy')
|
||||
|
||||
mock_manager_utils.node_set_boot_device.assert_called_once_with(
|
||||
task, boot_devices.CDROM)
|
||||
task, boot_devices.CDROM, False)
|
||||
|
||||
mock_boot_mode_utils.sync_boot_mode.assert_called_once_with(task)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user