Article Figure 1 Figure 2 Figure 3 Figure 4
Figure 5 Figure 6 Figure 7 Figure 8 Figure 9
Figure 10 Figure 11 Listing 1 Listing 2 Listing 3
Listing 4 Sidebar 1 Sidebar 2 Sidebar 3 Table 1 Table 2 Table 3 Table 4 sep2001.tar

Listing 2 encl_to_vg

#!/usr/bin/ksh                
#
# Name: encl_to_vg
#
# Purpose: Provides a report of a SSA Drawer ID to volume group mapping
#          Also provides the Hdisk#, Pdisk#, MC Level
#
# Date: Aug 1999
#
# Required Parameters:
# -------------------------------------------------------------------------
# SSA Enlcosure Name
#
# Optional Parameters:
# -------------------------------------------------------------------------
# none
#
# Change History:
#
# Date          Name            Comments
# _________________________________________________________________________
#

if [[ $# -ne 1 ]]
then
   echo
   echo "usage $0: SSA_enclosure_name"
   echo
   echo "This script will report on  SSA Drawer ID to volume group mapping"
   echo
   exit -1
fi

ENCLOSURE=$1

# set umask to prevent others from reading tmp files
umask 077
RETCODE=0
WORK_DIR=${WORK_DIR:=/tmp}
SEP="-----------------------------------------------------------------------------------------------------------------------------"
COLUMNS=`stty -a | grep columns | cut -d" " -f6`

if [[ `lscfg | grep "$1-" | cut -c 20-35` = '' ]]
then
   echo
   echo "Error: $ENCLOSURE does not appear to be the name of a SSA drawer."
   echo "It looks like your drawers are:"
   echo $SEP | cut -c -$COLUMNS
   lscfg | grep -i "SSA Enclosure" | cut -c 27-35
   echo $SEP | cut -c -$COLUMNS
   exit -1
fi
echo $0 started at $(date).

echo "Enclosure         Pdisk   Hdisk           VG              MC      Type"
echo $SEP | cut -c -$COLUMNS
lscfg | grep "$1-" | cut -c 20-35 | while read ENCL
do
   PDISK="None"
   HDISK="None   "
   VG="None"
   LEVEL="?"

   if [[ $ENCL != "" ]]
   then
   PDISK=`lscfg | grep "$ENCL" | cut -d " " -f2 | grep pdisk`

      if [[ $PDISK != "" ]]
      then
         HDISK=`ssaxlate -l $PDISK`
         if [[ `echo $HDISK | grep -c disk` -gt 0 ]]
         then
            VG=`lspv | grep "$HDISK" | cut -c 36- | sed "s/ //g"`
         else
             HDISK="None   "
         fi

         LEVEL=`lscfg -vl "$PDISK" | grep -i "ROS Level and ID" | cut -c 37-`
         TYPE=`lscfg -vl "$PDISK" | grep -i "Machine Type and Model" | cut -c 37-`

      fi
   fi

   echo "$ENCL          $PDISK  $HDISK  $VG     $LEVEL  $TYPE"
done
echo $SEP | cut -c -$COLUMNS

echo $0 ended at $(date).

exit 0