Beispiel #1
0
    def prepare_ramdisk(self, task, ramdisk_params):
        """Prepares the boot of Ironic ramdisk using PXE.

        This method prepares the boot of the deploy kernel/ramdisk after
        reading relevant information from the node's driver_info and
        instance_info.

        :param task: a task from TaskManager.
        :param ramdisk_params: the parameters to be passed to the ramdisk.
            pxe driver passes these parameters as kernel command-line
            arguments.
        :returns: None
        :raises: MissingParameterValue, if some information is missing in
            node's driver_info or instance_info.
        :raises: InvalidParameterValue, if some information provided is
            invalid.
        :raises: IronicException, if some power or set boot device
            operation failed on the node.
        """
        # NOTE(tiendc): Before deploying, we need to backup BIOS config
        # as the data will be used later when cleaning.
        if task.node.provision_state == states.DEPLOYING:
            irmc_management.backup_bios_config(task)

        super(IRMCPXEBoot, self).prepare_ramdisk(task, ramdisk_params)
Beispiel #2
0
    def prepare_ramdisk(self, task, ramdisk_params):
        """Prepares the boot of Ironic ramdisk using PXE.

        This method prepares the boot of the deploy kernel/ramdisk after
        reading relevant information from the node's driver_info and
        instance_info.

        :param task: a task from TaskManager.
        :param ramdisk_params: the parameters to be passed to the ramdisk.
            pxe driver passes these parameters as kernel command-line
            arguments.
        :returns: None
        :raises: MissingParameterValue, if some information is missing in
            node's driver_info or instance_info.
        :raises: InvalidParameterValue, if some information provided is
            invalid.
        :raises: IronicException, if some power or set boot device
            operation failed on the node.
        """
        # NOTE(tiendc): Before deploying, we need to backup BIOS config
        # as the data will be used later when cleaning.
        if task.node.provision_state == states.DEPLOYING:
            irmc_management.backup_bios_config(task)

        super(IRMCPXEBoot, self).prepare_ramdisk(task, ramdisk_params)
Beispiel #3
0
    def prepare_ramdisk(self, task, ramdisk_params):
        """Prepares the deploy ramdisk using virtual media.

        Prepares the options for the deployment ramdisk, sets the node to boot
        from virtual media cdrom.

        :param task: a TaskManager instance containing the node to act on.
        :param ramdisk_params: the options to be passed to the deploy ramdisk.
        :raises: ImageRefValidationFailed if no image service can handle
                 specified href.
        :raises: ImageCreationFailed, if it failed while creating the floppy
                 image.
        :raises: InvalidParameterValue if the validation of the
                 PowerInterface or ManagementInterface fails.
        :raises: IRMCOperationError, if some operation on iRMC fails.
        """

        # NOTE(TheJulia): If this method is being called by something
        # aside from deployment and clean, such as conductor takeover, we
        # should treat this as a no-op and move on otherwise we would modify
        # the state of the node due to virtual media operations.
        if (task.node.provision_state != states.DEPLOYING and
                task.node.provision_state != states.CLEANING):
            return

        # NOTE(tiendc): Before deploying, we need to backup BIOS config
        # as the data will be used later when cleaning.
        if task.node.provision_state == states.DEPLOYING:
            irmc_management.backup_bios_config(task)

        deploy_nic_mac = deploy_utils.get_single_nic_with_vif_port_id(task)
        ramdisk_params['BOOTIF'] = deploy_nic_mac

        _setup_deploy_iso(task, ramdisk_params)
Beispiel #4
0
    def prepare_ramdisk(self, task, ramdisk_params):
        """Prepares the deploy ramdisk using virtual media.

        Prepares the options for the deployment ramdisk, sets the node to boot
        from virtual media cdrom.

        :param task: a TaskManager instance containing the node to act on.
        :param ramdisk_params: the options to be passed to the deploy ramdisk.
        :raises: ImageRefValidationFailed if no image service can handle
                 specified href.
        :raises: ImageCreationFailed, if it failed while creating the floppy
                 image.
        :raises: InvalidParameterValue if the validation of the
                 PowerInterface or ManagementInterface fails.
        :raises: IRMCOperationError, if some operation on iRMC fails.
        """

        # NOTE(TheJulia): If this method is being called by something
        # aside from deployment and clean, such as conductor takeover, we
        # should treat this as a no-op and move on otherwise we would modify
        # the state of the node due to virtual media operations.
        if (task.node.provision_state != states.DEPLOYING
                and task.node.provision_state != states.CLEANING):
            return

        # NOTE(tiendc): Before deploying, we need to backup BIOS config
        # as the data will be used later when cleaning.
        if task.node.provision_state == states.DEPLOYING:
            irmc_management.backup_bios_config(task)

        deploy_nic_mac = deploy_utils.get_single_nic_with_vif_port_id(task)
        ramdisk_params['BOOTIF'] = deploy_nic_mac

        _setup_deploy_iso(task, ramdisk_params)
    def test_backup_bios_config_skipped(self, mock_get_power,
                                        mock_power_action, mock_elcm):
        self.config(clean_priority_restore_irmc_bios_config=0, group='irmc')
        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            irmc_management.backup_bios_config(task)

            self.assertNotIn('irmc_bios_config',
                             task.node.driver_internal_info)
            self.assertFalse(mock_elcm.backup_bios_config.called)
