Designing High-Availability for Xen Virtual Machines with HP Serviceguard for Linux

When a Xen VM guest is started, it first goes into a running state, which is then followed by a booted
up state. It is necessary to wait for the guest to get into the booted up state before using the Xen
virtual machine. This is usually significant when the Xen guest is started up using SG/LX package
control script. The package control script expects the VM to get into a booted up state before it can
perform further user-defined operations on the virtual machine.
At the time of startup, specific run-time information is captured to enable monitoring of the VM
machine. Various monitoring approaches are discussed in the monitoring section.
Xen VM Shutdown
A Xen VM can be gracefully shut down using the command:
xm shutdown <config filename>
After invocation of the command, it is necessary to wait until all the VM-specific daemons stop to
achieve a clean shutdown. A clean shutdown ensures that the file systems and volume groups
associated with the machine are successfully unmounted and deactivated respectively.
The Xen virtual machine probe function can be used to check for a complete shutdown of the VM.
Once the probe function declares the VM is no longer running, post shutdown steps can be
performed. If a Xen VM is packaged as a SG/LX package, the post-shutdown steps performed are as
follows:
1. Unmount the file systems
2. Deactivate the volume groups
3. Re-assign IP address (optional): The virtual machine IP address should not be registered with
the package control script for monitoring. However, it is possible to monitor the subnet in
which the virtual machine IP resides. The subnet may be monitored by placing an entry in the
package configuration script:
# Example :
MONITORED_SUBNET 15.154.63.0 # (netmask=255.255.255.0)
These steps are performed by the SG/LX package control script. The Xen control script is callable
from the SG/LX Package Control Script.
Xen VM Monitoring
Xen supports two modes of virtualization - Para-Virtualized (PV) and Fully-Virtualized (FV). The
monitoring of a Xen VM is typically specific to the mode of virtualization used by the VM, but it is also
possible to implement a technique which allows monitoring that is independent of the virtualization
mode used.
Virtualization-mode independent approach
Xen Manager 'xm' commands can be used to monitor the Xen Virtual Machine (both full and para-
virtualized VMs) through the 'xm list' commands. For example:
xm list | grep ${Virtual Machine Name} | awk '{print $5}' | grep -e "r-"
-e "b-"
11