ovf-export, open-source tool for exporting libvirt domains as OVF/OVA

by Prapattimynk, Sunday, 17 September 2023 (6 months ago)
ovf-export, open-source tool for exporting libvirt domains as OVF/OVA

Today I’m releasing ovf-export, a tool for exporting libvirt domains as OVF/OVA, as open-source.
Generated packages follow the OVF 1.0 standard so that you can use them with VirtualBox, VMware Workstation/Player, and others.

OVF is the acronym of Open Virtualization Format, an open standard for packaging and distributing virtual machines (or “virtual appliances”).
The standard is developed by Distributed Management Task Force.

An OVF distribution is a directory that contains:

  • an OVF file, which defines the virtual machine/appliance
  • optionally, a manifest with SHA1/SHA256 hashes for all files
  • optionally, a digital signature for the whole package
  • additional files, like disk resources, ISO images, etc

The “OVF file” is an XML document (with the .ovf extension) with a “standard” section plus custom/proprietary tags. The “standard” section is sufficient for describing a VM with attributes that can be found in any hypervisor (like vCPUs, RAM, etc.), while hypervisors can use the proprietary section to describe specific attributes (for example, VirtualBox-specific configurations).

An OVA is an “all-in-one-file” OVF distribution: it’s built by creating a tar archive that contains the same file as the OVF directory, in that specific order (see list above). An OVA can be convenient to distribute.

Currently, major hypervisors support importing/exporting OVF/OVA.

Sometimes I prepare virtual machines for my lab. Exporting these VMs in OVA is helpful for me and others (one single file to upload/download, no constraints on hypervisor).

Unluckily, I use libvirt (KVM), which doesn’t support OVF/OVA at all, and sometimes Proxmox (KVM), which supports importing OVF but not exporting it. Meet ovf-export.

The ovf-export tool can export a libvirt domain as OVF/OVA, and the OVF/OVA can be successfully imported in VirtualBox and VMware Workstation (I was able to do tests only with these two). I’m working on a branch that will support Proxmox. In both cases, you should launch this tool in the same local machine as libvirt/Proxmox – I may implement a remote option in the future.

$ ovf-export -list
UUID                                    Name
0962a56e96144bdd99bd83418c3e425a        debian10
61290c324b744d9095c6023520ddf72d        openindiana
e7904362d30b4179977804d073f070b4        win10

$ ovf-export -id 0962a56e96144bdd99bd83418c3e425a -output ~/debian10ovf -ova

The source code for this tool is available at https://gitlab.com/Enrico204/ovf-export . If you have Go, you can download and build the tool with go install:

$ go install gitlab.com/enrico204/ovf-export/cmd/ovf-export@latest

Also, the code comes with an ovf package that can generate arbitrary OVF files. Unfortunately, due to a bug/limit in the Go encoding/xml package, the same ovf package cannot be used to parse an OVF file.

Feel free to propose patches 🙂


Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

AdBlocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.