#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/usr/sbin/cluster/cspoc/utilities/cldpovgfix.sh 1.3 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2002,2005 
# 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 
# @(#)33        1.3 src/43haes/usr/sbin/cluster/cspoc/utilities/cldpovgfix.sh, hacmp.cspoc, 61haes_r714 3/28/05 14:44:52
# \$Id\$

#
#	Component:	hacmp.cspoc
#
#	Function:	Calls dpovgfix to move all pvids for a volume to
#			vpaths.  This function is needed because dpovgfix
#			always has an exit code of 1.
#
#	Origins:	27
#
#	Arguments:	<Volume Group>
#
#	Ouput:		None
#
#	Usage:		cldpovgfix <Volume Group>
#
#	Return Values:
#			0 - success
#			1 - failure
#
#############################################################################

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

[[ $# -ne 1 ]] && {
    print $USAGE 1>&2
    exit 1
}

VG=$1

LC_ALL=C dpovgfix $VG | grep -i "Error"

if [[ $? -ne 1 ]]
then
   dspmsg -s 116 cspoc.cat 2 "Error performing dpovgfix on volume group $VG. \nThe volume group may contain both vpath and non-vpath capable \ndisks.  Please reference the Subsystem Device Driveer User's \nGuide.\n" $VG
   exit 1
fi

exit 0