#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/sbin/cluster/cspoc/utilities/cllsvpathids.sh 1.5 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2002,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 # @(#)36 1.5 src/43haes/usr/sbin/cluster/cspoc/utilities/cllsvpathids.sh, hacmp.cspoc, 61haes_r714 1/24/04 16:55:52 # \$Id\$ # # Component: hacmp.cspoc # # Function: Calls cl_lsvpathids and cl_find_commonvpathids to gather # gather available and common vpaths on selected nodes. # # Origins: 27 # # Arguments: {-n | -c} # # Output: list of pvids followed by a line for each containing # node name, vpath, and a list of hdisks. If option c # is used, only concurrent capable disks are listed. # # Usage: cl_lsvpathids -n ' ...' # # Return Values: # 0 - success # 1 - failure # ############################################################################# USAGE=$(/bin/dspmsg -s 116 cspoc.cat 9999 "cllsvapthids {-n | -c} \n") SHARED_OPT="false" CONCURRENT_OPT="false" NODES="" while getopts ":n:c:" opt; do case $opt in c) NODES=$OPTARG CONCURRENT_OPT="true" ;; n) NODES=$OPTARG SHARED_OPT="true" ;; *) print $USAGE 1>&2 exit 1 ;; esac done if [[ "$SHARED_OPT" = "true" && "$CONCURRENT_OPT" = "true" ]] then print $USAGE 1>&2 exit 1 fi if [[ -z $NODES ]] then print $USAGE 1>&2 exit 1 fi PATH="$($(dirname ${0})/../utilities/cl_get_path all)" export PATH _MSET=116 CL_DATFILE="/tmp/cllsvpathids.out" TEMP_VPATHIDS="" SMIT_VPATHIDS="" CSPOC_NODES=`echo $NODES | sed 's/ /,/g'` # Support only 32 nodes for disk related stuff now. NUMNODES=`echo $NODES | awk '{print NF}' ` NNUM=`expr $NUMNODES` if [ $NNUM -gt 32 ] then # /bin/dspmsg -s 43 cspoc.cat 9 "Maximum of 8 nodes allowed for disk operations.\n" /bin/dspmsg -s 115 cspoc.cat 9 "Maximum of 32 nodes allowed for disk operations.\n" exit 1 fi CLLSVPATHIDS=`cl_lsvpathids -cspoc "-n $CSPOC_NODES" > $CL_DATFILE` COMMON_VPATHIDS=`cl_find_commonvpathids $NODES` #print "COMMON is $COMMON_VPATHIDS" if [ "$CONCURRENT_OPT" = "true" ] then for i in $COMMON_VPATHIDS do CON_VPATHID=`grep $i $CL_DATFILE | head -1 | awk -F: '{print $5}'` if [ "$CON_VPATHID" = "C" ] then SMIT_VPATHIDS="$SMIT_VPATHIDS $i" fi done SMIT_VPATHIDS=`echo $SMIT_VPATHIDS | sed 's/ /\\\n/g'` else SMIT_VPATHIDS="$COMMON_VPATHIDS" fi SMIT_VPATHIDS=`echo $SMIT_VPATHIDS | sed 's/*/\\\n/g'` if [ "$SMIT_VPATHIDS" = "" ] then /bin/dspmsg -s 115 cspoc.cat 6 "No free disks found.\n" exit 1 fi for i in $SMIT_VPATHIDS do # If configuration has a site defined add site name to list when # Cross-Site LVM Mirroring is configured. # if [[ -z $(odmget HACMPsite | \ awk ' { gsub(/"/,"") if ($1 == "name") { printf("%s", $3) } }') ]] then print "$i" else sitename=$(odmget -q"name=PVID AND value=${i}" HACMPsiteinfo | \ awk ' { gsub(/"/,"") if ($1 == "site") { printf("%s", $3) } }') printf "%s\t%s\n" $i $sitename fi grep $i $CL_DATFILE | awk -F: '{print "# " $1 ":" $2 ": " $4}' done exit 0