#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/usr/sbin/cluster/cspoc/utilities/clisconvg.sh 1.3 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 1998,2004 
# 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 
# @(#)45	1.3 src/43haes/usr/sbin/cluster/cspoc/utilities/clisconvg.sh, hacmp.cspoc, 61haes_r714 2/20/04 10:53:04
#
###############################################################################
#
# Name:
#       clisconvg.sh
#
# Description:
#    Used to determine if a volume group is a member of a concurrent resource
#    group.
#
#   Usage: clisconvg <vg>
#
# Return Values:
#       0       Success
#       1       Failure
#
###############################################################################

function usage
{
   /bin/dspmsg -s 2 cspoc.cat 49 "Usage: clisconvg <vg>\n"
   exit 1
}

function leave
{
    print $1
    exit $2
}

# Check the number of arguments

[[ $# -ne 1 ]] && usage

# Grab the volume group from the command line

VG=$1

# Grab an HACMPresource ODM class for the volume group in question.

OC=""
OC=$(odmget -q "value = $VG" HACMPresource | awk '$1 == "name" {printf("%s",$3)}')

# See if the volume group actually exists in a resource
[[ -z "$OC" ]] && {
    leave "no" 1
}

# Check to see if it is concurrent first
[[ "$OC" = *CONCURRENT_VOLUME_GROUP* ]] && {
    leave "concurrent" 0
}

# If not concurrent, it must be shared
leave "shared" 0
