Friday, September 02, 2016

Importing Windows 2012 VMs into oVirt from VMware

 I had quite a bit of trouble importing Windows 2012 server VMs into an oVirt cluster I had. The cluster is running 4.0.2.7-1.el7, and ships with a version of virt-v2v that does not support conversion of 2012 or Windows 8. I could never get the GUI tools to connect to VMware properly (they could auth, but couldn't find the VM at the URI I specified, and this also happened with virt-v2v). I could list the VMs no problem using ovftool however. Anyway, here are the steps I used:
 
 
1. I downloaded ovftool from VMWare (a login is needed to download this). I installed it on a Linux machine with enough space for importing VMs.

2. Create an .ova file via ovftool: the VM has to be shut off when doing this. e.g.,
ovftool vi://<user>@<esxi_manager_host>/<cluster_name>/<vm_folder>/<vm_name> /path/to/vm.ova
ovftool allows you to browse the directory structure so you can build the URL as needed.

3. Once you have an .ova, you'll need to get a recent version of virt-v2v to convert it, plus the virtio-win package for RHEL 7 (I used virtio-win-1.8.0-4.el7.noarch.rpm). I also created an ISO domain on my oVirt cluster with the oVirt guest tools, as I needed to install another driver after importing the VM. I used virt-v2v-1.32.7-1.fc23.x86_64 on Fedora 23, and the later version on Fedora 24 also worked. There is also a version for RHEL 7.3 (7.3 is currently beta) which should also work.
4. I found that I could not successfully import a 2012 VM when using virt-v2v to directly export it to the export domain. It worked fine that way with 2008 and Windows 7, but failed immediately in the ovirt GUI with 2012. So what I did was use another very useful tool from the same author of virt-v2v which is designed to import a KVM image to oVirt. So I did the following to convert the ova:

# export LIBGUEST_BACKEND=direct
# virt-v2v -i ova /mnt/import-vm/w2012-test.ova -o local -os /var/tmp/v2v/ -of qcow2
This should install most of the drivers you need from /usr/share/virtio-win (from the virtio-win rpm), though it complains about /usr/share/virt-tools/rhev-apt.exe and a QXL driver as missing. These are not needed to get the VM running however.

5. Once converted, you should have a disk image in your output directory, e.g.,
/var/tmp/v2v/w2012-test-sda
6. Run 'import-to-ovirt.pl' to copy it to the export domain, e.g.,

 import-to-ovirt.pl /var/tmp/v2v/w2012-test-sda ovirt-engine:/mnt/export-vm
7. The VM should show up on the export storage and can then be imported. I found I had to install one driver from ovirt-guest-tools by attaching it to the VM.
 
Any questions, please ask and I will do my best to answer them!
 
C

No comments: