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.
Figure 4.2. Converting a virtual machine
Figure 4.3. Importing a virtual machine
4.3.1. Preparing to convert a virtual machine
Procedure 4.2. Preparing to convert a virtual machine
- 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 runningvirt-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, therpcbind
andnfslock
services must be running on the host used to runvirt-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. - 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 alternativevirt-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, separatevirt-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 modifyingvirt-v2v.conf
. - 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
Procedure 4.3. Preparing to convert a virtual machine running Linux
- 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, thevirt-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 thepath-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. - To obtain the relevant RPMs for your environment, repeat these steps for each missing package:
- Log in to the Red Hat Customer Portal: https://access.redhat.com/.
- In the Red Hat Customer Portal, select Downloads > Product Downloads > Red Hat Enterprise Linux.
- 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
- 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.
- 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.
Important
Procedure 4.4. Preparing to convert a virtual machine running Windows
- 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.
- 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. - 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:
- 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
. - 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
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.