ironic.common.checksum_utils module

ironic.common.checksum_utils module

ironic.common.checksum_utils.compute_image_checksum(image_path, algorithm='md5')[source]

Compute checksum by given image path and algorithm.

Parameters:
  • image_path – The path to the file to undergo checksum calculation.

  • algorithm – The checksum algorithm to utilize. Defaults to ‘md5’ due to historical support reasons in Ironic.

Returns:

The calculated checksum value.

Raises:

ValueError when the checksum algorithm is not supported by the system.

ironic.common.checksum_utils.get_checksum_and_algo(instance_info)[source]

Get and return the image checksum and algo.

Parameters:

instance_info – The node instance info, or newly updated/generated instance_info value.

Returns:

A tuple containing two values, a checksum and algorithm, if available.

ironic.common.checksum_utils.get_checksum_from_url(checksum, image_source)[source]

Gets a checksum value based upon a remote checksum URL file.

Parameters:
  • checksum – The URL to the checksum URL content.

  • image_soource – The image source utilized to match with the contents of the URL payload file.

Raises:

ImageDownloadFailed when the checksum file cannot be accessed or cannot be parsed.

ironic.common.checksum_utils.is_checksum_url(checksum)[source]

Identify if checksum is not a url.

Parameters:

checksum – The user supplied checksum value.

Returns:

True if the checksum is a url, otherwise False.

Raises:

ImageChecksumURLNotSupported should the conductor have this support disabled.

ironic.common.checksum_utils.validate_checksum(path, checksum, checksum_algo=None)[source]

Validate image checksum.

Parameters:
  • path – File path in the form of a string to calculate a checksum which is compared to the checksum field.

  • checksum – The supplied checksum value, a string, which will be compared to the file.

  • checksum_algo – The checksum type of the algorithm.

Raises:

ImageChecksumError if the supplied data cannot be parsed or if the supplied value does not match the supplied checksum value.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.