@task_manager.require_exclusive_lock
@common.node_has_server_profile
def set_boot_device(self, task, device, persistent=False):
    'Sets the boot device for a node.\n\n        Sets the boot device to use on next reboot of the node.\n\n        :param task: a task from TaskManager.\n        :param device: the boot device, one of the supported devices\n                       listed in :mod:`ironic.common.boot_devices`.\n        :param persistent: Boolean value. True if the boot device will\n                           persist to all future boots, False if not.\n                           Default: False.\n        :raises: InvalidParameterValue if an invalid boot device is\n                 specified.\n        :raises: OperationNotPermitted if the server has no server profile or\n                 if the server is already powered on.\n        :raises: OneViewError if the communication with OneView fails\n        '
    oneview_info = common.get_oneview_info(task.node)
    if (device not in self.get_supported_boot_devices(task)):
        raise exception.InvalidParameterValue((_('Invalid boot device %s specified.') % device))
    LOG.debug('Setting boot device to %(device)s for node %(node)s', {'device': device, 'node': task.node.uuid})
    try:
        oneview_client = common.get_oneview_client()
        device_to_oneview = BOOT_DEVICE_MAPPING_TO_OV.get(device)
        oneview_client.set_boot_device(oneview_info, device_to_oneview)
    except oneview_exceptions.OneViewException as oneview_exc:
        msg = (_('Error setting boot device on OneView. Error: %s') % oneview_exc)
        LOG.error(msg)
        raise exception.OneViewError(error=msg)
Sets the boot device for a node.

Sets the boot device to use on next reboot of the node.

:param task: a task from TaskManager.
:param device: the boot device, one of the supported devices
               listed in :mod:`ironic.common.boot_devices`.
:param persistent: Boolean value. True if the boot device will
                   persist to all future boots, False if not.
                   Default: False.
:raises: InvalidParameterValue if an invalid boot device is
         specified.
:raises: OperationNotPermitted if the server has no server profile or
         if the server is already powered on.
:raises: OneViewError if the communication with OneView fails
@task_manager.require_exclusive_lock
@common.node_has_server_profile
def set_boot_device(self, task, device, persistent=False):
    'Sets the boot device for a node.\n\n        Sets the boot device to use on next reboot of the node.\n\n        :param task: a task from TaskManager.\n        :param device: the boot device, one of the supported devices\n                       listed in :mod:`ironic.common.boot_devices`.\n        :param persistent: Boolean value. True if the boot device will\n                           persist to all future boots, False if not.\n                           Default: False.\n        :raises: InvalidParameterValue if an invalid boot device is\n                 specified.\n        :raises: OperationNotPermitted if the server has no server profile or\n                 if the server is already powered on.\n        :raises: OneViewError if the communication with OneView fails\n        '
    oneview_info = common.get_oneview_info(task.node)
    if (device not in self.get_supported_boot_devices(task)):
        raise exception.InvalidParameterValue((_('Invalid boot device %s specified.') % device))
    LOG.debug('Setting boot device to %(device)s for node %(node)s', {'device': device, 'node': task.node.uuid})
    try:
        oneview_client = common.get_oneview_client()
        device_to_oneview = BOOT_DEVICE_MAPPING_TO_OV.get(device)
        oneview_client.set_boot_device(oneview_info, device_to_oneview)
    except oneview_exceptions.OneViewException as oneview_exc:
        msg = (_('Error setting boot device on OneView. Error: %s') % oneview_exc)
        LOG.error(msg)
        raise exception.OneViewError(error=msg)