API for abstract access to third-party helper tools.
Abstracts away operations that require third-party helper programs, especially those that are not available through PyPI.
The actual helper programs are provided by individual classes in this package.
||Convert the given disk image to the requested format/subformat.|
||Create a new disk image at the requested location.|
||Get the checksum of the given file.|
||Get the storage capacity of the given disk image.|
||Get the disk image format of the given file.|
convert_disk_image(file_path, output_dir, new_format, new_subformat=None)¶
Convert the given disk image to the requested format/subformat.
If the disk is already in this format then it is unchanged; otherwise, will convert to a new disk in the specified output_dir and return its path.
Current supported conversions:
- .vmdk (any format) to .vmdk (streamOptimized)
- .img to .vmdk (streamOptimized)
- file_path (str) – Disk image file to inspect/convert
- output_dir (str) – Directory to place converted image into, if needed
- new_format (str) – Desired final format
- new_subformat (str) – Desired final subformat
file_path, if no conversion was required
- or a file path in
output_dircontaining the converted image
new_subformatare not supported conversion targets.
create_disk_image(file_path, file_format=None, capacity=None, contents=)¶
Create a new disk image at the requested location.
contentsor both must be specified.
- file_path (str) – Desired location of new disk image
- file_format (str) – Desired image format (if not specified, this will
be derived from the file extension of
- capacity – Disk capacity. A string like ‘16M’ or ‘1G’.
- contents (list) – List of file paths to package into the created image. If not specified, the image will be left blank and unformatted.
Get the checksum of the given file.
- path_or_obj (str) – File path to checksum OR an opened file object
- checksum_type (str) – Supported values are ‘md5’ and ‘sha1’.
String containing hexadecimal file checksum
Get the storage capacity of the given disk image.
Parameters: file_path (str) – Path to disk image file to inspect Returns: Disk capacity, in bytes
Get the disk image format of the given file.
file_pathrefers to a file which is not a disk image at all, this function will return
Parameters: file_path (str) – Path to disk image file to inspect. Returns:
None, or various strings for