COT.disks.disk module

Abstract base class for representations of disk image files.

class DiskRepresentation(path, disk_subformat=None, capacity=None, files=None)[source]

Bases: object

Abstract disk image file representation.

__init__(path, disk_subformat=None, capacity=None, files=None)[source]

Create a representation of an existing disk or create a new disk.

  • path (str) – Path to existing file or path to create new file at.
  • disk_subformat (str) – Subformat option(s) of the disk to create (e.g., ‘rockridge’ for ISO, ‘streamOptimized’ for VMDK), if any.
  • capacity (int) – Capacity of disk to create
  • files (int) – Files to place in the filesystem of this disk.

Given parameters but not an existing file, create that file.

classmethod file_is_this_type(path)[source]

Check if the given file is image type represented by this class.

Parameters:path (str) – Path to file to check.
Returns:bool – True (file matches this type) or False (file does not match)
Raises:HelperError – if no file exists at path.
classmethod from_other_image(input_image, output_dir, output_subformat=None)[source]

Convert the other disk image into an image of this type.

  • input_image (DiskRepresentation) – Existing image representation.
  • output_dir (str) – Output directory to store the new image in.
  • output_subformat (str) – Any relevant subformat information.

NotImplementedError – Subclasses may implement this.


Capacity of this disk image, in bytes.

disk_format = None

Disk format represented by this class.


Sub-format of the disk, such as ‘rockridge’ or ‘streamOptimized’.


List of files embedded in this disk image.


System path to this disk file.