Migrate from Xen to XenServer

Go from plain Xen to XenServer with this step-by-step guide!

Migrate from Xen to XenServer

As you may know, XenServer is now OpenSource. It brings a lot a nice features, but your existing virtual infrastructure is on older Xen? Don't panic, here is a way to migrate to the new one, without pain. This tutorial explain how to migrate from Xen 4 on Debian 6 to XenServer 6 (6.2 precisely). First thing first, some definitions:

  • xenserver1 is your new XenServer;
  • oldxen1 is your old Xen Server on Debian 6;
  • vm1 and vm2 are vm existing of oldxen1.

Prerequisite

In this article, we suppose your VM are PvOps (for Debian 6 or 5 with 2.6.32 backported kernel). They also need to be PyGrub compatible (you can see how to do that in this Debian documentation). For other distros, please read their respective doc.

Migration

So, we need to migrate those vm (vm1 & 2) from "oldxen1" to "xenserver1". You need to download a very nice Python script to do that almost automagically. You can find it here, it's xva.py. You need to put this script in your Dom0.

  • Shutdown your VM (I think you can maybe doing it almost live with snapshot, but I think it's too risky)
  • On your old dom0 (oldxen1), start the script like this (there is an help on the script, you can read it for more options):
./xva.py -c /etc/xen/vm1.cfg -n vm1 -s xenserver1 --username=root --password="mypassword"
  • see that your disk are streamed
  • when it's done, start the Vm on our XenServer
  • that's it! repeat the same operation for your others VM.

If you got this error:

ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)

You can fix it by adding --no-ssl in the end of the xva command, and everything will work!

Thanks Diego in the comments for the --no-ssl trick!

Now you can enjoy XenServer :)

Default SR

If you have an error message telling DEFAULT_SR_NOT_FOUND, please choose one on your XenServer. Follow this procedure:

  • xe sr-list
  • get the UUID of the SR you want to be the default one
  • xe pool-param-set default-SR=UUID_of_your_SR uuid=UUID_of_your_pool (use TAB for finding the last uuid, because there is only one choice)

Now you can try again to migrate your VM from old Xen to XenServer.

Other ways

  • You can copy only the system disk and manually copying files for other disks. But if you have only one big disk for your VM, it's not an option.
  • Also, you can make a "file backup" of your VM (basically a tarball), copy the tarball on a USB drive, and untar it in a pre-existing VM on XenServer side and overwrite existing files. Remember, "Everything is a file" on Linux!