[Linux-HA] Resource transition

Alan Robertson alanr at unix.sh
Tue Mar 8 09:23:37 MST 2005

Anja Karense Lønningen wrote:
> Hi,
>  We are making use of Heartbeat in a small program ("main") using the
>  Heartbeat client api. This works out fine. Our problem occurs in
>  connection with trying to start this program from a script ("ais")
>  which runs at Heartbeat startup. This script is listed as a resource in
> the following line of haresources:
>  stud2104 Ais
>  The script is located in /etc/ha.d/resources/ and looks like this:
>  #!/bin/sh
>  #
>  # Startup script for AIS
>  #
>  #
>  #
>  export DISPLAY=:0.0
>  case "$1" in
>          start)
>                  # Run ais main program
>                  xterm -e /home/ingunn/Diplom/Kildekode/main
>                  ;;
>          stop)
>                  # Kill ais main program
>                  MPID=$(pidof main)
>                  kill $MPID
>  esac
>  Starting Heartbeat, then calls the start function of the script and
>  makes our program start in a new xterm window as it is supposed to.
>  However, it seems like the resource transition does not finish until
>  the program ends. We want the program to run along with Heartbeat so
>  that having the primary node fail will cause the program to start up at
> the backup node. The problem is hence the resources. Calling the
>  get_resources() function constantly returns "transition" until we
>  manually shut down the program ("main"). Then it returns "all" or
>  "local" depending on the other node's state. How can the resource
>  transition be finished so that we get "all" or "local" without shutting
> down the program?
>  The log file looks like this:
>  heartbeat: 2005/03/08_11:51:26 info: Running /etc/ha.d/resource.d/Ais
>  start
>  heartbeat: 2005/03/08_11:51:36 info: Local Resource acquisition
>  completed. (none)
>  heartbeat: 2005/03/08_11:51:36 info: local resource transition
>  completed.
>  According to this it looks like the resource transition should be
>  completed, still the get_resources() call returns "transistion". Trying
> to shut down heartbeat at this point (without shutting down the program
> "main") prints the following line in the log:
>  heartbeat: 2005/03/08_11:51:59 WARN: Shutdown delayed until current
>  resource activity finishes.
>  Nothing happens until we shut down the program "main". Then Heartbeat
>  stops normally. So, it seems to us that the resource aquisition does
>  not finish as we want it to. Any ideas about this?

Heartbeat also needs the status operation to work correctly, as is 
documented here (and elsewhere):


     Alan Robertson <alanr at unix.sh>

"Openness is the foundation and preservative of friendship...  Let me claim 
from you at all times your undisguised opinions." - William Wilberforce

More information about the Linux-HA mailing list