#!/bin/ksh93
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/lib/ksh93/aix/KLIB_HACMP_AIX_lspv.sh 1.3 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2005,2011 
# 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 
# @(#)23	1.3 src/43haes/lib/ksh93/aix/KLIB_HACMP_AIX_lspv.sh, hacmp, 61haes_r714 11/28/11 14:59:42
#
#=head1 NAME
#
# KLIB_HACMP_AIX_lspv - List all physical volumes (hdisks) for given
#			volume group
#
#=head1 ARGUMENTS
#
#   1: [scalar] volume group name
#
#=head1 RETURN
#
#   0: success
#   1: failure
#
#=head1 COPYRIGHT
#
#(C) COPYRIGHT International Business Machines Corp. 2005
#All Rights Reserved
#
#=cut
#
function KLIB_HACMP_AIX_lspv
{
    . /usr/es/lib/ksh93/func_include

    VG=$1

    if [[ -z "$VG" ]]; then
        LANG="C" PVS=`lspv | grep -vw "None" | awk '{ print $1 }' 2>/dev/null`
    else
        LANG="C" PVS=`lspv | grep -w $VG | awk '{ print $1 }' 2>/dev/null`
    fi

    if [[ $? -ne 0 ]]; then
        return 1
    else
        for PV in $PVS; do
            echo $PV
        done
    fi

    return 0
}
