コード例 #1
0
ファイル: deploy.py プロジェクト: stendulker/ironic
    def validate(self, task):
        """Validate the deployment information for the task's node.

        :param task: a TaskManager instance containing the node to act on.
        :raises: InvalidParameterValue, if config option has invalid value.
        :raises: IRMCSharedFileSystemNotMounted, if shared file system is
            not mounted.
        :raises: InvalidParameterValue, if some information is invalid.
        :raises: MissingParameterValue if 'kernel_id' and 'ramdisk_id' are
            missing in the Glance image, or if 'kernel' and 'ramdisk' are
            missing in the Non Glance image.
        """
        _check_share_fs_mounted()
        iscsi_deploy.validate(task)

        d_info = _parse_deploy_info(task.node)
        if task.node.driver_internal_info.get('is_whole_disk_image'):
            props = []
        elif service_utils.is_glance_image(d_info['image_source']):
            props = ['kernel_id', 'ramdisk_id']
        else:
            props = ['kernel', 'ramdisk']
        iscsi_deploy.validate_image_properties(task.context, d_info,
                                               props)
        deploy_utils.validate_capabilities(task.node)
コード例 #2
0
ファイル: pxe.py プロジェクト: Codixis/ironic
    def validate(self, task):
        """Validate the deployment information for the task's node.

        :param task: a TaskManager instance containing the node to act on.
        :raises: InvalidParameterValue.
        :raises: MissingParameterValue
        """
        node = task.node

        # Check the boot_mode and boot_option capabilities values.
        deploy_utils.validate_capabilities(node)

        boot_mode = deploy_utils.get_boot_mode_for_deploy(task.node)

        if CONF.pxe.ipxe_enabled:
            if not CONF.pxe.http_url or not CONF.pxe.http_root:
                raise exception.MissingParameterValue(
                    _("iPXE boot is enabled but no HTTP URL or HTTP " "root was specified.")
                )
            # iPXE and UEFI should not be configured together.
            if boot_mode == "uefi":
                LOG.error(_LE("UEFI boot mode is not supported with " "iPXE boot enabled."))
                raise exception.InvalidParameterValue(
                    _(
                        "Conflict: iPXE is enabled, but cannot be used with node"
                        "%(node_uuid)s configured to use UEFI boot"
                    )
                    % {"node_uuid": node.uuid}
                )

        # Check if 'boot_option' is compatible with 'boot_mode' of uefi and
        # image being deployed
        if boot_mode == "uefi":
            validate_boot_option_for_uefi(task.node)

        if deploy_utils.is_trusted_boot_requested(task.node):
            # Check if 'boot_option' and boot mode is compatible with
            # trusted boot.
            validate_boot_parameters_for_trusted_boot(task.node)

        d_info = _parse_deploy_info(node)

        iscsi_deploy.validate(task)

        if node.driver_internal_info.get("is_whole_disk_image"):
            props = []
        elif service_utils.is_glance_image(d_info["image_source"]):
            props = ["kernel_id", "ramdisk_id"]
        else:
            props = ["kernel", "ramdisk"]

        iscsi_deploy.validate_image_properties(task.context, d_info, props)
