The ironic_python_agent.extensions.standby Module

class ironic_python_agent.extensions.standby.ImageDownload(image_info, time_obj=None)[source]

Bases: object

Helper class that opens a HTTP connection to download an image.

This class opens a HTTP connection to download an image from a URL and create an iterator so the image can be downloaded in chunks. The MD5 hash of the image being downloaded is calculated on-the-fly.

md5sum()[source]

Computes and returns the md5 checksum of the downloaded image.

Note that md5sum will not return the true checksum of the image until the download has been fully completed through this object’s iterator inferface.

Returns:The md5 checksum of the image as a string in hexadecimal.
class ironic_python_agent.extensions.standby.StandbyExtension(agent=None)[source]

Bases: ironic_python_agent.extensions.base.BaseAgentExtension

Extension which adds stand-by related functionality to agent.

cache_image(**command_params)[source]

Asynchronously caches specified image to the local OS device.

Parameters:
  • image_info – Image information dictionary.
  • force – Optional. If True forces cache_image to download and cache image, even if the same image already exists on the local OS install device. Defaults to False.
Raises:

ImageDownloadError if the image download fails for any reason.

Raises:

ImageChecksumError if the downloaded image’s checksum does not match the one reported in image_info.

Raises:

ImageWriteError if writing the image fails.

power_off(**command_params)[source]

Powers off the agent’s system.

prepare_image(**command_params)[source]

Asynchronously prepares specified image on local OS install device.

In this case, ‘prepare’ means make local machine completely ready to reboot to the image specified by image_info.

Downloads and writes an image to disk if necessary. Also writes a configdrive to disk if the configdrive parameter is specified.

Parameters:
  • image_info – Image information dictionary.
  • configdrive – A string containing the location of the config drive as a URL OR the contents (as gzip/base64) of the configdrive. Optional, defaults to None.
Raises:

ImageDownloadError if the image download encounters an error.

Raises:

ImageChecksumError if the checksum of the local image does not match the checksum as reported by glance in image_info.

Raises:

ImageWriteError if writing the image fails.

Raises:

InstanceDeployFailure if failed to create config drive. large to store on the given device.

run_image(**command_params)[source]

Runs image on agent’s system via reboot.

sync(**command_params)[source]

Flush file system buffers forcing changed blocks to disk.

Raises:CommandExecutionError if flushing file system buffers fails.