ADSM-L

Re: [ADSM-L] TSM Library Manager

2009-03-10 16:31:59
Subject: Re: [ADSM-L] TSM Library Manager
From: "Schneider, John" <John.Schneider AT MERCY DOT NET>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Tue, 10 Mar 2009 15:29:50 -0500
Paul,
Thanks for sharing your script. Everybody has their own naming
convention for tape drives.  I like a convention where the TSM name
makes it possible to tell where the drive is in the physical library.
That makes it a lot easier when discussing the tape drive problem with
IBM, since the CE's seem to think in terms of physical locations.

If it is OK to post scripts directly, I will post mine:

 root# cat TSM-rename-rmt-devices.ksh
#!/bin/ksh
# TSM-rename-rmt-devices.ksh
# A script to take FC rmt devices and rename them according to names
found
# in a table in /usr/local/bin/TSM-rename-rmt-devices.data
#
# History
# 02/06/2007 JDSchneider  Original Version
#

#
print "This script will examine the existing FC tape rmt devices, and
rename"
print "them according to the table found in the config file:"
print "   /usr/local/bin/TSM-rename-rmt-devices.data."
print "If there are no devices that need to be renamed, then no output
will"
print "be produced.  Use \"lsdev -Cc tape\" to verify the status of the
drives."
print
print "Enter Y to proceed, or anything else to exit."
print
read ans
if [[ "$ans" != "Y" && "$ans" != "y" ]]
then
        print "Exitting without doing anything..."
        exit 0
fi

DEV_file=/tmp/TSM_lsdev.txt
SN_file=/tmp/TSM_SNfile.txt
DATA_file=/usr/local/bin/TSM-rename-rmt-devices.data


print "Gathering device data, please wait..."
lsdev -Cc tape | grep 3590 > $DEV_file 2>&1
lsdev -Cc tape | grep 3592 >> $DEV_file 2>&1
lsdev -Cc tape | grep 3580 >> $DEV_file 2>&1

rm $SN_file > /dev/null 2>&1


cat $DEV_file | while read rmt_device avail path junk
do
        if [[ "$rmt_device" != "" ]]
        then
           serial_string=`lscfg -vl $rmt_device | grep 'Serial Number' |
cut -c37-`
           path=`echo $path | cut -c1-5`
           print $rmt_device $path $serial_string >> $SN_file
        fi
done

cat $DATA_file | while read rmt_device tsm_drive path sn alt_path junk
do
        if [[ "$sn" != "" && "$sn" != "Serial" ]]
        then
                path=`echo $path | cut -c1-5`
                rmt_org=`grep $sn $SN_file | grep $path | head -1 | cut
-f1 -d" "`
                if [[ "$rmt_org" != "" ]]
                then
                  if  [[ $rmt_org != $rmt_device ]]
                  then
                    print "Device $rmt_org being changed to
${rmt_device}."
                    echo chdev -l $rmt_org -a new_name=$rmt_device
                    chdev -l $rmt_org -a new_name=$rmt_device
                    if [[ $alt_path = "ALT" ]]
                    then
                       echo chdev -l $rmt_device -a alt_pathing=yes
                       chdev -l $rmt_device -a alt_pathing=yes
                    fi
                  fi
                fi
        fi

done

exit
stlo-tsm01_root#

Here is a sample of the data file it runs against.  Note that the script
permits drives to have more than one path to the server (the ALT
parameter), and turn on IBM's alt_pathing support if so.

root# cat TSM-rename-rmt-devices.data
rmt-name    TSM-drive    Path  Serial Number Alt Path
rmt_f1_d01a drive_f1_d01 09-08 000007808221 ALT
rmt_f1_d02a drive_f1_d02 09-08 000007808146 ALT
rmt_f1_d03a drive_f1_d03 09-08 000007807587 ALT
rmt_f1_d04a drive_f1_d04 09-08 000007809316 ALT
rmt_f1_d05a drive_f1_d05 09-08 000007802698 ALT
rmt_f1_d06a drive_f1_d06 09-08 000007807535 ALT
rmt_f1_d07a drive_f1_d07 09-08 000007807590 ALT

