The virt-v2v tool converts virtual machines, including their disk images and metadata, from foreign hypervisors for use with Red Hat Enterprise Linux with KVM managed by libvirt, Red Hat Virtualization, and Red Hat OpenStack Platform.
This article provides instructions for converting and importing a Red Hat Enterprise Linux virtual machine from a Xen hypervisor to run on Red Hat Enterprise Linux 7 KVM and Red Hat Enterprise Linux 8 KVM.
For an overview of the virt-v2v tool, supported conversions, and links to other types of virtual machine conversions, see Converting Virtual Machines from Other Hypervisors to KVM with virt-v2v in RHEL 7 and RHEL 8.
On successful completion of the conversion process, virt-v2v creates a new libvirt domain XML file for the converted VM with the same name as the original VM. The VM can be started using libvirt tools, such as virt-manager or virsh.
Note: If virt-v2v is run as a non-root user, the virt-manager application will not detect the converted VM. This is because virt-v2v saves converted VMs to the current user's namespace, but libvirt maintains separate namespaces for the VMs for each user.
Ensure that the virtual machine is stopped prior to running the conversion process.
The following minimum system resources must be available:
- Minimum network speed 1Gbps
- Disk space: sufficient space to store the VM's disk image, plus 1 GB
- Sufficient free space in the VM's file system according to the following table:
|File system||Minimum free space|
|Root file system||20 MB|
|Every other mountable file system||10 MB|
Install the virt-v2v packages and their dependencies:
# yum install virt-v2v
Configure password-less SSH access to the remote Xen host from the virt-v2v conversion server.
# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/username/.ssh/id_rsa): # ssh-agent SSH_AUTH_SOCK=/tmp/ssh-36jmUA3rn2JS/agent.24318; export SSH_AUTH_SOCK; SSH_AGENT_PID=24319; export SSH_AGENT_PID; echo Agent pid 24319; # SSH_AUTH_SOCK=/tmp/ssh-36jmUA3rn2JS/agent.24318; export SSH_AUTH_SOCK; # SSH_AGENT_PID=24319; export SSH_AGENT_PID; # echo Agent pid 24319; Agent pid 24319 # ssh-add Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
LIBGUESTFS_BACKEND=direct environment variable on the conversion server.
# export LIBGUESTFS_BACKEND=direct
Add your SSH public key to the /root/.ssh/authorized_keys file on the Xen host.
# ssh-copy-id firstname.lastname@example.org /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys email@example.com's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'firstname.lastname@example.org'" and check to make sure that only the key(s) you wanted were added.
Test the SSH configuration:
# ssh email@example.com Last login: Tue Nov 1 14:39:21 2016 from ovpn-123-45.brq.redhat.com
If SSH has been configured successfully, the conversion server logs you in to the Xen host and does not request any password.
To convert a Xen Linux virtual machine, use the following command, and replace:
- testguest with the intended name for the converted VM
- $pool with the storage pool that the converted VM should use
- $format with the disk format the converted VM should use, such as qcow2 or raw
# virt-v2v -ic 'xen+ssh://firstname.lastname@example.org' testguest -os $pool -of $format
For a list of virt-v2v parameters, see the virt-v2v man page.
Observe the conversion progress. The following example shows the progress of virt-v2v converting a Red Hat Enterprise Linux 5 virtual machine running on a Xen host:
# virt-v2v -ic "xen+ssh://email@example.com" -os default rhel5-para -of raw [ 0.0] Opening the source -i libvirt -ic xen+ssh://root@xen-sample-host. com rhel5-para [ 0.0] Creating an overlay to protect the source from being modified [ 0.0] Opening the overlay [ 69.0] Initializing the target -o libvirt -os default [ 69.0] Inspecting the overlay [ 80.0] Checking for sufficient free disk space in the guest [ 80.0] Estimating space required on target for each disk [ 80.0] Converting Red Hat Enterprise Linux Server release 5.11 to run on KVM virt-v2v: This guest has virtio drivers installed. [ 136.0] Mapping filesystem data to avoid copying unused and blank areas [ 137.0] Closing the overlay [ 137.0] Checking if the guest needs BIOS or UEFI to boot [ 137.0] Copying disk 1/1 to /var/lib/libvirt/images/rhel5-para-sda (raw) (100.00/100%) [ 599.0] Creating output metadata Pool default refreshed Domain rhel5-para defined from /tmp/v2vlibvirt8e77ed.xml [ 599.0] Finishing off
Confirm that the VM has been imported correctly:
# virsh list --all
If this command lists the new Linux virtual machine, you have successfully converted and imported the VM. Boot the VM and confirm its full functionality before deleting the original VM or migrating active services.
- Currently, virt-v2v cannot directly access a Xen VM, or any VM located remotely over SSH, if that VM’s disks are located on host block devices. To work around this problem, copy the VM over to the conversion server using the separate virt-v2v-copy-to-local tool. For more information about block devices, see the virt-v2v man page. (BZ# 1283588)
For more information on managing virtual machines with libvirt in RHEL 7, see the Red Hat Enterprise Linux 7 Virtualization Deployment and Administration Guide.
For more information on managing virtual machines with libvirt in RHEL 8, see Configuring and Managing Virtualization.
For more information on using virt-v2v to convert virtual machines, you can see the following articles:
- Converting a VMware vCenter Linux virtual machine to KVM
- Converting a VMware vCenter Windows virtual machine to KVM
- Converting VMware guests to import to Red Hat OpenStack Platform
- Exporting a guest virtual machine from VMware as an OVA file and importing it into KVM
In addition, you can refer to the virt-v2v man page and the virt-v2v upstream documentation.