Beispiel #1
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)
Beispiel #2
0
    def test_update_boot_mode_capability_legacy(self, get_ilo_object_mock,
                                                add_node_capability_mock):
        ilo_mock_obj = get_ilo_object_mock.return_value
        exc = ilo_error.IloCommandNotSupportedError('error')
        ilo_mock_obj.get_pending_boot_mode.side_effect = exc

        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            ilo_common.update_boot_mode_capability(task)
            get_ilo_object_mock.assert_called_once_with(task.node)
            ilo_mock_obj.get_pending_boot_mode.assert_called_once_with()
            add_node_capability_mock.assert_called_once_with(
                task, 'boot_mode', 'bios')
Beispiel #3
0
    def test_update_boot_mode_capability_unknown(self, get_ilo_object_mock,
                                                 add_node_capability_mock):
        ilo_mock_obj = get_ilo_object_mock.return_value
        ilo_mock_obj.get_pending_boot_mode.return_value = 'UNKNOWN'
        set_pending_boot_mode_mock = ilo_mock_obj.set_pending_boot_mode

        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            ilo_common.update_boot_mode_capability(task)
            get_ilo_object_mock.assert_called_once_with(task.node)
            ilo_mock_obj.get_pending_boot_mode.assert_called_once_with()
            set_pending_boot_mode_mock.assert_called_once_with('UEFI')
            add_node_capability_mock.assert_called_once_with(
                task, 'boot_mode', 'uefi')
Beispiel #4
0
    def test_update_boot_mode_capability(self, get_ilo_object_mock,
                                         add_node_capability_mock,
                                         rm_node_capability_mock):
        ilo_mock_obj = get_ilo_object_mock.return_value
        ilo_mock_obj.get_pending_boot_mode.return_value = 'legacy'

        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            ilo_common.update_boot_mode_capability(task)
            get_ilo_object_mock.assert_called_once_with(task.node)
            ilo_mock_obj.get_pending_boot_mode.assert_called_once_with()
            rm_node_capability_mock.assert_called_once_with(task, 'boot_mode')
            add_node_capability_mock.assert_called_once_with(
                task, 'boot_mode', 'bios')
    def test_update_boot_mode_capability_legacy(self, ilo_client_mock,
                                                get_ilo_object_mock,
                                                add_node_capability_mock):
        ilo_client_mock.IloCommandNotSupportedError = Exception
        ilo_mock_obj = get_ilo_object_mock.return_value
        ilo_mock_obj.get_pending_boot_mode.side_effect = Exception

        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            ilo_common.update_boot_mode_capability(task)
            get_ilo_object_mock.assert_called_once_with(task.node)
            ilo_mock_obj.get_pending_boot_mode.assert_called_once_with()
            add_node_capability_mock.assert_called_once_with(task,
                                                             'boot_mode',
                                                             'bios')
Beispiel #6
0
    def test_update_boot_mode_capability(self, get_ilo_object_mock,
                                         add_node_capability_mock,
                                         rm_node_capability_mock):
        ilo_mock_obj = get_ilo_object_mock.return_value
        ilo_mock_obj.get_pending_boot_mode.return_value = 'legacy'

        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            ilo_common.update_boot_mode_capability(task)
            get_ilo_object_mock.assert_called_once_with(task.node)
            ilo_mock_obj.get_pending_boot_mode.assert_called_once_with()
            rm_node_capability_mock.assert_called_once_with(task, 'boot_mode')
            add_node_capability_mock.assert_called_once_with(task,
                                                             'boot_mode',
                                                             'bios')
Beispiel #7
0
    def test_update_boot_mode_capability_unknown(self,
                                                 get_ilo_object_mock,
                                                 add_node_capability_mock):
        ilo_mock_obj = get_ilo_object_mock.return_value
        ilo_mock_obj.get_pending_boot_mode.return_value = 'UNKNOWN'
        set_pending_boot_mode_mock = ilo_mock_obj.set_pending_boot_mode

        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            ilo_common.update_boot_mode_capability(task)
            get_ilo_object_mock.assert_called_once_with(task.node)
            ilo_mock_obj.get_pending_boot_mode.assert_called_once_with()
            set_pending_boot_mode_mock.assert_called_once_with('UEFI')
            add_node_capability_mock.assert_called_once_with(task,
                                                             'boot_mode',
                                                             'uefi')
Beispiel #8
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)