rmt_f1_d01b drive_f1_d01 0C-08 000007808221 ALT
rmt_f1_d02b drive_f1_d02 0C-08 000007808146 ALT
rmt_f1_d03b drive_f1_d03 0C-08 000007807587 ALT
rmt_f1_d04b drive_f1_d04 0C-08 000007809316 ALT
rmt_f1_d05b drive_f1_d05 0C-08 000007802698 ALT
rmt_f1_d06b drive_f1_d06 0C-08 000007807535 ALT
rmt_f1_d07b drive_f1_d07 0C-08 000007807590 ALT

rmt-name    TSM-drive    Path  Serial Number Alt Path
lto4_f1_d01 lto4_f1_d01 09-09 0007850942
lto4_f1_d02 lto4_f1_d02 09-09 0007850931
lto4_f1_d03 lto4_f1_d03 09-09 0007850943
lto4_f1_d04 lto4_f1_d04 0C-09 0007850935
lto4_f1_d05 lto4_f1_d05 0C-09 0007851058
lto4_f1_d06 lto4_f1_d06 0C-09 0007850928
lto4_f1_d07 lto4_f1_d07 0D-09 0007850906
lto4_f1_d08 lto4_f1_d08 0D-09 0007850924
lto4_f1_d09 lto4_f1_d09 0D-09 0007854535
lto4_f1_d10 lto4_f1_d10 0G-09 0007854530
lto4_f1_d11 lto4_f1_d11 0G-09 0007854519
lto4_f1_d12 lto4_f1_d12 0G-09 0007854527

root# 


Best Regards,

John D. Schneider 
Phone: 314-364-3150 
Cell: 314-750-8721
Email:  John.Schneider AT Mercy DOT net 


-----Original Message-----
From: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU] On Behalf Of
Paul Zarnowski
Sent: Tuesday, March 10, 2009 2:41 PM
To: ADSM-L AT VM.MARIST DOT EDU
Subject: Re: [ADSM-L] TSM Library Manager

At 03:17 PM 3/10/2009, Schneider, John wrote:
>Greetings,
>         I have a solution to the problem of library sharing and
>different rmt names.


We have a similar, but different solution.  We have a script we use to
rename AIX tape devices to a predictable name, based on the last 4
characters of the WWN.  After running it on each AIX system, the device
names will be the same on each system.  After running "tsmchrmt rmt0",
the
device will have a name similar to:
rmt.f0c6.0.0
where "f0c6" are the last 4 chars of the device's WWN.

I don't recall where we got the seed for this script, but here is our
version, which we call "tsmchrmt":

----
#!/bin/sh
if [ $# != 1 ]
then
   echo "must specify 1 rmt device name as an argument."
   exit 4
fi
d=$1

WWN=`/usr/sbin/lsattr -El $d -a ww_name|cut -f2 -d" "|cut -c15-`
LUN=`/usr/sbin/lsattr -El $d -a lun_id|cut -f2 -d" "|cut -c3`
root=`echo $d|cut -c1-3`
new_name=$root.$WWN.$LUN.0
let "j=0"
while [[ -e /dev/$new_name ]]
do
         let "j=j+1"
         new_name=$root.$WWN.$LUN.$j
done
/usr/sbin/chdev -l $d -a new_name=$new_name
----

..Paul



--
Paul Zarnowski                            Ph: 607-255-4757
Manager, Storage Services                 Fx: 607-255-8521
719 Rhodes Hall, Ithaca, NY 14853-3801    Em: psz1 AT cornell DOT edu
This e-mail contains information which (a) may be PROPRIETARY IN NATURE OR
OTHERWISE PROTECTED BY LAW FROM DISCLOSURE, and (b) is intended only for the
use of the addressee(s) named above. If you are not the addressee, or the
person responsible for delivering this to the addressee(s), you are notified
that reading, copying or distributing this e-mail is prohibited. If you have
received this e-mail in error, please contact the sender immediately.