4.3. Converting a virtual machine
virt-v2vconverts 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-v2valways 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-v2vcan 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-v2vmust run as root.
NoteThe 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
nfslockservices 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.
- 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.confmust be edited to specify the network mapping for all interfaces. You can specify an alternative
virt-v2v.conffile with the
-fparameter. If you are converting to a virtual machine for output to both libvirt and Red Hat Enterprise Virtualization, separate
virt-v2v.conffiles 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
--bridgeparameters, rather than modifying
- 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
--profilerather than individually providing the
-oaparameters. See virt-v2v.conf(5) for details.
126.96.36.199. 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-v2vmay 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.conffile 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-rootconfiguration element, which by default is
virt-v2vwill 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
188.8.131.52. Preparing to convert a virtual machine running Windows
virt-v2vdoes 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.
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-winsupportIf 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-winIf 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
- 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.
184.108.40.206. 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-v2vuses 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.xmlThis 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.