VirtualDomain (resource agent)

The VirtualDomain resource agent manages virtual machines as cluster resources. It uses the libvirt virtualization infrastructure and as such, can manage any virtualization backend that libvirt supports.

Configuration File
This resource agent requires that a libvirt configuration file is present for every virtual machine under management. This file must follow libvirt's domain XML syntax, and the resource configuration must refer to it via its absolute path.

The configuration file may be placed on shared storage.

Migration capability
This resource agent supports the migrate_from and migrate_to actions, enabling it to tie in with migration capabilities provided by the virtualization backend.

If the allow-migrate meta parameter is set to true, then a resource migration will not map to a domain shutdown/startup cycle, but to an actual, potentially live, resource migration between cluster nodes.

For this to work, the virtualization backend must be configured to support migration. Domain migration should always be tested manually, before enabling domain migration in the cluster.

Timeouts
This resource agent is particularly sensitive to incorrectly set timeouts, particularly for the stop operation. To avoid frequent stop timeout errors, be sure to set timeouts to accommodate proper guest operating system shutdown.

When using live migration, the same considerations apply to timeouts for the migrate_to operation.

VNC port auto-assignment caveats
Bug reports have indicated that libvirt domains may "race" for available VNC ports when configured to auto-select them. This can lead to unexpected results when starting multiple VirtualDomain instances in parallel. This issue was reported when running on libvirt 0.7.6, but is likely to be present in later versions as well.

If you are affected by this issue, several possible work-arounds exist:


 * Disable port auto-selection and select a specific VNC port. For example, set  in the   section of your domain configuration file.
 * Use something other than VNC for graphics output. Edit the  element to contain   or.
 * Disable graphical output for the domain altogether. Remove the  element from the   section.

See the libvirt reference documentation for more information about supported virtual graphics devices, and their supported configuration options.

Jim Fehlig from Novell pushed the changeset to rectify the issue upstream in May 2010, it is fixed from libvirt 0.8.2 forward. Novell customers get a backport to 0.7.6 on SLES 11.

KVM
The following CRM shell example applies to a highly available KVM virtual domain, managed by Pacemaker:

primitive example_VirtualDomain ocf:heartbeat:VirtualDomain \ params \ config="/etc/libvirt/qemu/example_VirtualDomain.xml" \ hypervisor="qemu:///system" \ meta allow-migrate="true" \ op start timeout="120s" \ op stop timeout="120s" \ op monitor depth="0" timeout="30" interval="10"

Xen
The following CRM shell example applies to a highly available Xen Unprivileged Domain (domU), managed by Pacemaker:

primitive example_VirtualDomain ocf:heartbeat:VirtualDomain \ params \ config="/etc/libvirt/xen/example_VirtualDomain.xml" \ hypervisor="xen:///" \ meta allow-migrate="true" \ op start timeout="120s" \ op stop timeout="120s" \ op monitor depth="0" timeout="30" interval="10"

Additional Notes
This resource agent can act as a potential replacement for the Xen and ManageVE RAs, using libvirt's Xen and OpenVZ drivers, respectively.