Building a QEMU VM from an OVA File
There are many occasions in which it is more convenient to use a preinstalled virtual machine than it is to perform an installation and set up an environment by hand. The Open Virtualization Archive (OVA) format is commonly used for distributing virtual appliances.
The OVA Format
To be precise, the actual format for making virtual machines portable between systems is the Open Virtualization Format (OVF). OVF is an XML-based specification that describes the configuration settings for a given virtual machine. The disk image(s) for that virtual machine may be distributed with the OVF file, creating what is typically called a “virtual appliance.” The OVF standard permits the disk images and OVF file to be packaged together inside a tar archive, creating an Open Virtualization Archive (OVA) file.1
Extracting an OVA File
To convert a virtual machine from OVA format, it is first necessary to extract the files that the OVA file contains. On the Linux command line, this can be done using the tar command, like this:
tar xvf some_virtual_machine.ova
Inside the OVA archive, you will find an OVF file and a VMDK file. The VMDK file is normally in a “stream” format that is not suitable for direct use with a virtual machine. Instead, it should be converted to qcow2 format with qemu-img:
qemu-img convert -f vmdk -O qcow2 input.vmdk output.qcow2
Reading the OVF File
To figure out what to put in the qemu-system- command to match the original VM configuration, you have to read the OVF file and do a little research. The OVF file is just an XML file that specifies the virtual machine configuration. Some trial and error is usually required to get the converted virtual machine to boot properly in QEMU.
Automating the Process
The virt-v2v command provided by libguestfs may be able to perform conversions from OVA format to QEMU commands more easily than doing them by hand. I have not yet tested this tool extensively.