コード例 #3
0
ファイル: pxe.py プロジェクト: overcastcloud/ironic
    def validate(self, task):
        """Validate the deployment information for the task's node.

        :param task: a TaskManager instance containing the node to act on.
        :raises: InvalidParameterValue.
        :raises: MissingParameterValue
        """
        node = task.node

        # Check the boot_mode and boot_option capabilities values.
        deploy_utils.validate_capabilities(node)

        boot_mode = deploy_utils.get_boot_mode_for_deploy(task.node)

        if CONF.pxe.ipxe_enabled:
            if not CONF.pxe.http_url or not CONF.pxe.http_root:
                raise exception.MissingParameterValue(
                    _("iPXE boot is enabled but no HTTP URL or HTTP "
                      "root was specified."))
            # iPXE and UEFI should not be configured together.
            if boot_mode == 'uefi':
                LOG.error(
                    _LE("UEFI boot mode is not supported with "
                        "iPXE boot enabled."))
                raise exception.InvalidParameterValue(
                    _("Conflict: iPXE is enabled, but cannot be used with node"
                      "%(node_uuid)s configured to use UEFI boot") %
                    {'node_uuid': node.uuid})

        # Check if 'boot_option' is compatible with 'boot_mode' of uefi and
        # image being deployed
        if boot_mode == 'uefi':
            validate_boot_option_for_uefi(task.node)

        if deploy_utils.is_trusted_boot_requested(task.node):
            # Check if 'boot_option' and boot mode is compatible with
            # trusted boot.
            validate_boot_parameters_for_trusted_boot(task.node)

        d_info = _parse_deploy_info(node)

        iscsi_deploy.validate(task)

        if node.driver_internal_info.get('is_whole_disk_image'):
            props = []
        elif service_utils.is_glance_image(d_info['image_source']):
            props = ['kernel_id', 'ramdisk_id']
        else:
            props = ['kernel', 'ramdisk']

        iscsi_deploy.validate_image_properties(task.context, d_info, props)
コード例 #4
0
ファイル: deploy.py プロジェクト: Pratyusha9/ironic
 def _validate_boot_into_iso(self, task, kwargs):
     """Validates if attach_iso can be called and if inputs are proper."""
     if not (task.node.provision_state == states.MANAGEABLE or
             task.node.maintenance is True):
         msg = (_("The requested action 'boot_into_iso' can be performed "
                  "only when node %(node_uuid)s is in %(state)s state or "
                  "in 'maintenance' mode") %
                {'node_uuid': task.node.uuid,
                 'state': states.MANAGEABLE})
         raise exception.InvalidStateRequested(msg)
     d_info = {'boot_iso_href': kwargs.get('boot_iso_href')}
     error_msg = _("Error validating input for boot_into_iso vendor "
                   "passthru. Some parameters were not provided: ")
     deploy_utils.check_for_missing_params(d_info, error_msg)
     iscsi_deploy.validate_image_properties(
         task.context, {'image_source': kwargs.get('boot_iso_href')}, [])
コード例 #5
0
    def test_validate_image_properties_glance_image(self, image_service_mock):
        node = obj_utils.create_test_node(
                   self.context, driver='fake_pxe',
                   instance_info=INST_INFO_DICT,
                   driver_info=DRV_INFO_DICT,
                   driver_internal_info=DRV_INTERNAL_INFO_DICT,
               )
        d_info = pxe._parse_deploy_info(node)
        image_service_mock.return_value.show.return_value = {
            'properties': {'kernel_id': '1111', 'ramdisk_id': '2222'},
        }

        iscsi_deploy.validate_image_properties(self.context, d_info,
                                               ['kernel_id', 'ramdisk_id'])
        image_service_mock.assert_called_once_with(
            node.instance_info['image_source'], context=self.context
        )
コード例 #6
0
 def _validate_boot_into_iso(self, task, kwargs):
     """Validates if attach_iso can be called and if inputs are proper."""
     if not (task.node.provision_state == states.MANAGEABLE
             or task.node.maintenance is True):
         msg = (_("The requested action 'boot_into_iso' can be performed "
                  "only when node %(node_uuid)s is in %(state)s state or "
                  "in 'maintenance' mode") % {
                      'node_uuid': task.node.uuid,
                      'state': states.MANAGEABLE
                  })
         raise exception.InvalidStateRequested(msg)
     d_info = {'boot_iso_href': kwargs.get('boot_iso_href')}
     error_msg = _("Error validating input for boot_into_iso vendor "
                   "passthru. Some parameters were not provided: ")
     deploy_utils.check_for_missing_params(d_info, error_msg)
     iscsi_deploy.validate_image_properties(
         task.context, {'image_source': kwargs.get('boot_iso_href')}, [])
