Product SiteDocumentation Site

3.3. Converting a Virtual Machine

virt-v2v converts virtual machines from a foreign hypervisor to run on Red Hat Enterprise Virtualization. It automatically packages the virtual machine images and metadata, then uploads them to a Red Hat Enterprise Virtualization export storage domain. For more information on export storage domains, see Section 3.2, “Attaching an Export Storage Domain”. virt-v2v always makes a copy of storage before conversion.
Converting a virtual machine
Figure 3.5. Converting a virtual machine

From the export storage domain, the virtual machine images can be imported into Red Hat Enterprise Virtualization using the administration portal.
Importing a virtual machine
Figure 3.6. Importing a virtual machine

3.3.1. Preparing to Convert a Virtual Machine

Before a virtual machine can be converted, ensure that the following steps are completed.
  1. Create an NFS export domain. virt-v2v can transfer the converted VM directly to an NFS export storage domain. From the export storage domain, the VM can be imported into a Red Hat Enterprise Virtualization Data Center. The storage domain must be mountable by the machine running virt-v2v. When exporting to a Red Hat Enterprise Virtualization export domain, virt-v2v must run as root.

    Configure rpcbind and nfslock on NFSv2 and NFSv3 clients

    The export storage domain is accessed as an NFS share. By default, Red Hat Enterprise Linux 6 uses NFSv4, which does not require further configuration. However, for NFSv2 and NFSv3 clients, the rpcbind and nfslock services must be running on the host used to run virt-v2v. The network must also be configured to allow NFS access to the storage server. For more details refer to the Red Hat Enterprise Linux Storage Administration Guide.
  2. Specify network mappings in virt-v2v.conf. This step is optional, and is not required for most use cases.
    If your virtual machine 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 you are converting a virtual machine for output to both libvirt and Red Hat Enterprise Virtualization, separate virt-v2v.conf files should be used for each conversion. This is because the destination network bridge corresponding to the same source network bridge is usually different for libvirt and Red Hat Enterprise Virtualization output.
    If your virtual machine only has a single network interface, it is simpler to use the --network or --bridge parameters, rather than modifying virt-v2v.conf.
  3. Create a profile for the conversion in virt-v2v.conf. This step is optional. Profiles specify a conversion method, storage location, output format and allocation policy. When a profile is defined, it can be called using --profile rather than individually providing the -o, -os, -of and -oa parameters. See virt-v2v.conf(5) for details.

3.3.1.1. Preparing to convert a virtual machine running Linux

The following is required when converting virtual machines which run Linux, regardless of which hypervisor they are being converted from.
  1. Obtain the software
    As part of the conversion process, virt-v2v may install a new kernel and drivers on the virtual machine. If the virtual machine being converted is registered to Red Hat Network (RHN), the required packages will be automatically downloaded. If the virtual machine is not registered to RHN, the virt-v2v.db file ships with a list of RPMs used for this purpose. The RPMs relevant to your virtual machine must be downloaded manually from RHN and made available on the host running virt-v2v. The RPMs should be saved 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 2.1, “Missing Package error” if software it depends upon for a particular conversion is not available.
    Example 3.1. Missing Package error
    virt-v2v: Installation failed because the following files referenced in the configuration file are required, but missing:
    rhel/6/kernel-2.6.32-128.el6.x86_64.rpm
    rhel/6/ecryptfs-utils-82-6.el6.x86_64.rpm
    rhel/6/ecryptfs-utils-82-6.el6.i686.rpm

    To obtain the relevant RPMs for your environment, repeat these steps for each missing package:
    1. Login to Red Hat Network
    2. Select the Package Search tab.
    3. In the Search For field, type the package name exactly matching the one shown in the error message. For the example shown in Example 2.1, “Missing Package error”, the first package is kernel-2.6.32-128.el6.x86_64
    4. In the Where to search field, select In the following architectures and tick the x86_64 checkbox. Click Search.
    5. A list of packages displays. Click the package name identical to the one in the error message.
    6. You will be directed to the Details page, containing detailed descriptions of the package. Select Download Package at the bottom of the page
    7. Save the downloaded package to the appropriate directory in /var/lib/virt-v2v/software. For Red Hat Enterprise Linux 6, the directory is /var/lib/virt-v2v/software/rhel/6

