#!/bin/sh
#
# $Id: ServeRAID.in,v 1.5 2005/11/03 07:45:51 xunsun Exp $
# 
# Description:	wrapper of OCF RA ServeRAID, based on original heartbeat RA.
#		See OCF RA ServeRAID for more information.
#
# Author:	Xun Sun <xunsun@cn.ibm.com> 
# Support:      linux-ha@lists.linux-ha.org
# License:      GNU General Public License (GPL)
# Copyright:	(C) 2005 International Business Machines
#
# usage: ./ServeRAID <adapter> <MergeGroup#>  {start|stop|status}
#
#<adapter>:	Adapter number of the ServeRAID adapter 
#<MergeGroup#>:	MergeGroup # of the logical drive under consideration.
#
# An example usage in /etc/ha.d/haresources: 
#       node1  10.0.0.170 ServeRAID::1::1

# Source function library.
. /etc/ha.d/resource.d//hto-mapfuncs

unset LC_ALL; export LC_ALL
unset LANGUAGE; export LANGUAGE

usage() {
  cat <<-! >&1
	usage: $0 <serveraid#> <sharedmergegroup#> {start|stop|status}

	The serveraid# is the number of the ServeRAID adapter
	ServeRAID adapters are numbered starting from 1.

	The shared merge group number is a number between 1 and 8 inclusive.
	It indicates to the controller which logical disk to fail over.

                node1  10.0.0.170 ServeRAID::1::1

	PREREQUISITES:
	You must configure your ServeRAID adapters for clustering for this
	to work.

	To do this, you must use the bootable "ServeRAID Support CD" and right
	click your controller and pick "configure for clustering".  The Linux
	version of the ServeRAID manager does not have the "configure for
	clustering" option.

	You will need at least version 6.10 (~July 2003 release) of the ipssend
	command for this script to work. The official releases are available from
	IBM website.

	$Id: ServeRAID.in,v 1.5 2005/11/03 07:45:51 xunsun Exp $
	!
  exit 1
}

ServeRAID_methods() {
  cat <<-!
	start
	stop
	status
	methods
	!
}

case $# in
  1)	if [ "$1" = "methods" ]; then
		ServeRAID_methods
 		exit $?
	fi;;
  3)	;;
  *)	usage;;
esac

# Look for the start, stop, status, or methods calls...
case "$3" in
  stop|start|status)
	;;
  methods) 
	ServeRAID_methods
	exit $?;;
  *)
	usage;;
esac

ra_execocf  "rsc_id=ServeRAID_$1" "rsc_type=ServeRAID" "provider=heartbeat" $3 "serveraid=$1" "mergegroup=$2"
