Esempio n. 1
0
 def test_set_boot_mode_without_set_pending_boot_mode(self, get_ilo_object_mock):
     ilo_object_mock = get_ilo_object_mock.return_value
     get_pending_boot_mode_mock = ilo_object_mock.get_pending_boot_mode
     get_pending_boot_mode_mock.return_value = "LEGACY"
     ilo_common.set_boot_mode(self.node, "bios")
     get_ilo_object_mock.assert_called_once_with(self.node)
     get_pending_boot_mode_mock.assert_called_once_with()
     self.assertFalse(ilo_object_mock.set_pending_boot_mode.called)
Esempio n. 2
0
 def test_set_boot_mode(self, get_ilo_object_mock):
     ilo_object_mock = get_ilo_object_mock.return_value
     get_pending_boot_mode_mock = ilo_object_mock.get_pending_boot_mode
     set_pending_boot_mode_mock = ilo_object_mock.set_pending_boot_mode
     get_pending_boot_mode_mock.return_value = 'LEGACY'
     ilo_common.set_boot_mode(self.node, 'uefi')
     get_ilo_object_mock.assert_called_once_with(self.node)
     get_pending_boot_mode_mock.assert_called_once_with()
     set_pending_boot_mode_mock.assert_called_once_with('UEFI')
Esempio n. 3
0
    def prepare(self, task):
        """Prepare the deployment environment for this task's node.

        :param task: a TaskManager instance containing the node to act on.
        :raises: IloOperationError, if some operation on iLO failed.
        """
        boot_mode = driver_utils.get_node_capability(task.node, 'boot_mode')
        if boot_mode is not None:
            ilo_common.set_boot_mode(task.node, boot_mode)
        else:
            ilo_common.update_boot_mode_capability(task)
Esempio n. 4
0
    def set_boot_mode(self, task, mode):
        """Set the boot mode for a node.

        Set the boot mode to use on next reboot of the node.

        :param task: A task from TaskManager.
        :param mode: The boot mode, one of
                     :mod:`ironic.common.boot_modes`.
        :raises: InvalidParameterValue if an invalid boot mode is
                 specified.
        :raises: IloOperationError if setting boot mode failed.
        """
        if mode not in self.get_supported_boot_modes(task):
            raise exception.InvalidParameterValue(
                _("The given boot mode '%s' is not supported.") % mode)
        ilo_common.set_boot_mode(task.node, mode)
Esempio n. 5
0
    def prepare(self, task):
        """Prepare the deployment environment for this task's node.

        If the node's 'capabilities' property includes a boot_mode, that
        boot mode will be applied for the node. Otherwise, the existing
        boot mode of the node is used in the node's 'capabilities' property.

        PXEDeploys' prepare method is then called, to prepare the deploy
        environment for the node

        :param task: a TaskManager instance containing the node to act on.
        """
        boot_mode = driver_utils.get_node_capability(task.node, 'boot_mode')
        if boot_mode is None:
            ilo_common.update_boot_mode_capability(task)
        else:
            ilo_common.set_boot_mode(task.node, boot_mode)
        super(IloPXEDeploy, self).prepare(task)