Martin Fick wrote: > --- On Fri, 9/26/08, randall <randall@songshu.org> wrote: > > > > Unfortunately, I never tried R1 style scripts, but > I believe that they will not be any good for what > you want because I believe that there is not way > to add an instance parameter to them. In other > words I think that it is impossible to fail over > more than one drbd resource independently with them. > > From your website it seems like you would like both > nodes to act as primaries to different resources > during normal operation, I think that you need R2 > ocf agents for this. > node1 primary/secondary r1 secondary/primary r2 node2 secondary/primary r1 primary/secondary r2 it works ;) > > I am not sure that I have better examples, but I will > try to help you work through things if you choose to > switch to R2 style configs, > > -Martin > thanks for the offer, but i have it working as it should with R1 by basically modifying your script like below, this way you need to have this for each Vserver specified in haresources, it might be cleaner to have it per resource though. node1 drbddisk::r1 LVM::drbdvg1 Filesystem::/dev/drbdvg1/web::/VSERVERS/web::ext3 Vserver node2 drbddisk::r2 LVM::drbdvg2 Filesystem::/dev/drbdvg2/ns2::/VSERVERS/ns2::ext3 Vserver-ns2 /etc/ha.d/resource.d/Vserver #!/bin/sh # # License: GNU General Public License (GPL) # Author: Martin Fick <mogulguy@yahoo.com> # Date: 04/19/07 # Version: 1.1 # # This script manages a VServer instance # # It can start or stop a VServer # # usage: $0 {start|stop|status|monitor|meta-data} # # # OCF parameters are as below # OCF_RESKEY_vserver # ####################################################################### # Initialization: # #. /usr/lib/heartbeat/ocf-shellfuncs # #USAGE="usage: $0 {start|stop|status|monitor|meta-data}"; # ####################################################################### # # #meta_data() { # cat <<END #<?xml version="1.0"?> #<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd"> #<resource-agent name="VServer"> # <version>1.0</version> # <longdesc lang="en"> #This script manages a VServer instance. #It can start or stop a VServer. # </longdesc> # <shortdesc lang="en">OCF Resource Agent compliant VServer script.</shortdesc> # # <parameters> # # <parameter name="vserver" unique="1" required="1"> # <longdesc lang="en"> #The vserver name is the name as found under /etc/vservers # </longdesc> # <shortdesc lang="en">VServer Name</shortdesc> # <content type="string" default="" /> # </parameter> # # </parameters> # # <actions> # <action name="start" timeout="2m" /> # <action name="stop" timeout="1m" /> # <action name="monitor" depth="0" timeout="1m" interval="5s" start-delay="2m" /> # <action name="status" depth="0" timeout="1m" interval="5s" start-delay="2m" /> # <action name="meta-data" timeout="1m" /> # </actions> #</resource-agent> #END #} vserver_reload() { vserver_stop || return vserver_start } vserver_stop() { # # Is the VServer already stopped? # vserver_status [ $? -ne 0 ] && return 0 /usr/sbin/vserver "web" "stop" vserver_status [ $? -ne 0 ] && return 0 return 1 } vserver_start() { vserver_status [ $? -eq 0 ] && return 0 /usr/sbin/vserver "web" "start" vserver_status } vserver_status() { /usr/sbin/vserver "web" "status" rc=$? if [ $rc -eq 0 ]; then echo "running" return 0 elif [ $rc -eq 3 ]; then echo "stopped" else echo "unknown" fi return 7 } vserver_monitor() { vserver_status } vserver_usage() { echo $USAGE >&2 } vserver_info() { cat - <<!INFO Abstract=VServer Instance takeover Argument=VServer Name Description: A Vserver is a simulated server which is fairly hardware independent so it can be easily setup to run on several machines. Please rerun with the meta-data command for a list of \\ valid arguments and their defaults. !INFO } # # Start or Stop the given VServer... # if [ $# -ne 1 ] ; then vserver_usage exit 2 fi case "$1" in start|stop|status|monitor|reload|info|usage) vserver_$1 ;; meta-data) meta_data ;; validate-all|notify|promote|demote) exit 3 ;; *) vserver_usage ; exit 2 ;; esac > > > >