Converting a VMware vCenter Windows virtual machine to KVM

Updated -

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 provides instructions for converting a Windows virtual machine from a VMware vCenter hypervisor to run on Red Hat Enterprise Linux 7 KVM and Red Hat Enterprise Linux 8 KVM.

Note that on Red Hat Enterprise Linux 7, Windows guest virtual machines are supported only under specific subscription programs, such as Advanced Mission Critical (AMC).

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 and RHEL 8.

Prerequisites

Resource requirements

To convert a guest virtual machine with virt-v2v, your system must have at minimum:

  • Network bandwidth: minimum 1Gbps
  • Disk space: sufficient space to store the guest as a file, plus 1 GB
  • Sufficient free space in the guest filesystem according to the following table:
File system Minimum free space
Root file system or c:\ 20 MB
Every other mountable file system 10 MB

Preparation

virt-v2v must be run on a Red Hat Enterprise Linux 64-bit host system. In addition to the standard virt-v2v package, it is recommended that you install the virtio-win package for Windows virtual machines. This package provides the VirtIO drivers in the virtual machine, which enable faster guest performance.

To set up virt-v2v on a Red Hat Enterprise Linux 7 or Red Hat Enterprise Linux 8 host system, install the virt-v2v and virtio-win packages and their dependencies:

# yum install virt-v2v virtio-win

Important:

  • Ensure that the virtual machine is stopped prior to running the conversion process. In addition, remove the VMWare Tools program from the guest.
  • If attempting to convert a Windows 7 or a Windows Server 2008 R2 virtual machine (VM) using the virt-v2v utility, the support for SHA-2 signing certificates must be applied to the VM. For instructions to do so, see Microsoft Security Advisory 3033929. If SHA-2 support is not applied, the converted VM will not work properly.

Conversion

When converting a Windows guest, the conversion process is split into two stages:
1. Offline conversion
2. First boot

Offline conversion

To convert a VMware Windows virtual machine:

# virt-v2v -ic vpx://vcenter.example.com/Datacenter/esxi guestvm1

where vcenter.example.com/Datacenter/esxi is the path to the VMWare vCenter and guestvm1 is the name of the guest virtual machine to convert.

Note: If the vpx username contains a backslash character (such as DOMAIN\USER), it is necessary to enter a URI escape for the character: DOMAIN%5cUSER. Similarly, spaces in the Datacenter name must be entered using the %20 code.

For a full list of virt-v2v parameters, see the virt-v2v man page.

Authenticating to the VMware vCenter server

Connecting to the VMware vCenter server requires authentication. virt-v2v supports password authentication when connecting to VMware vCenter. The password can be entered during conversion, or by using the --password-file option.

Connecting to a VMware vCenter server without a vCenter CA certificate

When the VMware vCenter server is not configured with a valid vCenter CA certificate, for example if it uses a self-signed certificate, connecting to the server will fail. In this case, certificate checking can be explicitly disabled by adding ?no_verify=1 to the connection URI as shown below:

... -ic esx://esx.example.com?no_verify=1 ...

First boot

When the offline conversion is complete, the converted guest does not yet have all necessary drivers installed to work correctly. These will be installed automatically the first time the guest boots.

Important

Do not interrupt the automatic driver installation process when logging in to the guest for the first time, because this may prevent the guest from subsequently booting correctly.

⁠Completion

On successful completion, virt-v2v creates a new libvirt domain XML file for the converted virtual machine with the same name as the original virtual machine. The virtual machine can be started using libvirt tools, such as virt-manager or virsh.

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:

# virt-v2v -ic 'vpx://username@esx.example.com/Datacenter/esxi/?no_verify=1' "windows_vm" -o local -os /conversions/ 2>&1 | tee /var/log/v2voutput.log
[   0.0] Opening the source -i libvirt -ic vpx://username@esx.example.com/Datacenter/esxi/?no_verify=1 windows_vm
Enter administrator's password for username@esx.example.com:
Enter host password for user 'administrator':
[  16.0] Creating an overlay to protect the source from being modified
[  18.0] Opening the overlay
[  50.0] Initializing the target -o local -os /conversions/
[  50.0] Inspecting the overlay
[ 511.0] Checking for sufficient free disk space in the guest
[ 511.0] Estimating space required on target for each disk
[ 511.0] Converting Windows 7 Enterprise to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 548.0] Mapping filesystem data to avoid copying unused and blank areas
[ 556.0] Closing the overlay
[ 556.0] Copying disk 1/1 to /conversions/windows_vm (raw)
[ 670.0] Creating output metadata
[ 670.0] Finished off

In addition, confirm that the guest was imported correctly with the following command:

# virsh list --all

If this command lists the new Windows 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

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

For more information on managing virtual machines with libvirt in RHEL 7, see the Red Hat Enterprise Linux 7 Virtualization Deployment and Administration Guide.

For more information on managing virtual machines with libvirt in RHEL 8, see Configuring and Managing Virtualization.

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.