#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # # # Licensed Materials - Property of IBM # # (C) COPYRIGHT International Business Machines Corp. 2004,2005 # 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 # @(#)54 1.8 src/avs/fs/mmfs/ts/admin/mmdevdiscover.sh, mmfs, avs_rgpfs24, rgpfs240610b 8/8/05 19:09:02 ############################################################################## # # This script is invoked by GPFS to discover the disk devices on the # local machine that will subsequently be opened for NSD volume identifier # mapping. We open each of the devices listed and examine sector 2 for a # volume identifier that correlates to a volume identifier recorded in our # configuration database. If a match is found then this machine has local # access to the underlying NSD device and local I/O occurs through the local # device interface. This script will also invoke # # /var/mmfs/etc/nsddevices # # if it is supplied by the user. If the nsddevices script exits with # a return code of zero, then no other disk discovery is performed. # If nsddevices does not exist, or returns with a non-zero return # code, then this script performs its normal disk discovery steps. # # The output from both this script and nsddevices is a number of lines # with the following format: # # deviceName deviceType # # where # deviceName is a device name ("hdisk1", "sda", etc.) # deviceType is a known disk types. # # Known disk types currently are: # # powerdisk - EMC power path disk # vpath - IBM virtual path disk # dlmfdrv - Hitachi dlm # hdisk - AIX hard disk # lv - AIX logical volume. Historical usage only. # Not allowed as a new device to mmcrnsd. # generic - Device having no unique failover or multipathing # characteristic (predominantly Linux devices). # # Example: # # hdisk1 hdisk # hdisk2 hdisk # ############################################################################## # Include global declarations and service routines. . /usr/lpp/mmfs/bin/mmglobfuncs sourceFile="mmdevdiscover.sh" [[ -n $DEBUG || -n $DEBUGmmdevdiscover ]] && set -x $mmTRACE_ENTER "$*" # Change this if you want stderr to go elsewhere. STDERR=/dev/null ######################################################## # Invoke the nsddevices user exit, if it was activated. # If the script exits with a zero return code then we # use it exclusively and will not do anything more. # If nsddevices does not exist, or if it returns with # a non-zero return code, then we will perform normal # GPFS disk discovery. ######################################################## if [[ -x $nsddevices ]] then $nsddevices [[ $? -eq 0 ]] && cleanupAndExit 0 fi ################################################## # Perform the normal GPFS disk discovery process. ################################################## if [[ $osName = AIX ]] then # Get the names of Virtual Shared Disks, if any. if [[ -x $lsvsd ]] then $lsvsd 2>$STDERR | $awk '{ if (NF > 0) print $1 " vsd" }' fi # Get all defined and available vpaths, hdisks, etc. LC_ALL=C $getlvodm -F 2>$STDERR | \ $awk ' \ /hdiskpower/ { print $1 " powerdisk" ; next } \ /dlmfdrv/ { print $1 " dlmfdrv" ; next } \ /vpath/ { print $1 " vpath" ; next } \ /hdisk/ { print $1 " hdisk" ; next } \ ' # Get all logical volume names. # LVs are supported in older file systems only. Not allowed as a new device. LC_ALL=C $lsvg -o 2>$STDERR | LC_ALL=C $lsvg -i -l 2>$STDERR | \ $awk ' \ /LV NAME/ || /:/ { next } \ { print $1 " lv" } \ ' elif [[ $osName = Linux ]] then # Get the names of all disks, vpaths, etc. $awk ' \ /emcpower/ { if (NF > 3 && $3 > 1) print $4 " powerdisk" ; next } \ /vpath/ { if (NF > 3 && $3 > 1) print $4 " vpath" ; next } \ /[sh]d/ { if (NF > 3 && $3 > 1) print $4 " generic" ; next } \ ' /proc/partitions 2>$STDERR else print -u2 " Unknown operating system $osName " cleanupAndExit fi # Search for the disk type of "file" in the mmsdrfs file. # Note: This is used for testing during development only. possiblefiles=$($awk -F: ' \ /':$SG_DISKS:'/ { \ if ($'$NSD_SUBTYPE_Field' == "file") { \ { print $'$NSD_SUBTYPE_DISKNAME_Field' } \ } \ } \ ' $mmsdrfsFile) for testfile in $possiblefiles do [[ -f $testfile ]] && print -- "$testfile file" done cleanupAndExit 0