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.
Parameters: - 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.
-
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 atpath
.
-
classmethod
from_other_image
(input_image, output_dir, output_subformat=None)[source]¶ Convert the other disk image into an image of this type.
Parameters: - input_image (DiskRepresentation) – Existing image representation.
- output_dir (str) – Output directory to store the new image in.
- output_subformat (str) – Any relevant subformat information.
Raises: NotImplementedError
– Subclasses may implement this.
-
capacity
¶ Capacity of this disk image, in bytes.
-
disk_format
= None¶ Disk format represented by this class.
-
disk_subformat
¶ Sub-format of the disk, such as ‘rockridge’ or ‘streamOptimized’.
-
files
¶ List of files embedded in this disk image.
-
path
¶ System path to this disk file.
-