#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/sbin/cluster/cspoc/utilities/clvpmkdev.sh 1.3 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2002 # 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 # @(#)12 1.3 src/43haes/usr/sbin/cluster/cspoc/utilities/clvpmkdev.sh, hacmp.cspoc, 61haes_r714 11/19/02 14:57:04 # $Id$ # @(#)59 1.0.0.0 src/43haes/usr/sbin/cluster/cspoc/utilities/clvpmkdev.sh, hacmp.cspoc, 51haes_r510 6/21/02 19:50:09 ############################################################################### # # Name: # clvpmkdev # # Description: # The clvpmkdev command takes the given PVID and performes certain operations on # assosiated VPaths. It makes defined VBPaths available or removes VPaths with # or w/o keeping the definitions in DB according to the specified parameters. # # Usage: clvpmkdev -l [-d'KeepInDBFlag"] # # Arguments: # The clvpmkdev command argument is the PVID number. There is an optional argument # specifying the operation to perform. # -l Specified PVID number # -d Remove flag # If not specified (no '-d' option), then the script makes all defined # VPaths associated with given PVID avaiable. # 'yes' Remove associated VPaths with keeping them in DB (make them 'Defined') # 'no' Remove associated VPaths w/o keeipn them in DB. # # Return Values: # 0 success # 1 failure # # Suggested run example: # clvpmkdev '0000048fd788ac" # ################################################################################ _PVID=$(echo $1 | sed 's/-l//g') KEEPDB=$(echo $2 | sed 's/-d//g') if [ $# -lt 1 ] then echo "Incorrect usage - no agruments specified!" exit 1 fi if [ $# -gt 2 ] then echo "Incorrect usage - too many agruments specified!" exit 1 fi _EXIT=0 # If we are making defined VPaths available if [ -z "$KEEPDB" ] ; then # Collect vp configuration info with PVIDs nd search for the given PVID VPATHS="$(/usr/${HA_DIR}/sbin/cluster/cspoc/clvpathpvids | grep $_PVID | # Look for VPaths in 'Defined' state grep '(Def' | cut -d' ' -f2)" for VPATH in $VPATHS do mkdev -l $VPATH if [ $? -ne 0 ] then _EXIT=1 fi done exit $_EXIT fi # If removing VPaths with keeping in DB if [ "$KEEPDB" = 'yes' ] ; then # Collect vp configuration info with PVIDs nd search for the given PVID /usr/${HA_DIR}/sbin/cluster/cspoc/clvpathpvids | grep $_PVID | # Remove each of the found VPath - make it Defined ( while read PVID VPATH REST do rmdev -l $VPATH done) exit 0 fi if [ "$KEEPDB" = 'no' ] ; then # Collect vp configuration info with PVIDs nd search for the given PVID /usr/${HA_DIR}/sbin/cluster/cspoc/clvpathpvids | grep $_PVID | # Remove each assiciated VPath ( while read PVID VPATH REST do rmdev -l $VPATH -d done) exit 0 fi # If there is no correct flag specified - return the error exit 1