Sunday, 28 February 2010

Migrating Virtual Machines from Xenserver to Hyper-V

For a particular project I have recently been looking at migrating a number of current Xen virtual machines to Microsoft's Hyper-V offering. Although this should have been easy, it turned out to be far from this, and I therefore thought it would be worth documenting it for future use. It is a bit of a rough and quick post, so apologies for that, but hopefully it will benefit somebody.

Starting off, Hyper-V does not allow the import of either the Citrix .xva format or the .ovf format. This means you have to use the Citrix project Kensho tool. I did quite a bit of research but could not find any other tool or any other way of doing it. Although it looks easy, Kensho has a few requirements and gotcha's which will probably be resolved in future versions (I used version 1.3). Provided you stick to the documentation (which I did the second time around after abject failure the first time) the process should be easy and intuitive. Just remember to turn off all firewalls and to enable WinRM on your Hyper-V servers. You will need to run around 5 commands to do this and to allow access from the Kensho install.

Once this is done the process of migration should have been straightforward, and for Windows VM's it was. For RedHat Linux ones (5.3) however, it was a completely different story.

Although each Linux VM is likely to be different, the following bits helped me:
  1. Install a stock kernel and once you have booted from this, remove Xen specific kernels
  2. Remove Xen tools before migrating
  3. Migrate and boot
  4. If your Linux VM hangs on boot, restore /etc/inittab to a default one to make sure the console settings are correct. If you cannot get into your VM mount the install CD and boot into "Linux rescue" mode. Your root file system should be auto mounted for you and you should have a subset of tools available to edit configuration files.
  5. Install Hyper-V integration components (copy files onto the box into a writeable location, important! and run the install script)
  6. At this point my VM refused to boot again, until I remove the following argument from /etc/grub.conf ----- hda=noprobe hdb=noprobe
  7. Edit network settings, your new network adapter will be called ifcfg-seth0.
  8. Now all is well and my migrated VM can participate in the Hyper-V cluster. Make sure you have a fixed MAC address rather than a dynamically generated one, you can change this in the VM settings in Hyper-V manager.
Although this is by no means a complete guide I hope it provides you with some pointers of issues you can run into, drop me a line if any of these need clarification and I will see if I can help. All in all it is a bit of a pain and you have to wonder how much trust you can have in the stability of your migrated VM. In our case it might be easier to rebuild them with a 64-bit OS to make use of the additional memory we will have available on our VM platform.

0 comments:

Post a Comment