Migrating xend virtual machines to xapi platform (XCP/XenServer)

Xen hypervisor has currently 3 tool stacks : xend + xm (which is now deprecated),   xl (new low level tool) and xapi+xe.   xapi is most advanced and it is used in XenServer (and XCP , but it is now also deprecated because XenServer is now open source).  Recently I have been migrating some virtual machines from Xen 4 with xend to XenServer  6.2. Below are details of migrating linux machines to new environment.

Differences between platforms

XenServer(XCP) is proving much more functionality, but for the price of much closed control on your dom0. Key differences are:

  • Different tools: xm vs xe
  • xend is using configuration files,  XenServer has an internal database, that can be manipulated by xe tool (or programmatically  via XenAPI bindings)
  • In xend I used xen-tools in Debian to create virtual machines,  XenServer has built in templates for most common OSes (plus you can create your own templates as clones of existing VMs)
  • For xend I used raw disk images as loopback devices (as provided by xen-tools). Xenserver is managing disk images itself (locally uses LVM2, but can also use shared storage).
  • Official XenServer distribution has CentOS in dom0,  I used Debian previously (but XCP can be installed to new Debian)
  • XenServer has generally more advanced, enterprise like features.

Migration steps

On old host enable NFS share – so you can easily access disk images of exiting VMs:

In XenServer dom0 you can mount share with this command:

Before migration you need to modify root fs on exiting machine – so first shut it down, then mount disk:

Now you have to do two things:

  1. Check that root file system has grub configuration /boot/grub/menu.lst. In new environment this disk might be available under slightly different name, so modify it here.   If you’re creating menu.lst from scratch, assure that it points to exiting kernel (paravirtualization enabled kernel – or you need to install new kernel before migration) and ramdisk image with root fs. So updated menu.lst should look like:

    Originally root was /dev/xvda1  in new system it’s /dev/xvda.
  2. Modify /etc/fstab on old root –  same change to root device as before.

Now you can create new VM on XenServer:

Key insight here is that size of new disk must be same as size of current VM disk image. And then import image of existing VM to new VID:

Now you should be able to boot up new machine, few final touches are needed:

  • login via console
  • modify other setups as necessary (net configuration …)
  • install XenServer tools
  • reboot

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">