#!/bin/ksh93 
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/usr/sbin/cluster/cspoc/utilities/clgetvgdisktype.sh 1.5 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2002,2003 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
# @(#)34        1.5 src/43haes/usr/sbin/cluster/cspoc/utilities/clgetvgdisktype.sh, hacmp.cspoc, 61haes_r714 8/22/03 13:25:46
# \$Id\$

#
#	Component:	hacmp.cspoc
#
#	Function:	returns the type of disks in the volume group, either HDISK,
#			VPATH, or both.
#
#	Origins:	27
#
#	Arguments:	<Volume Group>
#
#	Ouput:		One of the following lines will be printed.
#			"HDISK"
#			"VPATH"
#			"VPATH HDISK"
#
#	Usage:		clgetvgdisktype <Volume Group>
#
#	Return Values:
#			0 - success
#			1 - failure
#
#############################################################################

USAGE=$(/bin/dspmsg  -s 116 cspoc.cat 4 "clgetvgdisktype <vg_name>\n")

(( $# != 1 )) && {
    print $USAGE 1>&2
    exit 1
}

VG=$1
VPATH=""
HDISK=""

#
#   Look at all the disks in the given volume group, to see what kind they are
#
lspv | while read disk pvid vgname rest  
	do
	    if [[ $vgname == $VG ]]		# for the volume group in question
	    then
		if [[ $disk == @(vpath*) ]]	# if the disk is a vpath
		then
		    VPATH="VPATH "		# then say so
		else
		    HDISK="HDISK "		# else, it must be an hdisk
		fi
	    fi
	done

echo ${VPATH}${HDISK}

exit 0

