#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/usr/sbin/cluster/cspoc/utilities/clsynclvodm.sh 1.5 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 1998,2006 
# 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 
# @(#)20  1.5  src/43haes/usr/sbin/cluster/cspoc/utilities/clsynclvodm.sh, hacmp.cspoc, 61haes_r714 2/22/06 10:16:35
###############################################################################
#
# Name:
#       clsynclvodm.sh
#
# Description:
#   Handles two operations when extending a volume group.
#      1. Runs synclvodm on the volume group.
#
#
#   Usage: clsynclvodm <vg>
#
# Return Values:
#       0       success
#       1       failure
#
################################################################################

RETCODE=0

# Check the number of arguments

[[ $# -ne 1 ]] && {
   /bin/dspmsg -s 2 cspoc.cat 43 "Usage: clsynclvodm <vg>\n"
   exit 1
}

# Grab the volume group from the command line

VG=$1

$(lsvg $VG > /dev/null 2>&1)

if [[ $? -ne 0 ]]
then
   /bin/dspmsg -s 2 cspoc.cat 48 "Volume group %s does not exist!\n" $VG
   exit 1
fi

# First, synchronize the ODM for this volume group

synclvodm -cP "$VG" || {
   /bin/dspmsg -s 2 cspoc.cat 44 "Error executing synclvodm %s!\n" $VG
   exit 1
}

exit 0
