Convert OVA Image to Supported Format

Problem

The OVA format is not supported by Platform9 Managed OpenStack's image catalogue.

OVA images may be converted into a supported format.

Environment

  • Platform9 Managed OpenStack - All Versions

Procedure

The OVA file is a TAR archive containing an OVF file, one or more disk image files, and optional manifest files.

Step 1: Extract the contents of the OVA file.

❯ ls
ubuntu-18.04-UOI-Physics-v1.2.ova

❯ file ubuntu-18.04-UOI-Physics-v1.2.ova
ubuntu-18.04-UOI-Physics-v1.2.ova: POSIX tar archive

❯ tar -xvf ubuntu-18.04-UOI-Physics-v1.2.ova
x ubuntu-18.04-UOI-Physics-v1.2.ovf
x ubuntu-18.04-UOI-Physics-v1.2-disk001.vmdk
x ubuntu-18.04-UOI-Physics-v1.2.mf

Step 2: Inspect the disk image file(s)

  • If multiple disks, identify which disk is to be used as an image.

  • Identify the disk image file format.

In this example, the disk image is .vmdk format.

The .vmdk format is supported by PMK on VMware vSphere hypervisors, but not KVM hypervisors. To work on KVM hypervisors, the .vmdk image file will need to be converted to QCOW2.

❯ ls
ubuntu-18.04-UOI-Physics-v1.2-disk001.vmdk ubuntu-18.04-UOI-Physics-v1.2.mf ubuntu-18.04-UOI-Physics-v1.2.ova ubuntu-18.04-UOI-Physics-v1.2.ovf

❯ file ubuntu-18.04-UOI-Physics-v1.2-disk001.vmdk
ubuntu-18.04-UOI-Physics-v1.2-disk001.vmdk: VMware4 disk image

Step 3: Install qemu-img - QEMU disk image utility

The QEMU disk image utility, qemu-img, is required to convert the image format. If not already installed, install qemu-img on your workstation of choice.

❯ sudo apt update
❯ sudo apt install qemu-utils
❯ sudo yum repolist
❯ sudo yum install qemu-img
❯ brew install qemu

Step 4: Convert the image format to QCOW2.

  • To verify supported formats, execute qemu-img -h | grep "Supported formats".

  • To ensure the image is recognized by PMO Glance, the .img extension will be used.

  • The newly created image may now be placed to PMO Glance host's Glance Images directory.

❯ qemu-img convert -O qcow2 ubuntu-18.04-UOI-Physics-v1.2-disk001.vmdk ubuntu-18.04-UOI-Physics-v1.2.img

❯ qemu-img info ubuntu-18.04-UOI-Physics-v1.2.img
image: /home/testuser/ubuntu-18.04-UOI-Physics-v1.2.img
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 4.5G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false

Additional Information