def _disable_secure_boot(task): """Disables secure boot on node, if secure boot is enabled on node. This method checks if secure boot is enabled on node. If enabled, it disables same and returns True. :param task: a TaskManager instance containing the node to act on. :returns: It returns True, if secure boot was successfully disabled on the node. It returns False, if secure boot on node is in disabled state or if secure boot feature is not supported by the node. :raises: IloOperationError, if some operation on iLO failed. """ cur_sec_state = False try: cur_sec_state = ilo_common.get_secure_boot_mode(task) except exception.IloOperationNotSupported: LOG.debug('Secure boot mode is not supported for node %s', task.node.uuid) return False if cur_sec_state: LOG.debug('Disabling secure boot for node %s', task.node.uuid) ilo_common.set_secure_boot_mode(task, False) return True return False
def test_set_secure_boot_mode(self, get_ilo_object_mock): ilo_object_mock = get_ilo_object_mock.return_value with task_manager.acquire(self.context, self.node.uuid, shared=False) as task: ilo_common.set_secure_boot_mode(task, True) ilo_object_mock.set_secure_boot_mode.assert_called_once_with(True)
def set_secure_boot_state(self, task, state): """Set the current secure boot state for the node. :param task: A task from TaskManager. :param state: A new state as a boolean. :raises: MissingParameterValue if a required parameter is missing :raises: IloOperationError on an error from IloClient library. :raises: UnsupportedDriverExtension if secure boot is not supported by the hardware """ try: ilo_common.set_secure_boot_mode(task, state) except ilo_error.IloOperationNotSupported: raise exception.UnsupportedDriverExtension( driver=task.node.driver, extension='set_secure_boot_state')
def _update_secure_boot_mode(task, mode): """Changes secure boot mode for next boot on the node. This method changes secure boot mode on the node for next boot. It changes the secure boot mode setting on node only if the deploy has requested for the secure boot. During deploy, this method is used to enable secure boot on the node by passing 'mode' as 'True'. During teardown, this method is used to disable secure boot on the node by passing 'mode' as 'False'. :param task: a TaskManager instance containing the node to act on. :param mode: Boolean value requesting the next state for secure boot :raises: IloOperationNotSupported, if operation is not supported on iLO :raises: IloOperationError, if some operation on iLO failed. """ if deploy_utils.is_secure_boot_requested(task.node): ilo_common.set_secure_boot_mode(task, mode) LOG.info(_LI("Changed secure boot to %(mode)s for node %(node)s"), {"mode": mode, "node": task.node.uuid})
def _update_secure_boot_mode(task, mode): """Changes secure boot mode for next boot on the node. This method changes secure boot mode on the node for next boot. It changes the secure boot mode setting on node only if the deploy has requested for the secure boot. During deploy, this method is used to enable secure boot on the node by passing 'mode' as 'True'. During teardown, this method is used to disable secure boot on the node by passing 'mode' as 'False'. :param task: a TaskManager instance containing the node to act on. :param mode: Boolean value requesting the next state for secure boot :raises: IloOperationNotSupported, if operation is not supported on iLO :raises: IloOperationError, if some operation on iLO failed. """ if deploy_utils.is_secure_boot_requested(task.node): ilo_common.set_secure_boot_mode(task, mode) LOG.info(_LI('Changed secure boot to %(mode)s for node %(node)s'), { 'mode': mode, 'node': task.node.uuid })