Product SiteDocumentation Site

Chapter 23. Migrating to KVM from other hypervisors using virt-v2v

23.1. Preparing to convert a virtualized guest
23.2. Converting virtualized guests
23.2.1. virt-v2v
23.2.2. Converting a local Xen virtualized guest
23.2.3. Converting a remote Xen virtualized guest
23.2.4. Converting a VMware ESX virtualized guest
23.2.5. Converting a virtualized guest running Windows
23.3. Running converted virtualized guests
23.4. Configuration changes
23.4.1. Configuration changes for Linux virtualized guests
23.4.2. Configuration changes for Windows virtualized guests
The virt-v2v command converts guests from a foreign hypervisor to run on KVM, managed by libvirt. The virt-v2v command can currently convert Red Hat Enterprise Linux 4, Red Hat Enterprise Linux 5, Windows Vista, Windows 7, Windows Server 2003 and Windows Server 2008 virtualized guests running on Xen, KVM and VMware ESX. The virt-v2v command enables para-virtualized (virtio) drivers in the converted guest if possible.
virt-v2v is available on Red Hat Network (RHN) in the Red Hat Enterprise Linux Server (v. 6 for 64-bit x86_64) or Red Hat Enterprise Linux Workstation (v.6 for x86_64) channel.
The virt-v2v tool requires root access to the host system.
Installing virt-v2v
To install virt-v2v from RHN, ensure the system is subscribed to the appropriate channel, then run:
yum install virt-v2v

23.1. Preparing to convert a virtualized guest

Before a virtualized guest can be converted, ensure that the following steps are completed.
  1. Create a local storage domain for transferred storage
    virt-v2v copies the guest storage to a locally defined libvirt storage pool during import. This pool can be defined using any libvirt tool, and can be of any type. The simplest way to create a new pool is with virt-manager. Select your host, right click and select details.
    Select host details
    Figure 23.1. Select host details

    Select the Storage tab.
    The storage tab
    Figure 23.2. The storage tab

    Click the plus sign (+) button to add a new storage pool.
    Adding a storage pool
    Figure 23.3. Adding a storage pool

  2. Create local network interfaces.
    The local machine must have an appropriate network to which the converted virtualized guest can connect. This is likely to be a bridge interface. A bridge interface can be created using standard tools on the host. Since version 0.8.3, virt-manager can also create and manage bridges.
  3. Specify network mappings in virt-v2v.conf. This step is optional, and is not required for most use cases.
    If your virtualized guest has multiple network interfaces, /etc/virt-v2v.conf must be edited to specify the network mapping for all interfaces. You can specify an alternative virt-v2v.conf file with the -f parameter.
    If your virtualized guest only has a single network interface, it is simpler to use the --network or --bridge parameters, rather than modifying virt-v2v.conf.
Preparing to convert a virtualized guest running Linux
Before a virtualized guest running Linux can be converted, ensure that the following steps are completed.
  1. Obtain the software
    As part of the conversion process, virt-v2v may install a new kernel and drivers on the virtualized guest. If the host running virt-v2v is registered to Red Hat Network (RHN), the required packages will be automatically downloaded. For environments where RHN is not available, the virt-v2v.conf file references a list of RPMs used for this purpose. The RPMs relevant to your virtualized guest must be downloaded manually from RHN and made available in the directory specified by the path-root configuration element, which by default is /var/lib/virt-v2v/software/. virt-v2v will display an error similar to Example 23.1, “Missing Package error” if software it depends upon for a particular conversion is not available.
    Example 23.1. Missing Package error
    virt-v2v: Installation failed because the following files referenced in the configuration file are required, but missing:
    rhel/5/kernel-2.6.18-128.el5.x86_64.rpm
    rhel/5/ecryptfs-utils-56-8.el5.x86_64.rpm
    rhel/5/ecryptfs-utils-56-8.el5.i386.rpm

    To obtain the relevant RPMs for your environment, repeat these steps for each missing package:
    1. Login to Red Hat Network
    2. Select Channels
    3. Use the Filter by Product Channel function to select the channel for the version of Red Hat Enterprise Linux running on the virtualized guest. In the case of the example shown in Example 23.1, “Missing Package error”, the channel is Red Hat Enterprise Linux Server 5.3.
    4. Select the Packages tab
    5. Use the Filter by Package function to locate the missing package
    6. Select the package exactly matching the one shown in the error message. For the the example shown in Example 23.1, “Missing Package error”, the first package is kernel-2.6.18-128.el5.x86_64
    7. Select Download Package at the bottom of the package details page
    8. Save the downloaded package to the appropriate directory in /var/lib/virt-v2v/software. For Red Hat Enterprise Linux 5, the directory is /var/lib/virt-v2v/software/rhel/5
Preparing to convert a virtualized guest running Windows
Before a virtualized guest running Windows can be converted, ensure that the following steps are completed.

Important

Virtualized guests running Windows can only be converted for output to Red Hat Enterprise Virtualization. The conversion procedure depends on post-processing by the Red Hat Enterprise Virtualization Manager for completion. See Section 23.4.2, “Configuration changes for Windows virtualized guests” for details of the process. Virtualized guests running Windows cannot be converted for output to libvirt.
  1. Obtain the Guest Tools ISO
    As part of the conversion process for virtualized guests running Windows, the Red Hat Enterprise Virtualization Manager will install drivers using the Guest Tools ISO. See Section 23.4.2, “Configuration changes for Windows virtualized guests” for details of the process. The Guest Tools ISO is obtained as follows:
    1. From the Red Hat Enterprise Virtualization Manager, Login to Red Hat Network
    2. Click on Download Software
    3. Select the Red Hat Enterprise Virtualization (x86-64) channel
    4. Select the Red Hat Enterprise Virt Manager for Desktops (v.2 x86) or Red Hat Enterprise Virt Manager for Desktops (v.2 x86) channel, as appropriate for your subscription.
    5. Download Guest Tools ISO for 2.2 and save it locally
  2. Upload the Guest Tools ISO to the Red Hat Enterprise Virtualization Manager
    Upload the Guest Tools ISO using the ISO Uploader. See the Red Hat Enterprise Virtualization for Servers Administration Guide for instructions.
  3. Ensure that the libguestfs-winsupport package is installed on the host running virt-v2v. This package provides support for NTFS, which is used by many Windows systems. If you attempt to convert a virtualized guest using NTFS without the libguestfs-winsupport package installed, the conversion will fail.
  4. Ensure that the virtio-win package is installed on the host running virt-v2v. This package provides para-virtualized block and network drivers for Windows guests. If you attempt to convert a virtualized guest running Windows without the virtio-win package installed, the conversion will fail giving an error message concerning missing files.
Preparing to convert a local Xen virtualized guest
The following is required when converting virtualized guests on a host which used to run Xen, but has been updated to run KVM. It is not required when converting a Xen guest imported directly from a running libvirt/Xen instance.
  1. Obtain the XML for the virtualized guest
    virt-v2v uses a libvirt domain description to determine the current configuration of the virtualized guest, including the location of its storage. Before starting the conversion, obtain this from the host running the virtualized guest with the following command:
    virsh dumpxml vm-name > vm-name.xml
    This will require booting into a Xen kernel to obtain the XML, as libvirt needs to connect to a running Xen hypervisor to obtain its metadata. The conversion process is optimized for KVM, so obtaining domain data while running a Xen kernel, then performing the conversion using a KVM kernel will be more efficient than running the conversion on a Xen kernel.