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

echo "sgx_validate_vm"
typeset -i retval=0
# validate if the package is run on xen host
if [ -d /proc/xen ]; then
grep -q control_d /proc/xen/capabilities
case $? in
0)
echo "Xen Dom0 Host found !"
retval=0 ;;
1)
echo "ERROR:: Xen Package Module cannot be configured on a Xen VM Guest"
retval=1 ;;
*)
echo "ERROR:: Xen Environment Detection Failed"
retval=255 ;;
esac
fi
if (( retval != 0 ))
then
echo "ERROR:" $retval " Failed to validate Xen VM Package"
to_exit=1
fi
}
#######################################################################
###
#
# sg_xen_start_vm() is called while starting a xen vm package (cmrunpkg)
#
# For each {service name/service command string} pair, start the
# service command string at the service name using cmrunserv(1m)
#
#######################################################################
###
function sgx_start_vm
{
typeset -i retval=0
echo "sgx_start_vm"
if [ -f ${SG_XEN_VM_PATH}${SG_XEN_VM_NAME} ]; then
[ -x ${SG_XEN_BIN} ] || ( echo "xm not found" && exit 255 )
${SG_XEN_BIN} create ${SG_XEN_VM_PATH}${SG_XEN_VM_NAME}
case $? in
0)
echo "Xen VM ${SG_XEN_VM_NAME} successfully started !!"
18