-=-=-=-=-=-=-TSM Server Script-=-=-=-=-=-=-=-
def script drive_match desc="This script is used by a shell script to match drives to rmts to help create DEFINE PATH statements"
upd script drive_match "select 'define path $1 ' || drive_name || ' srct=server destt=drive libr=' || library_name || ' device=/dev/$2 -"
upd script drive_match " online=yes' from drives where DRIVE_SERIAL='$3' "
-=-=-=-=-=-=-UNIX Shell Script-=-=-=-=-=-=-=-
#!/bin/ksh
ID=`cat /home/tsmadmin/VARS/ADSMID`
PA=`cat /home/tsmadmin/VARS/ADSMPA`
touch ./drv_match.mac
cat /dev/null > ./drv_match.mac
clear
echo "This script will build the DEFINE PATH statements for a server"
echo ""
echo "Enter the Library Manager Name: \c"
read SERV
echo ""
echo "What is the TSM server name these paths are going to be generated for: \c"
read TSMSRV
echo ""
lsdev |grep fscsi | while read FSCS rest
do
TAPES=$(lsdev -p $FSCS | grep rmt | grep -v ALT |cut -f1 -d" ")
for TAPE in $TAPES
do
SERIAL=$(lscfg -vl $TAPE | grep Serial | awk -F"." '{printf "%d", $NF}')
FCS=$(echo $FSCS | sed 's/fscsi/fcs/')
dsmadmc -id=$ID -pa=$PA -dataonly=yes -commadelimited -servern=$SERV run drive_match $TSMSRV $TAPE $SERIAL | grep -v ANR >> ./drv_match.mac
done
done
cat ./drv_match.mac
-=-=-=-=-End Script-=-=-=-=-=-
You'll notice I save the output as a macro so it can be reviewed before executed. If you'd like to run the macro automatically then just add a dsmadmc line at the end.
The following is some sample output:
define path tsm8 VTL3_00332 srct=server destt=drive libr=VTL3 device=/dev/rmt88 online=yes
define path tsm8 VTL3_00336 srct=server destt=drive libr=VTL3 device=/dev/rmt89 online=yes
define path tsm8 VTL3_00340 srct=server destt=drive libr=VTL3 device=/dev/rmt90 online=yes
define path tsm8 VTL4_00444 srct=server destt=drive libr=VTL4 device=/dev/rmt91 online=yes
I use another method. Instead of adding paths to match the devices, I change the devices to match the path with chdev. That way all the library clients can have the same path-device mapping.
ReplyDeleteThanks for the "Duh!" moment...Whoever you are! Never thought of chdev, thats a lot easier. I'll keep that one in mind, I could modify the script to match them and then chdev them correctly. That's why I love sharing, since sometimes we all just need a different perspective.
ReplyDeletefor physical drives, I used to rename them sorted by WWN, but with VTL now, I use the serial numbers to do it.
ReplyDeleteI rename them / order them on my TSM server and then do it exactly the same on all my LAN-FREE clients. Really neat and so easy to manage! You can delete everything whenever needed and just run that little script to set it back up correctly! I never update / change my paths on the TSM server itself.
I even integrated the load balancing / alternate pathing activation in the script.
Frank.
Dumb question, but where do you run the shell script, on the UNIX host that the client is on?
ReplyDelete