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

retval=0 ;;
1)
# An error occured while running xm
echo "ERROR: Xen VM startup failed"
retval=1 ;;
*)
# xm command failed with an undocumented error or an error occured while starting
xm
echo "Unrecoverable error occured "
retval=255 ;;
esac
else
echo "ERROR: 255 Xen VM configuration file not found !!!"
exit 255
fi
if (( retval != 0 ))
then
echo "ERROR:" $retval " Function sgx_start_vm"
echo "ERROR:" $retval " Failed to start xen vm"
to_exit=1
fi
}
#######################################################################
###
#
# sg_xen_stop_vm() is called while stopping a xen vm package (cmhaltpkg)
# or during rollback operation to recover from the package startup.
#
# Halt each service using xm command.
#
#######################################################################
###
function sgx_stop_vm
{
typeset -i retval=0
echo "sgx_stop_vm"
[ -x ${SG_XEN_BIN} ] || ( echo "xm not found" && exit 255 )
echo "Halting xen vm ${SG_XEN_VM_NAME}"
${SG_XEN_BIN} shutdown ${SG_XEN_VM_NAME}
case $? in
0)
sgx_probe_vm_status
echo "Xen VM ${SG_XEN_VM_NAME} successfully halted!!"
retval=0 ;;
1)
19