This page describes the Xen OCF resource script that is included heartbeat 2.1.3 or later. The Xen resource script is intended if you want to run heartbeat on your Xen server dom0, and want to manage your virtual Xen domUs.
The Xen script assumes that the xend is running, so you make sure on all of your cluster nodes, that xend is started at boot time. It won't work well, when creating resource groups, starting xend, and then a node. The Xen resource is a OCF ResourceAgent. It provides the followign parameters, with their defaults:
xmfile /etc/xen/vm/MyDomU, The Xen domU configuration file
allow_migrate 0, use Xen live migration for resource migration. Note: this is a meta_attribute!
allow_mem_management 0, enable dynamic memory management
reserved_Dom0_memory 512, maximum dom0 memory, only used when allow_mem_management=1
When setting the parameter allow_mem_management=1, then the Xen resource script tries to divide the available memory equally between all domU's running on one node. To not get problems with automatic Xen memory ballooning, you should limit the Memory that the dom0 can see by setting the dom0_mem kernel paramter in your grub configuration file. The value that you define for the dom0_mem parameter, should match the value for the reserved_Dom0_memory Xen resource parameter. This value is used to calculate the memory for the domUs. Then, when a new domU is started on a cluster node, it reduces the memory of the actually running domU's, and then starting the new domU. The other way around, when a domU is stopped, the freed memory is given back to the left running domU's. The Xen memory management does not work together with Xen resource migration.
When setting the parameter allow_migrate=1, then Xen live migration is used when a Xen domU shall be relocated in the cluster. This does not work together with allow_mem_management=1. Therefore it has to rely on the automatic Xen memory autoballooning.
In case the Xen domU's were not created on a node, or more exactly, no files about that domU below /var/lib/xen, then there might be misleading error messages showing up in the heartbeat logs. The patch to this bug fixes the problem: http://developerbugs.linux-foundation.org/show_bug.cgi?id=1830
I've seen the Xen memory autoballooning not working, e.g. unable to free enough memory for a new domU. This especially happened, when a heartbeat node was sent to standby, and two or more domUs had to be relocated. The xend on the target node might become very busy, timeouts may occur, or the xend might not be able to free enough memory for the new domU's, and they will fail to start on that node, which is very bad.
In case there is more than one Xen node started on a node at the same time, it can happen that race conditions occur in the calculation of free memory, and the memory will in the end not be enough to start all domU's, which will result in a fatal resource startup failure. Therefore you should create orders between the Xen resources. The orders should be symmetrical=0 and have a score=0.