#!/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r720 src/43haes/usr/sbin/cluster/cspoc/utilities/clgetpvids.sh 1.7 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2003,2015 # 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.7 src/43haes/usr/sbin/cluster/cspoc/utilities/clgetpvids.sh, hacmp.cspoc, 61haes_r720, 1517B_hacmp720 4/14/15 17:17:03 ############################################################################### # # COMPONENT_NAME: CSPOC Command Line Interface # # Name: # clgetpvids # # Description: # Given a PVID, find the disk that has that PVID on the platter, and get the # corresponding ODM entry created for the physical volume # # Arguments: # A list of PVIDs # # Return Values: # none # # ################################################################################ # : Load the "CL_PVID_ASSIGNMENT" from the environment file, if : present, allowing for any unexpected leading whitespace. # typeset TAB=$'\t' typeset INDENT="$TAB " eval $(grep -w '^[$INDENT]*CL_PVID_ASSIGNMENT' /etc/environment) PROGNAME=${0##*/} export PATH=$(/usr/es/sbin/cluster/utilities/cl_get_path all) version="1.7" typeset pvid="" typeset disk="" typeset disk_pvid="" integer problems=0 # : Go through the list of PVIDs that was passed in, and get the appropriate : physical volume ODM entry created. # for pvid in $*; do # : Look at all the disks this system knows about to see if any of them : now have the given PVID # for disk in $(lsdev -Cc disk -F name); do # : Direct read of the platter for the PVID - it is not in ODM yet # disk_pvid=$(/usr/es/sbin/cluster/events/utils/cl_querypv /dev/$disk) # : Check to see if this is the disk we are looking for # if [[ $pvid == $disk_pvid && -z $(odmget -q "attribute = pvid and value = $disk_pvid" CuAt) ]] then # : Recognized values for CL_PVID_ASSIGNMENT are "false", "no", : "disable", or zero. Any other value preserved the default : behavior, allowing PVIDs to be automatically assigned, as : needed. # if [[ -z $CL_PVID_ASSIGNMENT || $CL_PVID_ASSIGNMENT != @(f|F|n|N|d|D|0)* ]] then # : Yes, it is. Get the corresponding ODM entry created # if ! chdev -l $disk -a pv=yes; then dspmsg -s 144 cspoc.cat 1 '%1$s: ERROR: could not assign a PVID to disk "%2$s".\n\n' "${0##*/}" "$disk" 1>&2 (( problems++ )) fi else dspmsg -s 144 cspoc.cat 2 '\nERROR: \"%1$s\" cannot be used due to the current value\n of environment variable "CL_PVID_ASSIGNMENT" ("%2$s").\n\n' "${0##*/}" "$CL_PVID_ASSIGNMENT" 1>&2 (( problems++ )) fi fi done done exit $problems