||Red Hat Enterprise Linux 6 Essentials eBook now available in PDF and ePub formats for only $9.99
RHEL 6 Essentials contains 40 chapters and over 250 pages.
Chapter 23. Migrating to KVM from other hypervisors using virt-v2v
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.
virt-v2v tool requires root access to the host system.
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.
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.
Figure 23.1. Select host details
Select the Storage tab.
Figure 23.2. The storage tab
Click the plus sign (+) button to add a new storage pool.
Figure 23.3. Adding a storage pool
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.
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
If your virtualized guest only has a single network interface, it is simpler to use the
--bridge parameters, rather than modifying
Preparing to convert a virtualized guest running Linux
Before a virtualized guest running Linux can be converted, ensure that the following steps are completed.
Obtain the software
As part of the conversion process,
may install a new kernel and drivers on the virtualized guest. If the host running
is registered to Red Hat Network (RHN), the required packages will be automatically downloaded. For environments where RHN is not available, the
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
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:
To obtain the relevant RPMs for your environment, repeat these steps for each missing package:
Login to Red Hat Network
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
Select the Packages tab
Use the Filter by Package function to locate the missing package
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
Select Download Package at the bottom of the package details page
Save the downloaded package to the appropriate directory in
/var/lib/virt-v2v/software. For Red Hat Enterprise Linux 5, the directory is
Preparing to convert a virtualized guest running Windows
Before a virtualized guest running Windows can be converted, ensure that the following steps are completed.
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.
Obtain the Guest Tools ISO
From the Red Hat Enterprise Virtualization Manager, Login to Red Hat Network
Click on Download Software
Select the Red Hat Enterprise Virtualization (x86-64) channel
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.
Download Guest Tools ISO for 2.2 and save it locally
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.
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.
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.
Obtain the XML for the virtualized guest
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.