Move a guest from VMWare ESX to oVirt or RHEV

When working in an environment where you have both a VMWare hypervisor and an oVirt or RHEV hypservisor or you want to migrate away from VMWare ESX to oVirt or RHEV, you will need a way to move or copy your current virtual machines from one to another. Unfortunately this can’t be done without downtime but at least it can be done. In this post I’ll try to explain how to successfully move a VM running on ESX or vCenter to an oVirt or Red Hat Enterprise Virtualization host.

Unfortunately, moving a guest from VMWare to oVirt can’t be done without downtime. The guest needs to be shut down before we can start copying it away from the VMWare environment. An option is to first take a clone of the currently running machine in VMWare and to move the clone to oVirt. After the clone is successfully moved, you can shut down the original VM and boot the new one. Using this practice, you can minimize the downtime but you need to be aware that changes in the VM since the moment you took the clone are lost.

Preparation of the oVirt host

Create an export storage domain:

When copying a VM from VMWare to oVirt, the data of the VM will first be copied on an export domain. After the copy, we can import the VM in oVirt from this export domain. So before we can copy something, we’ll need an export domain available on our oVirt host.

Start by creating an NFS-share with sufficient space:

As you can see in the above output, I created a directory for my mountpoint, made vdsm owner and mounted an LVM on the mountpoint. After mounting, I exported the mount by adding a line in /etc/exports.

Now that we have our NFS-share, we can add the storage domain, as type export to the oVirt-host. Navigate to System -> Data Centers -> Default (or your data center name) -> Storage -> New Domain and enter the details valid for your environment:

ovirt_add_export

After adding the domain, it needs to be activated. Navigate to System -> Data Centers and select your data center name from the list. Select the new export domain and click on “Activate”:

ovirt_activate_export

Now, the export domain is ready to be used.

Install virt-v2v:

To convert the VM from the format that is used by VMWare and the format used by oVirt, we need to install the package virt-v2v:

Configure a ~/.netrc:

The last thing to do before we can start the migration, is to create a ~/.netrc file. This file will contain the credentials needed to authenticate at the VMWare ESX or vCenter server. Al tough not very common anymore, .netrc is a standard file to contain login information.

Make sure that the ~/.netrc file has mode 600 for permissions.

Preparation of the virtual machine

For a Linux VM, there is no real need to prepare the VM. After conversion and importing the VM you should remove the vmware guest tools and install the ovirt-agent but the virtio drivers should be present in any fairly recent kernel.

For a Windows VM, there could be issues with missing virtio drivers so it’s a good idea to install them before doing the migration to oVirt. You can find the drivers here: http://alt.fedoraproject.org/pub/alt/virtio-win/latest/. The same applies as for the Linux guest: after the migration: remove the vmware-tools.

Copy the virtual machine to oVirt

Now that all preparations are done, we can start the actual copy and convert our VMWare VM to a working VM in oVirt:

When executing this command, the credentials specified in the ~/.netrc file will be used to authenticate at the VMWare ESX host or vCenter. The option -o rhev makes clear that the target format will be RHEV or oVirt and the network parameter should match to the same network that the VM has in VMWare.

During the copy you should see a simple progress-indicator. Performance is comparable to a copy over NFS.

After copying and converting the VM from the VMWare environment to the oVirt export domain, we need to import the VM in oVirt. Navigate to System -> Data Centers -> Default (or your data center name) -> Storage and select the export domain from the list. In the bottom pane, choose the “VM import” tab, select the VM which we just exported and click on “Import”:

After the import, we can boot the VM without issues. We only need to check the network settings and we’re ready to go.

Torubleshooting:

In case you get the following message:

Make sure to remove the IDE cdrom drive or any other virtual IDE device in the VMWare virtual machine configuration.

 

In case you get the following message:

This seems to be a compatibility problem between changes in packages that aren’t applied everywhere. A workaround for me was to set the LIBVUESTFS_ATTACH_METHOD to appliance:

 

Unfortunately it’s not possible to live migrate VM’s so this message should be clear:

8 thoughts on “Move a guest from VMWare ESX to oVirt or RHEV

  1. Thank you so much for useful tutorial, can you suggest please how to manage the issue with ssh on a VM that does not work from on the vmware?

    • Do I understand correct that you want to connect to a VM running on ESX from the ESX cli over SSH?

  2. No, I am running an ovirt and ovirt host with VM on the vmware workstation, and I could connect via ssh to the ovirt host, but not to ovirt host VM that I have deployed, it does not work is a bug of vmware ?

    • I’m afraid that’s a problem from a complete different nature. You probably have some issues with NAT or your bridge setup in your oVirt host. It’s also possible that your physical network connection doesn’t allow all those different MAC-addresses and bridging.

      Part of the problem is probably that you’re running nested hypervisors (VMware WS + oVirt). It’s always tricky in regards to networking…

Leave a Reply

Your email address will not be published. Required fields are marked *