示例#1
0
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
示例#2
0
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
示例#3
0
 def test_get_secure_boot_mode_bios(self, get_ilo_object_mock):
     ilo_object_mock = get_ilo_object_mock.return_value
     ilo_object_mock.get_current_boot_mode.return_value = "BIOS"
     with task_manager.acquire(self.context, self.node.uuid, shared=False) as task:
         ret = ilo_common.get_secure_boot_mode(task)
         ilo_object_mock.get_current_boot_mode.assert_called_once_with()
         self.assertFalse(ilo_object_mock.get_secure_boot_mode.called)
         self.assertFalse(ret)
示例#4
0
 def test_get_secure_boot_mode_bios(self, get_ilo_object_mock):
     ilo_object_mock = get_ilo_object_mock.return_value
     ilo_object_mock.get_current_boot_mode.return_value = 'BIOS'
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=False) as task:
         ret = ilo_common.get_secure_boot_mode(task)
         ilo_object_mock.get_current_boot_mode.assert_called_once_with()
         self.assertFalse(ilo_object_mock.get_secure_boot_mode.called)
         self.assertFalse(ret)
示例#5
0
    def get_secure_boot_state(self, task):
        """Get the current secure boot state for the node.

        :param task: A task from TaskManager.
        :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
        :returns: Boolean
        """
        try:
            return ilo_common.get_secure_boot_mode(task)
        except ilo_error.IloOperationNotSupported:
            raise exception.UnsupportedDriverExtension(
                driver=task.node.driver, extension='get_secure_boot_state')