Export a guest virtual machine from VMware as an OVA file and import it into KVM

Updated -

This article describes how to convert a VMware (vCenter + ESX(i)) guest to the qcow2 format and import it to the KVM hypervisor using the virt-v2v command. The VMware guest must first be exported to the Open Virtualization Format (a single .ova file) before the conversion is attempted.

For an overview of the virt-v2v tool, supported conversions, and links to other types of virtual machine conversions, see Converting Virtual Machines from Other Hypervisors to KVM with virt-v2v in RHEL 7.

Overview

The virt-v2v tool converts virtual machines from foreign hypervisors, including their disk images and metadata, for use with Red Hat Enterprise Linux KVM, Red Hat Enterprise Virtualization, and Red Hat Enterprise Linux OpenStack Platform.

This article describes how to convert a VMware (vCenter + ESX(i)) guest to the qcow2 format and import it to the KVM hypervisor using virt-v2v. The VMware guest must first be exported to the Open Virtualization Format (a single .ova file) before the conversion is attempted.

For an overview of the virt-v2v tool, supported conversions, and links to other types of virtual machine conversions, see Converting Virtual Machines from Other Hypervisors to KVM with virt-v2v in RHEL 7.

Important: virt-v2v became a supported product starting with Red Hat Enterprise Linux 7.2. Therefore, we recommend you update your virt-v2v conversion server (the machine used to convert virtual machines) to Red Hat Enterprise Linux 7.2 before proceeding with the these instructions. Conversions may not work correctly on earlier versions of Red Hat Enterprise Linux.

Prerequisites

Resource requirements

Before proceeding with the migration procedure, make sure you have (or can access) the following:

  • A Red Hat Enterprise Linux 7 physical system with:
    - Sufficient Red Hat subscriptions to access the Server RPMs packages repository
    - Sufficient Red Hat subscriptions to access the Optional RPMs packages repository
    - Sufficient Red Hat subscriptions to access the Supplementary RPMs packages repository
    - Sufficient Red Hat subscriptions to allow installation of the virt-v2v packages and their dependencies
    - Sufficient storage pool disk space and network access to store the .ova file
    - A working KVM environment
  • The name of the guest(s) to be converted
  • Reliable and verified backups

Note: Your system names will differ from those shown in this article. Modify example commands shown here to match your environment.

Example systems in this article are named as follows:

  • Red Hat Enterprise Linux 7.2 or later system - virthost1
  • Guest virtual machine to export - guestvm1

Note: The target virtual machine must be shut down/offline before exporting it to an .ova file.

Preparation

Prepare the virthost1 system

  1. Log in to the virthost1 system as the root user.

  2. Install the virt-v2v package and its dependencies:

# yum install virt-v2v

Note: For migrating VMWare guests running Microsoft Windows, you must also install the libguestfs-winsupport package.

Export the VMware guest

  1. Export the VMware guest. The method by which a VMware guest is exported varies based on your VMware product. Select the desired offline guest (guestvm1 in this article) and export its OVF template (in the File -> Export menu or similar). Make sure you select the option to export to a single .ova file. For more information, view the VMware documentation or contact your vendor.

  2. Transfer the guestvm1.ova file to the virthost1 system.

Convert and import the guest

To convert and import the guest:

# virt-v2v -i ova guestvm1.ova -o libvirt -of qcow2 -os guestpool

where:

  • guestvm1.ova is the name of the exported guest file
  • guestpool is the name of your storage pool, obtained by running the virsh pool-list command

Note: virt-v2v saves converted virtual machines to the current user's namespace. However, libvirt maintains separate namespaces for the virtual machines for each user. As a result, if virt-v2v is run as a non-root user, virt-manager will not see the converted virtual machine.

A successful conversion output looks similar to the following:

[   0.0] Opening the source -i ova guestvm1.ova
[   0.0] Creating an overlay to protect the source from being modified
[   1.0] Opening the overlay
[   4.0] Initializing the target -o libvirt -os guestpool
[   4.0] Inspecting the overlay
[  10.0] Checking for sufficient free disk space in the guest
[  10.0] Estimating space required on target for each disk
[  10.0] Converting Red Hat Enterprise Linux release 6 (Update 6) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[  14.0] Mapping filesystem data to avoid copying unused and blank areas
[  14.0] Closing the overlay
[  14.0] Copying disk 1/1 to /media/guests/guestvm1-sda (qcow2)
    (100.00/100%)
[  28.0] Creating output metadata
Pool guests refreshed

Domain guestvm1 defined from /tmp/v2vlibvirt4fe796.xml

⁠Completion

Confirm that the guest was imported correctly with the following command:

# virsh list --all

If this command lists the new Linux virtual machine, you have successfully converted and imported the guest. Boot the guest and confirm its full functionality before deleting the original guest or migrating active services.

Note: The virt-v2v tool cannot currently reconfigure a guest's network configuration. If the converted guest is not connected to the same subnet as the source, its network configuration may have to be updated. See also the virt-customize(1) man page.

Further resources

See the Red Hat Enterprise Linux 7 Virtualization Deployment and Administration Guide for more information on managing virtual machines with libvirt.

For more information on using virt-v2v to convert virtual machines, see the virt-v2v man page and http://libguestfs.org/virt-v2v.1.html.

Table of Contents

No

2 Comments

I have put the libguestfs-winsupport files here:

http://people.redhat.com/~rjones/libguestfs-winsupport/

Created a VM using vApp and installed RHEL7.4 on vCloud + vCentre. Took snapshot of the file as OVA using VMWare ovftool tool. Then created a VM on KVM environment. Executed the 'virt-v2v' to convert OVA to QCOW2 to run on OpenStack which is configured to run on KVM environment. I am getting errors as

virt-v2v: warning: could not parse ovf:Name from OVF document virt-v2v: error: source has no hard disks!

If reporting bugs, run virt-v2v with debugging enabled and include the complete output:

virt-v2v -v -x [...]

Can you please help me.