This site best when viewed with a modern standards-compliant browser. We recommend Firefox Get Firefox!.

Linux-HA project logo
Providing Open Source High-Availability Software for Linux and other OSes since 1999.

USA Flag UK Flag

Japanese Flag


About Us

Contact Us

Legal Info

How To Contribute

Security Issues

This web page is no longer maintained. Information presented here exists only to avoid breaking historical links.
The Project stays maintained, and lives on: see the Linux-HA Reference Documentation.
To get rid of this notice, you may want to browse the old wiki instead.

1 February 2010 Hearbeat 3.0.2 released see the Release Notes

18 January 2009 Pacemaker 1.0.7 released see the Release Notes

16 November 2009 LINBIT new Heartbeat Steward see the Announcement

Last site update:
2019-12-11 10:56:33

The Xen resource script

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.

Using Xen resources

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

Xen memory management

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.

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.

Tips and Tricks

wrong error messages show up in heartbeat logs

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:

Resource migration or Memory Management

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.

Memory management race conditions

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.