Feb 092014
 

One of the great features of a hypervisor management suite like XenServer is the ability to migrate a running VM from one physical host to another without affecting running services on that VM. This allows you to balance VMs appropriately across your hypervisors, as well as evacuate a hypervisor so it’s safe to perform maintenance. Doing this migration through the GUI gives you a step-by-step wizard to help set up appropriate options. For my needs, though, it’s got to be automated via the API.

Migrating a VM vs Migrating Storage + VM
There are two types of “live migration” in XenServer. The first type, XenMotion, migrates only the VM itself (that is, the contents of memory, plus misc other VM metadata about the running system). This feature requires that the disks for the VM are on shared storage (NFS, iSCSI, etc) that is accessible to both hypervisors. The second type, Storage XenMotion, migrates the running VM (memory, metadata), and also migrates any disks attached to the VM. This method takes considerably longer (since there is quite a bit more data to transfer), but means that during normal operation of the VM (ie not during a migration), you get the performance benefit of local storage. For more details, have a look at this document from Citrix comparing these two options. I’m not using shared storage, so Storage XenMotion is what I’ll use.

Storage XenMotion
I have a pool with two XenServer boxes, and a VM (“centos_base”) running on the first box. I want to migrate it to the second host, but there are several steps to this process:

  1. Identify the VM to migrate
  2. Identify the destination host
  3. For each VDI (Virtual DIsk) attached the VM, chose which SR (Storage Repository) on the destination should receive it
  4. Chose which network to transfer the disk over
  5. Prepare the destination to receive the transfer
  6. Transfer the VM

Automation
All of the above steps (including wizard-style user interaction) are captured in the following xencap task:

 Leave a Reply

(required)

(required)

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