4.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 4.2, “Attaching an export storage domain”. virt-v2v always makes a copy of storage before conversion.
Converting a virtual machine

Figure 4.2. 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 4.3. Importing a virtual machine

4.3.1. Preparing to convert a virtual machine

Before a virtual machine can be converted, ensure that the following steps are completed:

Procedure 4.2. Preparing to convert a virtual machine

  1. Create an NFS export domain. virt-v2v can transfer the converted virtual machine directly to an NFS export storage domain. From the export storage domain, the virtual machine 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.

    Note

    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 to 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 a converted bridge will require different configuration depending on the output type (libvirt or Red Hat Enterprise Virtualization).
    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.

4.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.

Procedure 4.3. Preparing to convert a virtual machine running Linux

  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 Subscription Management (RHSM), the required packages will be automatically downloaded. For environments where Red Hat Subscription Management (RHSM) is not available, the virt-v2v.conf file references a list of RPMs used for this purpose. The RPMs relevant to your virtual machine must be downloaded manually from the Red Hat Customer Portal 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 3.1, “Missing Package error” if the software it depends upon for a particular conversion is not available.
  2. To obtain the relevant RPMs for your environment, repeat these steps for each missing package:
    1. Log in to the Red Hat Customer Portal: https://access.redhat.com/.
    2. In the Red Hat Customer Portal, select Downloads > Product Downloads > Red Hat Enterprise Linux.
    3. Select the desired Product Variant, Version, and select the Packages tab. In the Filter field, type the package name exactly matching the one shown in the error message. For the example shown in Example 3.1, “Missing Package error”, the first package is kernel-2.6.32-128.el6.x86_64
    4. A list of packages displays. Select the package name identical to the one in the error message. This opens the details page, which contains a detailed description of the package. Alternatively, to download the most recent version of a package, select Download Latest next to the desired package.
    5. 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.

4.3.1.2. Preparing to convert a virtual machine running Windows

Important

virt-v2v does not support conversion of the Windows Recovery Console. If a virtual machine has a recovery console installed and VirtIO was enabled during conversion, attempting to boot the recovery console will result in a stop error.
Windows XP x86 does not support the Windows Recovery Console on VirtIO systems, so there is no resolution to this. However, on Windows XP AMD64 and Windows 2003 (x86 and AMD64), the recovery console can be reinstalled after conversion. The re-installation procedure is the same as the initial installation procedure. It is not necessary to remove the recovery console first. Following re-installation, the recovery console will work as intended.

Important

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 7.2.2, “Configuration changes for Windows virtual machines” for details of the process.

Procedure 4.4. Preparing to convert a virtual machine running Windows

Before a virtual machine running Windows can be converted, ensure that the following steps are completed.
  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 4.1, “Error message when converting a Windows virtual machine without libguestfs-winsupport installed” will be shown:

    Example 4.1. 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 paravirtualized 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 3.3, “Error message when converting a Windows virtual machine without virtio-win installed” will be shown.
  3. Upload the guest tools ISO to the ISO Storage Domain.
    Note that the guest tools ISO is not required for the conversion process to succeed. However, it is recommended for all Windows virtual machines running on Red Hat Enterprise Virtualization. The Red Hat Enterprise Virtualization Manager installs Red Hat's Windows drivers on the guest virtual machine using the guest tools ISO after the virtual machines have been converted. See Section 7.2.2, “Configuration changes for Windows virtual machines” for details.
    Locate and upload the guest tools ISO as follows:
    1. Locate the guest tools ISO.
      The guest tools ISO is distributed using the Red Hat Customer Portal as rhev-guest-tools-iso.rpm, an RPM file installed on the Red Hat Enterprise Virtualization Manager. After installing the Red Hat Enterprise Virtualization Manager, the guest tools ISO can be found at /usr/share/rhev-guest-tools-iso/rhev-tools-setup.iso.
    2. Upload the guest tools ISO.
      Upload the guest tools ISO to the ISO Storage Domain using the ISO uploader.
      Refer to the Red Hat Enterprise Virtualization Administration Guide for more information on uploading ISO files, and installing guest agents and drivers.

4.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.

Procedure 4.5. Preparing to convert a local Xen virtual machine

  • 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 guest_name > guest_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.