def _validate_common(self, task): node = task.node if not driver_utils.get_node_mac_addresses(task): raise exception.MissingParameterValue( _("Node %s does not have any port associated with it.") % node.uuid) # TODO(TheJulia): Once ipxe support is remove from the pxe # interface, this can be removed. if CONF.pxe.ipxe_enabled: if (not CONF.deploy.http_url or not CONF.deploy.http_root): raise exception.MissingParameterValue(_( "iPXE boot is enabled but no HTTP URL or HTTP " "root was specified.")) # Check the trusted_boot capabilities value. deploy_utils.validate_capabilities(node) if deploy_utils.is_trusted_boot_requested(node): # Check if 'boot_option' and boot mode is compatible with # trusted boot. validate_boot_parameters_for_trusted_boot(node) pxe_utils.parse_driver_info(node)
def _validate_common(self, task): node = task.node if not driver_utils.get_node_mac_addresses(task): raise exception.MissingParameterValue( _("Node %s does not have any port associated with it.") % node.uuid) if self.ipxe_enabled: if not CONF.deploy.http_url or not CONF.deploy.http_root: raise exception.MissingParameterValue( _("iPXE boot is enabled but no HTTP URL or HTTP " "root was specified.")) # Check the trusted_boot capabilities value. deploy_utils.validate_capabilities(node) if deploy_utils.is_trusted_boot_requested(node): # Check if 'boot_option' and boot mode is compatible with # trusted boot. if self.ipxe_enabled: # NOTE(TheJulia): So in theory (huge theory here, not put to # practice or tested), that one can define the kernel as tboot # and define the actual kernel and ramdisk as appended data. # Similar to how one can iPXE load the XEN hypervisor. # tboot mailing list seem to indicate pxe/ipxe support, or # more specifically avoiding breaking the scenarios of use, # but there is also no definitive documentation on the subject. LOG.warning( 'Trusted boot has been requested for %(node)s in ' 'concert with iPXE. This is not a supported ' 'configuration for an ironic deployment.', {'node': node.uuid}) pxe_utils.validate_boot_parameters_for_trusted_boot(node) pxe_utils.parse_driver_info(node)
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 """ task.driver.boot.validate(task) node = task.node # Check the boot_mode, boot_option and disk_label capabilities values. deploy_utils.validate_capabilities(node) # Edit early if we are not writing a volume as the validate # tasks evaluate root device hints. if not task.driver.storage.should_write_image(task): LOG.debug('Skipping complete deployment interface validation ' 'for node %s as it is set to boot from a remote ' 'volume.', node.uuid) return # TODO(rameshg87): iscsi_ilo driver uses this method. Remove # and copy-paste it's contents here once iscsi_ilo deploy driver # broken down into separate boot and deploy implementations. validate(task)
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 """ task.driver.boot.validate(task) node = task.node # Check the boot_mode, boot_option and disk_label capabilities values. deploy_utils.validate_capabilities(node) # Edit early if we are not writing a volume as the validate # tasks evaluate root device hints. if not task.driver.storage.should_write_image(task): LOG.debug( 'Skipping complete deployment interface validation ' 'for node %s as it is set to boot from a remote ' 'volume.', node.uuid) return # TODO(rameshg87): iscsi_ilo driver used to call this function. Remove # and copy-paste it's contents here. validate(task)
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'] deploy_utils.validate_image_properties(task.context, d_info, props) deploy_utils.validate_capabilities(task.node)
def validate(self, task): """Validate the driver-specific Node deployment info. This method validates whether the properties of the supplied node contain the required information for this driver to deploy images to the node. :param task: a TaskManager instance :raises: MissingParameterValue, if any of the required parameters are missing. :raises: InvalidParameterValue, if any of the parameters have invalid value. """ if CONF.agent.manage_agent_boot: task.driver.boot.validate(task) node = task.node # Validate node capabilities deploy_utils.validate_capabilities(node) if not task.driver.storage.should_write_image(task): # NOTE(TheJulia): There is no reason to validate # image properties if we will not be writing an image # in a boot from volume case. As such, return to the caller. LOG.debug( 'Skipping complete deployment interface validation ' 'for node %s as it is set to boot from a remote ' 'volume.', node.uuid) return params = {} image_source = node.instance_info.get('image_source') params['instance_info.image_source'] = image_source error_msg = _('Node %s failed to validate deploy image info. Some ' 'parameters were missing') % node.uuid deploy_utils.check_for_missing_params(params, error_msg) if not service_utils.is_glance_image(image_source): if not node.instance_info.get('image_checksum'): raise exception.MissingParameterValue( _("image_source's image_checksum must be provided in " "instance_info for node %s") % node.uuid) check_image_size(task, image_source) # Validate the root device hints try: root_device = node.properties.get('root_device') il_utils.parse_root_device_hints(root_device) except ValueError as e: raise exception.InvalidParameterValue( _('Failed to validate the root device hints for node ' '%(node)s. Error: %(error)s') % { 'node': node.uuid, 'error': e }) validate_image_proxies(node)
def validate(self, task): """Validate the PXE-specific info for booting deploy/instance images. This method validates the PXE-specific info for booting the ramdisk and instance on the node. If invalid, raises an exception; otherwise returns None. :param task: a task from TaskManager. :returns: None :raises: InvalidParameterValue, if some parameters are invalid. :raises: MissingParameterValue, if some required parameters are missing. """ node = task.node if not driver_utils.get_node_mac_addresses(task): raise exception.MissingParameterValue( _("Node %s does not have any port associated with it.") % node.uuid) if not CONF.deploy.http_url or not CONF.deploy.http_root: raise exception.MissingParameterValue( _("iPXE boot is enabled but no HTTP URL or HTTP " "root was specified.")) # Check the trusted_boot capabilities value. deploy_utils.validate_capabilities(node) if deploy_utils.is_trusted_boot_requested(node): # Check if 'boot_option' and boot mode is compatible with # trusted boot. # NOTE(TheJulia): So in theory (huge theory here, not put to # practice or tested), that one can define the kernel as tboot # and define the actual kernel and ramdisk as appended data. # Similar to how one can iPXE load the XEN hypervisor. # tboot mailing list seem to indicate pxe/ipxe support, or # more specifically avoiding breaking the scenarios of use, # but there is also no definitive documentation on the subject. LOG.warning( 'Trusted boot has been requested for %(node)s in ' 'concert with iPXE. This is not a supported ' 'configuration for an ironic deployment.', {'node': node.uuid}) pxe.validate_boot_parameters_for_trusted_boot(node) pxe_utils.parse_driver_info(node) # NOTE(TheJulia): If we're not writing an image, we can skip # the remainder of this method. if (not task.driver.storage.should_write_image(task)): return d_info = deploy_utils.get_image_instance_info(node) if (node.driver_internal_info.get('is_whole_disk_image') or deploy_utils.get_boot_option(node) == 'local'): props = [] elif service_utils.is_glance_image(d_info['image_source']): props = ['kernel_id', 'ramdisk_id'] else: props = ['kernel', 'ramdisk'] deploy_utils.validate_image_properties(task.context, d_info, props)
def _validate_common(self, task): node = task.node if not driver_utils.get_node_mac_addresses(task): raise exception.MissingParameterValue( _("Node %s does not have any port associated with it.") % node.uuid) if self.ipxe_enabled: if not CONF.deploy.http_url or not CONF.deploy.http_root: raise exception.MissingParameterValue( _("iPXE boot is enabled but no HTTP URL or HTTP " "root was specified.")) # NOTE(zer0c00l): When 'kickstart' boot option is used we need to store # kickstart and squashfs files in http_root directory. These files # will be eventually requested by anaconda installer during deployment # over http(s). if deploy_utils.get_boot_option(node) == 'kickstart': if not CONF.deploy.http_url or not CONF.deploy.http_root: raise exception.MissingParameterValue( _("'kickstart' boot option is set on the node but no HTTP " "URL or HTTP root was specified.")) if not CONF.anaconda.default_ks_template: raise exception.MissingParameterValue( _("'kickstart' boot option is set on the node but no " "default kickstart template is specified.")) # Check the trusted_boot capabilities value. deploy_utils.validate_capabilities(node) if deploy_utils.is_trusted_boot_requested(node): # Check if 'boot_option' and boot mode is compatible with # trusted boot. if self.ipxe_enabled: # NOTE(TheJulia): So in theory (huge theory here, not put to # practice or tested), that one can define the kernel as tboot # and define the actual kernel and ramdisk as appended data. # Similar to how one can iPXE load the XEN hypervisor. # tboot mailing list seem to indicate pxe/ipxe support, or # more specifically avoiding breaking the scenarios of use, # but there is also no definitive documentation on the subject. LOG.warning( 'Trusted boot has been requested for %(node)s in ' 'concert with iPXE. This is not a supported ' 'configuration for an ironic deployment.', {'node': node.uuid}) pxe_utils.validate_boot_parameters_for_trusted_boot(node) # Check if we have invalid parameters being passed which will not work # for ramdisk configurations. if (node.instance_info.get('image_source') and node.instance_info.get('boot_iso')): raise exception.InvalidParameterValue( _("An 'image_source' and 'boot_iso' parameter may not be " "specified at the same time.")) pxe_utils.parse_driver_info(node)
def validate(self, task): """Validate the PXE-specific info for booting deploy/instance images. This method validates the PXE-specific info for booting the ramdisk and instance on the node. If invalid, raises an exception; otherwise returns None. :param task: a task from TaskManager. :returns: None :raises: InvalidParameterValue, if some parameters are invalid. :raises: MissingParameterValue, if some required parameters are missing. """ node = task.node if not driver_utils.get_node_mac_addresses(task): raise exception.MissingParameterValue( _("Node %s does not have any port associated with it.") % node.uuid) if not CONF.deploy.http_url or not CONF.deploy.http_root: raise exception.MissingParameterValue(_( "iPXE boot is enabled but no HTTP URL or HTTP " "root was specified.")) # Check the trusted_boot capabilities value. deploy_utils.validate_capabilities(node) if deploy_utils.is_trusted_boot_requested(node): # Check if 'boot_option' and boot mode is compatible with # trusted boot. # NOTE(TheJulia): So in theory (huge theory here, not put to # practice or tested), that one can define the kernel as tboot # and define the actual kernel and ramdisk as appended data. # Similar to how one can iPXE load the XEN hypervisor. # tboot mailing list seem to indicate pxe/ipxe support, or # more specifically avoiding breaking the scenarios of use, # but there is also no definitive documentation on the subject. LOG.warning('Trusted boot has been requested for %(node)s in ' 'concert with iPXE. This is not a supported ' 'configuration for an ironic deployment.', {'node': node.uuid}) pxe.validate_boot_parameters_for_trusted_boot(node) pxe_utils.parse_driver_info(node) # NOTE(TheJulia): If we're not writing an image, we can skip # the remainder of this method. if (not task.driver.storage.should_write_image(task)): return d_info = deploy_utils.get_image_instance_info(node) if (node.driver_internal_info.get('is_whole_disk_image') or deploy_utils.get_boot_option(node) == 'local'): props = [] elif service_utils.is_glance_image(d_info['image_source']): props = ['kernel_id', 'ramdisk_id'] else: props = ['kernel', 'ramdisk'] deploy_utils.validate_image_properties(task.context, d_info, props)
def validate(self, task): """Validate the driver-specific Node deployment info. :param task: a TaskManager instance :raises: MissingParameterValue if some parameters are missing. """ deploy_utils.validate_capabilities(task.node) _parse_driver_info(task.node)
def validate(self, task): """Validate the PXE-specific info for booting deploy/instance images. This method validates the PXE-specific info for booting the ramdisk and instance on the node. If invalid, raises an exception; otherwise returns None. :param task: a task from TaskManager. :returns: None :raises: InvalidParameterValue, if some parameters are invalid. :raises: MissingParameterValue, if some required parameters are missing. """ node = task.node if not driver_utils.get_node_mac_addresses(task): raise exception.MissingParameterValue( _("Node %s does not have any port associated with it.") % node.uuid) # Get the boot_mode capability value. boot_mode = deploy_utils.get_boot_mode_for_deploy(node) if CONF.pxe.ipxe_enabled: if (not CONF.deploy.http_url or not CONF.deploy.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}) if boot_mode == 'uefi': validate_boot_option_for_uefi(node) # Check the trusted_boot capabilities value. deploy_utils.validate_capabilities(node) if deploy_utils.is_trusted_boot_requested(node): # Check if 'boot_option' and boot mode is compatible with # trusted boot. validate_boot_parameters_for_trusted_boot(node) _parse_driver_info(node) d_info = _parse_instance_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'] deploy_utils.validate_image_properties(task.context, d_info, props)
def validate(self, task): """Validate the driver-specific Node deployment info. This method validates whether the properties of the supplied node contain the required information for this driver to deploy images to the node. :param task: a TaskManager instance :raises: MissingParameterValue, if any of the required parameters are missing. :raises: InvalidParameterValue, if any of the parameters have invalid value. """ if CONF.agent.manage_agent_boot: task.driver.boot.validate(task) node = task.node # Validate node capabilities deploy_utils.validate_capabilities(node) if not task.driver.storage.should_write_image(task): # NOTE(TheJulia): There is no reason to validate # image properties if we will not be writing an image # in a boot from volume case. As such, return to the caller. LOG.debug('Skipping complete deployment interface validation ' 'for node %s as it is set to boot from a remote ' 'volume.', node.uuid) return params = {} image_source = node.instance_info.get('image_source') params['instance_info.image_source'] = image_source error_msg = _('Node %s failed to validate deploy image info. Some ' 'parameters were missing') % node.uuid deploy_utils.check_for_missing_params(params, error_msg) if not service_utils.is_glance_image(image_source): if not node.instance_info.get('image_checksum'): raise exception.MissingParameterValue(_( "image_source's image_checksum must be provided in " "instance_info for node %s") % node.uuid) check_image_size(task, image_source) # Validate the root device hints try: root_device = node.properties.get('root_device') il_utils.parse_root_device_hints(root_device) except ValueError as e: raise exception.InvalidParameterValue( _('Failed to validate the root device hints for node ' '%(node)s. Error: %(error)s') % {'node': node.uuid, 'error': e}) validate_image_proxies(node)
def validate(self, task): if 'ramdisk_boot' not in task.driver.boot.capabilities: raise exception.InvalidParameterValue( message=_('Invalid configuration: The boot interface ' 'must have the `ramdisk_boot` capability. ' 'You are using an incompatible boot interface.')) task.driver.boot.validate(task) # Validate node capabilities deploy_utils.validate_capabilities(task.node)
def validate(self, task): if 'ramdisk_boot' not in task.driver.boot.capabilities: raise exception.InvalidParameterValue( err=('Invalid configuration: The boot interface ' 'must have the `ramdisk_boot` capability. ' 'You are using an incompatible boot interface.')) task.driver.boot.validate(task) # Validate node capabilities deploy_utils.validate_capabilities(task.node)
def validate(self, task): """Validate the driver-specific Node deployment info. :param task: a TaskManager instance :raises: IRMCSharedFileSystemNotMounted, if shared file system is not mounted. :raises: InvalidParameterValue, if config option has invalid value. :raises: MissingParameterValue if some parameters are missing. """ _check_share_fs_mounted() _parse_driver_info(task.node) deploy_utils.validate_capabilities(task.node)
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)
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)
def validate(self, task): """Validate the PXE-specific info for booting deploy/instance images. This method validates the PXE-specific info for booting the ramdisk and instance on the node. If invalid, raises an exception; otherwise returns None. :param task: a task from TaskManager. :returns: None :raises: InvalidParameterValue, if some parameters are invalid. :raises: MissingParameterValue, if some required parameters are missing. """ node = task.node if not driver_utils.get_node_mac_addresses(task): raise exception.MissingParameterValue( _("Node %s does not have any port associated with it.") % node.uuid) # TODO(TheJulia): Once ipxe support is remove from the pxe # interface, this can be removed. if CONF.pxe.ipxe_enabled: if (not CONF.deploy.http_url or not CONF.deploy.http_root): raise exception.MissingParameterValue(_( "iPXE boot is enabled but no HTTP URL or HTTP " "root was specified.")) # Check the trusted_boot capabilities value. deploy_utils.validate_capabilities(node) if deploy_utils.is_trusted_boot_requested(node): # Check if 'boot_option' and boot mode is compatible with # trusted boot. validate_boot_parameters_for_trusted_boot(node) pxe_utils.parse_driver_info(node) # NOTE(TheJulia): If we're not writing an image, we can skip # the remainder of this method. if (not task.driver.storage.should_write_image(task)): return d_info = deploy_utils.get_image_instance_info(node) if (node.driver_internal_info.get('is_whole_disk_image') or deploy_utils.get_boot_option(node) == 'local'): props = [] elif service_utils.is_glance_image(d_info['image_source']): props = ['kernel_id', 'ramdisk_id'] else: props = ['kernel', 'ramdisk'] deploy_utils.validate_image_properties(task.context, d_info, props)
def validate(self, task): """Validate the driver-specific Node deployment info. This method validates whether the properties of the supplied node contain the required information for this driver to deploy images to the node. :param task: a TaskManager instance :raises: MissingParameterValue, if any of the required parameters are missing. :raises: InvalidParameterValue, if any of the parameters have invalid value. """ if CONF.agent.manage_agent_boot: task.driver.boot.validate(task) node = task.node params = {} image_source = node.instance_info.get('image_source') params['instance_info.image_source'] = image_source error_msg = _('Node %s failed to validate deploy image info. Some ' 'parameters were missing') % node.uuid deploy_utils.check_for_missing_params(params, error_msg) if not service_utils.is_glance_image(image_source): if not node.instance_info.get('image_checksum'): raise exception.MissingParameterValue( _("image_source's image_checksum must be provided in " "instance_info for node %s") % node.uuid) check_image_size(task, image_source) is_whole_disk_image = node.driver_internal_info.get( 'is_whole_disk_image') # TODO(sirushtim): Remove once IPA has support for partition images. if is_whole_disk_image is False: raise exception.InvalidParameterValue( _("Node %(node)s is configured to use the %(driver)s driver " "which currently does not support deploying partition " "images.") % { 'node': node.uuid, 'driver': node.driver }) # Validate the root device hints deploy_utils.parse_root_device_hints(node) # Validate node capabilities deploy_utils.validate_capabilities(node) validate_image_proxies(node)
def validate(self, task): """Validate the driver-specific Node deployment info. This method validates whether the properties of the supplied node contain the required information for this driver to deploy images to the node. :param task: a TaskManager instance :raises: MissingParameterValue, if any of the required parameters are missing. :raises: InvalidParameterValue, if any of the parameters have invalid value. """ if CONF.agent.manage_agent_boot: task.driver.boot.validate(task) node = task.node params = {} image_source = node.instance_info.get("image_source") params["instance_info.image_source"] = image_source error_msg = _("Node %s failed to validate deploy image info. Some " "parameters were missing") % node.uuid deploy_utils.check_for_missing_params(params, error_msg) if not service_utils.is_glance_image(image_source): if not node.instance_info.get("image_checksum"): raise exception.MissingParameterValue( _("image_source's image_checksum must be provided in " "instance_info for node %s") % node.uuid ) check_image_size(task, image_source) is_whole_disk_image = node.driver_internal_info.get("is_whole_disk_image") # TODO(sirushtim): Remove once IPA has support for partition images. if is_whole_disk_image is False: raise exception.InvalidParameterValue( _( "Node %(node)s is configured to use the %(driver)s driver " "which currently does not support deploying partition " "images." ) % {"node": node.uuid, "driver": node.driver} ) # Validate the root device hints deploy_utils.parse_root_device_hints(node) # Validate node capabilities deploy_utils.validate_capabilities(node) validate_image_proxies(node)
def validate(self, task): """Validate the driver-specific Node deployment info. This method validates whether the properties of the supplied node contain the required information for this driver to deploy images to the node. :param task: a TaskManager instance :raises: MissingParameterValue, if any of the required parameters are missing. :raises: InvalidParameterValue, if any of the parameters have invalid value. """ if CONF.agent.manage_agent_boot: task.driver.boot.validate(task) node = task.node params = {} image_source = node.instance_info.get('image_source') params['instance_info.image_source'] = image_source error_msg = _('Node %s failed to validate deploy image info. Some ' 'parameters were missing') % node.uuid deploy_utils.check_for_missing_params(params, error_msg) if not service_utils.is_glance_image(image_source): if not node.instance_info.get('image_checksum'): raise exception.MissingParameterValue( _("image_source's image_checksum must be provided in " "instance_info for node %s") % node.uuid) check_image_size(task, image_source) # Validate the root device hints try: root_device = node.properties.get('root_device') il_utils.parse_root_device_hints(root_device) except ValueError as e: raise exception.InvalidParameterValue( _('Failed to validate the root device hints for node ' '%(node)s. Error: %(error)s') % { 'node': node.uuid, 'error': e }) # Validate node capabilities deploy_utils.validate_capabilities(node) validate_image_proxies(node)
def validate(self, task): """Validate the driver-specific Node deployment info. This method validates whether the properties of the supplied node contain the required information for this driver to deploy images to the node. :param task: a TaskManager instance :raises: MissingParameterValue, if any of the required parameters are missing. :raises: InvalidParameterValue, if any of the parameters have invalid value. """ if CONF.agent.manage_agent_boot: task.driver.boot.validate(task) node = task.node params = {} image_source = node.instance_info.get('image_source') params['instance_info.image_source'] = image_source error_msg = _('Node %s failed to validate deploy image info. Some ' 'parameters were missing') % node.uuid deploy_utils.check_for_missing_params(params, error_msg) if not service_utils.is_glance_image(image_source): if not node.instance_info.get('image_checksum'): raise exception.MissingParameterValue(_( "image_source's image_checksum must be provided in " "instance_info for node %s") % node.uuid) check_image_size(task, image_source) # Validate the root device hints try: root_device = node.properties.get('root_device') il_utils.parse_root_device_hints(root_device) except ValueError as e: raise exception.InvalidParameterValue( _('Failed to validate the root device hints for node ' '%(node)s. Error: %(error)s') % {'node': node.uuid, 'error': e}) # Validate node capabilities deploy_utils.validate_capabilities(node) validate_image_proxies(node)
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 """ task.driver.boot.validate(task) node = task.node # Check the boot_mode and boot_option capabilities values. deploy_utils.validate_capabilities(node) # TODO(rameshg87): iscsi_ilo driver uses this method. Remove # and copy-paste it's contents here once iscsi_ilo deploy driver # broken down into separate boot and deploy implementations. validate(task)
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 """ task.driver.boot.validate(task) node = task.node # Check the boot_mode, boot_option and disk_label capabilities values. deploy_utils.validate_capabilities(node) # TODO(rameshg87): iscsi_ilo driver uses this method. Remove # and copy-paste it's contents here once iscsi_ilo deploy driver # broken down into separate boot and deploy implementations. validate(task)
def validate(self, task, method, **kwargs): """Validates the inputs for a vendor passthru. If invalid, raises an exception; otherwise returns None. Valid methods: * pass_deploy_info * pass_bootloader_install_info :param task: a TaskManager instance containing the node to act on. :param method: method to be validated. :param kwargs: kwargs containins the method's parameters. :raises: InvalidParameterValue if any parameters is invalid. """ if method == 'pass_deploy_info': deploy_utils.validate_capabilities(task.node) get_deploy_info(task.node, **kwargs) elif method == 'pass_bootloader_install_info': validate_pass_bootloader_info_input(task, kwargs)
def validate(self, task): """Validate the driver-specific Node deployment info. This method validates whether the properties of the supplied node contain the required information for this driver to deploy images to the node. :param task: a TaskManager instance :raises: MissingParameterValue, if any of the required parameters are missing. :raises: InvalidParameterValue, if any of the parameters have invalid value. """ if CONF.agent.manage_agent_boot: task.driver.boot.validate(task) deploy_utils.validate_capabilities(task.node) # Validate the root device hints deploy_utils.get_root_device_for_deploy(task.node)
def validate(self, task, method, **kwargs): """Validates the inputs for a vendor passthru. If invalid, raises an exception; otherwise returns None. Valid methods: * pass_deploy_info * pass_bootloader_install_info :param task: a TaskManager instance containing the node to act on. :param method: method to be validated. :param kwargs: kwargs containins the method's parameters. :raises: InvalidParameterValue if any parameters is invalid. """ if method == 'pass_deploy_info': deploy_utils.validate_capabilities(task.node) iscsi_deploy.get_deploy_info(task.node, **kwargs) elif method == 'pass_bootloader_install_info': iscsi_deploy.validate_pass_bootloader_info_input(task, kwargs)
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)
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'] deploy_utils.validate_image_properties(task.context, d_info, props) deploy_utils.validate_capabilities(node)
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 """ task.driver.boot.validate(task) node = task.node # Check the boot_mode, boot_option and disk_label capabilities values. deploy_utils.validate_capabilities(node) # Edit early if we are not writing a volume as the validate # tasks evaluate root device hints. if not task.driver.storage.should_write_image(task): return # TODO(rameshg87): iscsi_ilo driver uses this method. Remove # and copy-paste it's contents here once iscsi_ilo deploy driver # broken down into separate boot and deploy implementations. validate(task)
def validate(self, task, method, **kwargs): """Validates the inputs for a vendor passthru. If invalid, raises an exception; otherwise returns None. Valid methods: * pass_deploy_info * pass_bootloader_install_info :param task: a TaskManager instance containing the node to act on. :param method: method to be validated. :param kwargs: kwargs containins the method's parameters. :raises: InvalidParameterValue if any parameters is invalid. """ if method == "pass_deploy_info": # TODO(rameshg87): Don't validate deploy info if bash ramdisk # booted during cleaning. It will be handled in pass_deploy_info # method. Remove the below code once we stop supporting bash # ramdisk in Ironic. if task.node.provision_state != states.CLEANWAIT: deploy_utils.validate_capabilities(task.node) get_deploy_info(task.node, **kwargs) elif method == "pass_bootloader_install_info": validate_pass_bootloader_info_input(task, kwargs)
def validate(self, task, method, **kwargs): """Validates the inputs for a vendor passthru. If invalid, raises an exception; otherwise returns None. Valid methods: * pass_deploy_info * pass_bootloader_install_info :param task: a TaskManager instance containing the node to act on. :param method: method to be validated. :param kwargs: kwargs containins the method's parameters. :raises: InvalidParameterValue if any parameters is invalid. """ if method == 'pass_deploy_info': # TODO(rameshg87): Don't validate deploy info if bash ramdisk # booted during cleaning. It will be handled in pass_deploy_info # method. Remove the below code once we stop supporting bash # ramdisk in Ironic. if task.node.provision_state != states.CLEANWAIT: deploy_utils.validate_capabilities(task.node) get_deploy_info(task.node, **kwargs) elif method == 'pass_bootloader_install_info': validate_pass_bootloader_info_input(task, kwargs)
def validate(self, task): """Validate the driver-specific Node deployment info. This method validates whether the properties of the supplied node contain the required information for this driver to deploy images to the node. :param task: a TaskManager instance :raises: MissingParameterValue, if any of the required parameters are missing. :raises: InvalidParameterValue, if any of the parameters have invalid value. """ if CONF.agent.manage_agent_boot: task.driver.boot.validate(task) node = task.node # Validate node capabilities deploy_utils.validate_capabilities(node) if not task.driver.storage.should_write_image(task): # NOTE(TheJulia): There is no reason to validate # image properties if we will not be writing an image # in a boot from volume case. As such, return to the caller. LOG.debug( 'Skipping complete deployment interface validation ' 'for node %s as it is set to boot from a remote ' 'volume.', node.uuid) return params = {} image_source = node.instance_info.get('image_source') image_checksum = node.instance_info.get('image_checksum') image_disk_format = node.instance_info.get('image_disk_format') os_hash_algo = node.instance_info.get('image_os_hash_algo') os_hash_value = node.instance_info.get('image_os_hash_value') params['instance_info.image_source'] = image_source error_msg = _('Node %s failed to validate deploy image info. Some ' 'parameters were missing') % node.uuid deploy_utils.check_for_missing_params(params, error_msg) if not service_utils.is_glance_image(image_source): def _raise_missing_checksum_exception(node): raise exception.MissingParameterValue( _('image_source\'s "image_checksum", or ' '"image_os_hash_algo" and "image_os_hash_value" ' 'must be provided in instance_info for ' 'node %s') % node.uuid) if os_hash_value and not os_hash_algo: # We are missing a piece of information, # so we still need to raise an error. _raise_missing_checksum_exception(node) elif not os_hash_value and os_hash_algo: # We have the hash setting, but not the hash. _raise_missing_checksum_exception(node) elif not os_hash_value and not image_checksum: # We are lacking the original image_checksum, # so we raise the error. _raise_missing_checksum_exception(node) validate_http_provisioning_configuration(node) check_image_size(task, image_source, image_disk_format) # Validate the root device hints deploy_utils.get_root_device_for_deploy(node) validate_image_proxies(node)