def get_boot_mode(self, task): """Get the current boot mode for a node. Provides the current boot mode of the node. :param task: A task from TaskManager. :raises: IloOperationError on an error from IloClient library. :returns: The boot mode, one of :mod:`ironic.common.boot_mode` or None if it is unknown. """ return ilo_common.get_current_boot_mode(task.node)
def validate(self, task): """Validate the deployment information for the task's node. This method validates whether the 'driver_info' and/or 'instance_info' properties of the task's node contains the required information for this interface to function. :param task: A TaskManager instance containing the node to act on. :raises: InvalidParameterValue on malformed parameter(s) :raises: MissingParameterValue on missing parameter(s) """ node = task.node boot_option = deploy_utils.get_boot_option(node) try: boot_mode = ilo_common.get_current_boot_mode(task.node) except exception.IloOperationError: error = _("Validation for 'ilo-uefi-https' boot interface failed. " "Could not determine current boot mode for node " "%(node)s.") % node.uuid raise exception.InvalidParameterValue(error) if boot_mode.lower() != 'uefi': error = _("Validation for 'ilo-uefi-https' boot interface failed. " "The node is required to be in 'UEFI' boot mode.") raise exception.InvalidParameterValue(error) boot_iso = node.instance_info.get('ilo_boot_iso') if (boot_option == "ramdisk" and boot_iso): if not service_utils.is_glance_image(boot_iso): try: image_service.HttpImageService().validate_href(boot_iso) except exception.ImageRefValidationFailed: with excutils.save_and_reraise_exception(): LOG.error("UEFI-HTTPS boot with 'ramdisk' " "boot_option accepts only Glance images or " "HTTPS URLs as " "instance_info['ilo_boot_iso']. Either %s " "is not a valid HTTPS URL or is not " "reachable.", boot_iso) return self._validate_driver_info(task) if task.driver.storage.should_write_image(task): self._validate_instance_image_info(task)