XenServer Live Migration
Here are some docs relating to XenServer live migration.
Types of Migration
There are two main cases for Live Migration:
- VM on shared storage
- VM not on shared storage
When the VM is on shared storage, you are able to use XenServer's pool concept to perform the migration. However, the source and destination host must both be in that pool.
When not using shared storage, we have to move the VMs disk to the new server. A new feature of XenServer (called Storage XenMotion) will be able to help: http://wiki.xen.org/wiki/CrossPoolMigrationv3
Live Migration with Block Migration
This requires XenServer 6.1 or later, or XCP 1.6 and later. Neither are released at the time of writing.
This feature has not yet been implemented: https://blueprints.launchpad.net/nova/+spec/xenapi-live-block-migration
Live Migration using Host Aggregate
If you are using XenServer pools, configured using Host Aggregates, and you configure that pool to use shared storage as the default storage, you can migrate your VMs between the different hosts in that pool.
Setting up a XenServer pool using Host Aggregates
To setup a pool, you need at least two servers, and they must be compatible: http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/reference.html#pooling_homogeneity_requirements
There are several requirements on the nova configuration:
- You must configure real management IP of the XenServer (not 169.254.0.1) and the nova DomU should also be on that network
- You must configure to use the default pool storeage:
Now you can create the aggregate using the nova cli:
nova aggregate-create my_test_pool my_availability_zone
You can use aggregate-list to get the id, then tool to add your master (using the hostname of the nova compute on that hypervisor, you can use "nova-manage service list" to check the name):
nova aggregate-add-host <aggregate_id> my_master_host
Now you can use xe or XenCenter to add some shared storage, and make the the default pool storage repository: http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/reference.html#id1002701
Now you can add your further hosts to the pool (keeping in mind the requirements for pool compatibility noted above):
nova aggregate-add-host <aggregate_id> my_slave_host_1 nova aggregate-add-host <aggregate_id> my_slave_host_2
You should now see these servers shutdown your nova compute VM, join your pool, then start back up the nova compute VM.
NOTE: in some versions of XenServer, you will now need to re-configure eth0 on your nova compute VM before the VM will boot. You should add the VIF another network. This should be fixed in future versions of XenServer.
To try this feature out, start a VM, and you should see it make use of the shared storage.
To live-migrate the VM, you make use of the usual nova cli command:
nova live-migration <instance_uuid> <destination_hostname>
Live Migration RPC Calls
Let's consider the two hosts called:
- src (where inst runs)
The user call maps to:
- scheduler rpc: live_migration(block_migration, disk_over_commit, instance_id, dest)
Scheduler driver does the following:
- check instance exists
- check source alive
- check destination
- compute: check_can_live_migrate (on dest)
- updates instance to "migrating"
- compute: live_migration (on dest)
Compute:check_can_live_migrate does the following:
Compute: live_migration does the following: