# 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.

{% tabs %}
{% tab title="None" %}

```none
❯ 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
```

{% endtab %}
{% endtabs %}

### 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.

{% tabs %}
{% tab title="None" %}

```none
❯ 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
```

{% endtab %}
{% endtabs %}

### 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.

{% tabs %}
{% tab title="Ubuntu" %}

```none
❯ sudo apt update
❯ sudo apt install qemu-utils
{% endtab %}
{% tab language="none" title="RHEL" %}
❯ sudo yum repolist
❯ sudo yum install qemu-img
{% endtab %}
{% tab language="none" title="Mac" %}
❯ brew install qemu
```

{% endtab %}
{% endtabs %}

### 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.

{% tabs %}
{% tab title="None" %}

```none
❯ 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
```

{% endtab %}
{% endtabs %}

## Additional Information

* [OpenStack Images](https://platform9.com/docs/openstack/images-images)
* [OpenStack Images - Supported Types and Formats](https://platform9.com/docs/latest/openstack/images-supported-types-formats)
* [auto$](https://github.com/platform9/pcd-docs-gitbook/blob/main/openstack/glance-image-not-discovered-in-openstack/README.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform9.com/kb/pmo/how-to/convert-ova-image-to-supported-format.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
