Migration
Performing VM migration under Xen
Xen can migrate virtual machines between different servers, running Xen. This can be useful if you need to take a physical server offline, for maintenance. Rather than having to shutdown the VMs running on that host during the maintenance, you can migrate them to another physical server, and keep them running. Performing a migration does not require restarting the virtual server, and has no noticeable downtime.
Setup
The persistent storage for the VMs must be shared, so that both Dom0s can see the same disk, at the same location.
Then run `xl migrate <domain> <host>` to migrate the VM
If you have no real shared storage (eg SAN) available, you can still test VM migration, using NBD. This allows you to share the harddrive of one host with another. The disadvantage of this is that whilst you can migrate the VM, you cannot shutdown the host that contains the storage.
- Install nbd-client on all Dom0s you will migrate between (apt-get install nbd-client on Debian-based distros)
- Install nbd-server (apt-get intall nbd-server) on the Dom0 of the machine that contains the storage
- Add the following to /etc/nbd-server/config
[<name>] exportname = <path to disk to share> port = 9000
- Run `nbd-client 127.0.0.1 9000 /dev/nbd1` on the same machine
- Run `nbd-client <hostname of machine that contains the storage> 9000 /dev/nbd1` on the machine you are migrating to
- Modify your /etc/xen/foo.cfg file to use /dev/nbd1 as its disk, on the host backing the storage
- Start the VM
- Run `xl migrate <Domain> <new host>`
Additional Information
- A good external article from the SUSE SLES 12 manual