COT.disks.vmdk module

Handling of VMDK files.

class VMDK(path)[source]

Bases: COT.disks.disk.DiskRepresentation

VMDK disk image file representation.

classmethod from_other_image(input_image, output_dir, output_subformat='streamOptimized')[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) -- VMDK subformat string. Defaults to "streamOptimized" if unset.
Returns:

VMDK -- representation of newly created VMDK file.

Note

Creation of streamOptimized subformat VMDKs (ESXi's preferred subformat for OVAs, hence COT's default subformat) is more complex than it seems due to the underlying helpers required.

  • Prior to QEMU 2.1.0, qemu-img effectively can't write streamOptimized subformat at all (it tends to error out).
  • In QEMU 2.1.0 through 2.5.0, qemu-img supports output to streamOptimized subformat, but it outputs VMDK images declaring version 1 of the VMDK format, which newer versions of ESXi (and probably other VMware products) reject with the message "Not a supported disk format (sparse VMDK version too old)".
  • In QEMU 2.5.1 and later, qemu-img produces "version 3" VMDK images, which suffices to make ESXi happy.
  • vmdktool (any released version) also makes "version 3" VMDKs, but is less likely to be available on most user systems, and it can only convert from RAW format images to streamOptimized VMDK.

So, when creating streamOptimized VMDKs, if we have QEMU 2.5.1+, we're golden. Else, if we have vmdktool, use it, after converting the input_image to RAW format first if necessary. Else, fail back to QEMU 2.1.0+ but warn the user that the resulting image may not be usable with ESXi.

disk_format = 'vmdk'
disk_subformat

Disk subformat, such as 'streamOptimized'.