コード例 #7
0
 def test_validate_image_properties_nonglance_image(self,
         image_service_show_mock):
     instance_info = {
         'image_source': 'http://ubuntu',
         'kernel': 'kernel_uuid',
         'ramdisk': 'file://initrd',
         'root_gb': 100,
     }
     image_service_show_mock.return_value = {'size': 1, 'properties': {}}
     node = obj_utils.create_test_node(
                self.context, driver='fake_pxe',
                instance_info=instance_info,
                driver_info=DRV_INFO_DICT,
                driver_internal_info=DRV_INTERNAL_INFO_DICT,
            )
     d_info = pxe._parse_deploy_info(node)
     iscsi_deploy.validate_image_properties(self.context, d_info,
                                            ['kernel', 'ramdisk'])
     image_service_show_mock.assert_called_once_with(
         instance_info['image_source'])
コード例 #8
0
    def validate(self, task):
        """Validate the deployment information for the task's node.

        :param task: a TaskManager instance containing the node to act on.
        :raises: InvalidParameterValue, if some information is invalid.
        :raises: MissingParameterValue if 'kernel_id' and 'ramdisk_id' are
            missing in the Glance image or 'kernel' and 'ramdisk' not provided
            in instance_info for non-Glance image.
        """
        iscsi_deploy.validate(task)
        node = task.node

        d_info = _parse_deploy_info(node)

        if node.driver_internal_info.get('is_whole_disk_image'):
            props = []
        elif service_utils.is_glance_image(d_info['image_source']):
            props = ['kernel_id', 'ramdisk_id']
        else:
            props = ['kernel', 'ramdisk']
        iscsi_deploy.validate_image_properties(task.context, d_info, props)
        deploy_utils.validate_capabilities(node)
コード例 #9
0
ファイル: deploy.py プロジェクト: XSiddh/ironic
    def validate(self, task):
        """Validate the deployment information for the task's node.

        :param task: a TaskManager instance containing the node to act on.
        :raises: InvalidParameterValue, if some information is invalid.
        :raises: MissingParameterValue if 'kernel_id' and 'ramdisk_id' are
            missing in the Glance image or 'kernel' and 'ramdisk' not provided
            in instance_info for non-Glance image.
        """
        iscsi_deploy.validate(task)
        node = task.node

        d_info = _parse_deploy_info(node)

        if node.driver_internal_info.get('is_whole_disk_image'):
            props = []
        elif service_utils.is_glance_image(d_info['image_source']):
            props = ['kernel_id', 'ramdisk_id']
        else:
            props = ['kernel', 'ramdisk']
        iscsi_deploy.validate_image_properties(task.context, d_info, props)
        deploy_utils.validate_capabilities(node)
コード例 #10
0
ファイル: deploy.py プロジェクト: Codixis/ironic
    def validate(self, task):
        """Validate the deployment information for the task's node.

        :param task: a TaskManager instance containing the node to act on.
        :raises: InvalidParameterValue, if config option has invalid value.
        :raises: IRMCSharedFileSystemNotMounted, if shared file system is
            not mounted.
        :raises: InvalidParameterValue, if some information is invalid.
        :raises: MissingParameterValue if 'kernel_id' and 'ramdisk_id' are
            missing in the Glance image, or if 'kernel' and 'ramdisk' are
            missing in the Non Glance image.
        """
        _check_share_fs_mounted()
        iscsi_deploy.validate(task)

        d_info = _parse_deploy_info(task.node)
        if task.node.driver_internal_info.get('is_whole_disk_image'):
            props = []
        elif service_utils.is_glance_image(d_info['image_source']):
            props = ['kernel_id', 'ramdisk_id']
        else:
            props = ['kernel', 'ramdisk']
        iscsi_deploy.validate_image_properties(task.context, d_info, props)
        deploy_utils.validate_capabilities(task.node)