Beispiel #6
0
    def prepare_ramdisk(self, task, ramdisk_params):
        """Prepares the deploy or rescue ramdisk using virtual media.

        Prepares the options for the deploy or rescue ramdisk, sets the node
        to boot from virtual media cdrom.

        :param task: a TaskManager instance containing the node to act on.
        :param ramdisk_params: the options to be passed to the ramdisk.
        :raises: ImageRefValidationFailed if no image service can handle
                 specified href.
        :raises: ImageCreationFailed, if it failed while creating the floppy
                 image.
        :raises: InvalidParameterValue if the validation of the
                 PowerInterface or ManagementInterface fails.
        :raises: IRMCOperationError, if some operation on iRMC fails.
        """

        # NOTE(TheJulia): If this method is being called by something
        # aside from deployment, clean and rescue, such as conductor takeover,
        # we should treat this as a no-op and move on otherwise we would
        # modify the state of the node due to virtual media operations.
        if task.node.provision_state not in (states.DEPLOYING, states.CLEANING,
                                             states.RESCUING):
            return

        # NOTE(tiendc): Before deploying, we need to backup BIOS config
        # as the data will be used later when cleaning.
        if task.node.provision_state == states.DEPLOYING:
            irmc_management.backup_bios_config(task)

            if not task.driver.storage.should_write_image(task):
                LOG.debug(
                    'Node %(node)s skips ramdisk preparation because of '
                    'booting from a remote volume.', {'node': task.node.uuid})
                return

        # NOTE(TheJulia): Since we're deploying, cleaning, or rescuing,
        # with virtual media boot, we should generate a token!
        manager_utils.add_secret_token(task.node, pregenerated=True)
        ramdisk_params['ipa-agent-token'] = \
            task.node.driver_internal_info['agent_secret_token']
        task.node.save()

        deploy_nic_mac = deploy_utils.get_single_nic_with_vif_port_id(task)
        if deploy_nic_mac is not None:
            ramdisk_params['BOOTIF'] = deploy_nic_mac

        if task.node.provision_state == states.RESCUING:
            mode = 'rescue'
        else:
            mode = 'deploy'

        _setup_vmedia(task, mode, ramdisk_params)
    def test_backup_bios_config(self, mock_get_power, mock_power_action,
                                mock_elcm):
        self.config(clean_priority_restore_irmc_bios_config=10, group='irmc')
        bios_config = {'Server': {'System': {'BiosConfig': {'key1': 'val1'}}}}
        mock_elcm.backup_bios_config.return_value = {
            'bios_config': bios_config}
        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            irmc_management.backup_bios_config(task)

            self.assertEqual(bios_config, task.node.driver_internal_info[
                'irmc_bios_config'])
            self.assertEqual(1, mock_elcm.backup_bios_config.call_count)
Beispiel #8
0
    def prepare_ramdisk(self, task, ramdisk_params):
        """Prepares the deploy or rescue ramdisk using virtual media.

        Prepares the options for the deploy or rescue ramdisk, sets the node
        to boot from virtual media cdrom.

        :param task: a TaskManager instance containing the node to act on.
        :param ramdisk_params: the options to be passed to the ramdisk.
        :raises: ImageRefValidationFailed if no image service can handle
                 specified href.
        :raises: ImageCreationFailed, if it failed while creating the floppy
                 image.
        :raises: InvalidParameterValue if the validation of the
                 PowerInterface or ManagementInterface fails.
        :raises: IRMCOperationError, if some operation on iRMC fails.
        """

        # NOTE(TheJulia): If this method is being called by something
        # aside from deployment, clean and rescue, such as conductor takeover,
        # we should treat this as a no-op and move on otherwise we would
        # modify the state of the node due to virtual media operations.
        if task.node.provision_state not in (states.DEPLOYING,
                                             states.CLEANING,
                                             states.RESCUING):
            return

        # NOTE(tiendc): Before deploying, we need to backup BIOS config
        # as the data will be used later when cleaning.
        if task.node.provision_state == states.DEPLOYING:
            irmc_management.backup_bios_config(task)

            if not task.driver.storage.should_write_image(task):
                LOG.debug('Node %(node)s skips ramdisk preparation because of '
                          'booting from a remote volume.',
                          {'node': task.node.uuid})
                return

        deploy_nic_mac = deploy_utils.get_single_nic_with_vif_port_id(task)
        ramdisk_params['BOOTIF'] = deploy_nic_mac

        if task.node.provision_state == states.RESCUING:
            mode = 'rescue'
        else:
            mode = 'deploy'

        _setup_vmedia(task, mode, ramdisk_params)