3.3.1.2. Preparing to convert a virtual machine running Windows

Converting a Windows virtual machine with multiple drives

When converting a virtual machine running Windows with multiple drives, for output to Red Hat Enterprise Virtualization, it is possible in certain circumstances that additional drives will not be displayed by default. Red Hat Enterprise Virtualization will always add a CD-ROM device to a converted virtual machine. If the virtual machine did not have a CD-ROM device before conversion, the new CD-ROM device may be assigned a drive letter which clashes with an existing drive on the virtual machine. This will render the existing device inaccessible. The occluded disk device can still be accessed by manually assigning it a new drive letter. It is also possible to maintain previous drive letter assignment by manually changing the drive letter assigned to the new CD-ROM device, then rebooting the virtual machine.
The following is required when converting virtual machines running Windows, regardless of which hypervisor they are being converted from. The conversion procedure depends on post-processing by the Red Hat Enterprise Virtualization Manager for completion. See Section 5.2.2, “Configuration Changes for Windows Virtual Machines” for details of the process.
  1. Install the libguestfs-winsupport package on the host running virt-v2v. This package provides support for NTFS, which is used by many Windows systems. The libguestfs-winsupport package is provided by the RHEL V2VWIN (v. 6 for 64-bit x86_64) channel. Ensure your system is subscribed to this channel, then run the following command as root:
    yum install libguestfs-winsupport
    If you attempt to convert a virtual machine using NTFS without the libguestfs-winsupport package installed, the conversion will fail. An error message similar to Example 2.2, “Error message when converting a Windows virtual machine without libguestfs-winsupport installed” will be shown.
    Example 3.2. Error message when converting a Windows virtual machine without libguestfs-winsupport installed
    No operating system could be detected inside this disk image.
    
    This may be because the file is not a disk image, or is not a virtual machine
    image, or because the OS type is not understood by virt-inspector.
    
    If you feel this is an error, please file a bug report including as much
    information about the disk image as possible.

  2. Install the virtio-win package on the host running virt-v2v. This package provides para-virtualized block and network drivers for Windows guests. The virtio-win package is provided by the RHEL Server Supplementary (v. 6 64-bit x86_64) channel. Ensure your system is subscribed to this channel, then run the following command as root:
    yum install virtio-win
    If you attempt to convert a virtual machine running Windows without the virtio-win package installed, the conversion will fail. An error message similar to Example 2.3, “Error message when converting a Windows virtual machine without virtio-win installed” will be shown.
    Example 3.3. Error message when converting a Windows virtual machine without virtio-win installed
    virt-v2v: Installation failed because the following files referenced in the configuration file are required, but missing: /usr/share/virtio-win/drivers/i386/Win2008

  3. Upload the Guest Tools ISO to the Red Hat Enterprise Virtualization Manager
    Note that the Guest Tools ISO is not required for the conversion process to succeed. However, it is recommended for all virtual machines running on Red Hat Enterprise Virtualization. The Manager installs drivers on the guest using the Guest Tools ISO after the virtual machines have been converted. See Section 5.2.2, “Configuration Changes for Windows Virtual Machines” for details.
    The Guest Tools ISO is obtained as follows:
    1. From the Manager, login to Red Hat Network.
    2. Click on the Download Software tab.
    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 Servers (v.2 x86) channel, as appropriate for your subscription.
    5. Download Guest Tools ISO for 2.2 and save it locally.
    6. Upload the Guest Tools ISO using the ISO Uploader. See the Red Hat Enterprise Virtualization Administration Guide for instructions.

3.3.1.3. Preparing to convert a local Xen virtual machine

The following is required when converting virtual machines on a host which used to run Xen, but has been updated to run KVM. It is not required when converting a Xen virtual machine imported directly from a running libvirt/Xen instance.
  1. Obtain the XML for the virtual machine
    virt-v2v uses a libvirt domain description to determine the current configuration of the virtual machine, including the location of its storage. Before starting the conversion, obtain this from the host running the virtual machine 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.