#! /bin/sh
# $Header: multihost_drive_notify.sh,v 1.2 99/08/05 12:33:33 rjp Stab $

#bcpyrght
#***************************************************************************
#* Copyright 1993 - 1999 VERITAS Software Corporation, All Rights Reserved *
#***************************************************************************
#ecpyrght

#
# multihost_drive_notify.sh
#
# this script is called by media manager when a multihosted drive is
# reserved or released.
#
# this script:
#       receives 1 parameter triplet, the name of the multihosted drive,
#          the current scan host and the operation of RESERVED, ASSIGNED,
#	   RELEASED or SCANHOST.
#	must be executable by the root user
#	should exit with 0 upon successful completion
#
#   Technical notes regarding reserve/assign/release/scanhost.
#	- When this script is called and operation is RESERVED, this means
#         that this host (where the script is being executed) needs SCSI
#         access to the drive until it is released.
#       - When this script is called and operation is RELEASED, now only
#         the scan host needs SCSI access to the drive.
#       - Note that the scan host could change between a RESERVED
#         and a RELEASED.
#       - The ASSIGNED state is informational only, and does not change
#         the fact that the host that reserved the drive needs SCSI access.
#       - The SCANHOST call means that this host has now become the scanhost.
#         This should not occur while the drive is RESERVED.

OUTF=/usr/openv/volmgr/bin/MULTIHOST_DRIVE_CALLED

if [ "$#" -lt 3 ]
then
	echo `date` "multihost_drive_notify requires 3 parameters" >> $OUTF
	exit 1
fi

# You may want to delete the output file every call such that it does
# not get too large.  If so, uncomment out the following 4 lines.
#if [ -s $OUTF ]
#then
#	/bin/rm -rf $OUTF
#fi

touch $OUTF

# Any customized procedures for the various operations may be placed below.

case "$3"
in
	"RESERVED")
		;;
	"ASSIGNED")
		;;
	"RELEASED")
		;;
	"SCANHOST")
		;;
esac

echo `date` "multihosted drive $1 (scan host $2) $3" >> $OUTF

exit 0
