The usual IT babble
Posts tagged IBM
SVC: Migrate VDisks off a MDisk Group onto another
Oct 29th
Out of necessity, another SVC shell script was just born. If you ever need to migrate a whole MDisk group onto another, you quickly discover the limited application of the SVC GUI. Now, you could query the VDisks using your original MDisk Group and then copy and paste the VDisk’s name (or the VDisk ID) into a command line and simply reuse that svctask migratevdisk command over and over.
Luckily IBM blessed the SVC with an SSH interface. So again, we can write a (kinda) simple shell script which may look like this:
#!/bin/bash
svc_cluster_ip=10.150.7.33
svc_priv_dsa=~/.ssh/id_dsa
if [ -z $2 ] ; then
echo
echo " ${0##*/} [ original_mdiskgrp | target_mdiskgrp | (threads) ]"
echo
echo " mdiskgrp_old - The MDisk Group which currently contains"
echo " the VDisks."
echo " mdiskgrp_new - The MDisk Group you wish to migrate the"
echo " VDisks migrated to."
echo " threads - Number of processes to use for the migration."
echo " By default, \`migratevdisk\` uses 2."
echo
exit 1;
fi
if [ ! -f $svc_priv_dsa ] ; then
echo " ${0##*/} is missing the SSH DSA private key"
echo " needed to access the SAN Volume controller."
echo " Please specify the correct path!"
fi
mdiskgrp_old=$1
mdiskgrp_new=$2
threads=$3
: ${threads:=2}
check_running_migrations() {
# Get the number of already running migrations. The SVC is currently
# able to run 32 migrations at the same time.
running="$( ssh -i $svc_priv_dsa admin@$svc_cluster_ip svcinfo lsmigrate \
| grep progress | wc -l )"
if [ $running -ge 32 ] ; then
echo
echo " The SVC is already running the maximum amount of migrations"
echo " at this time. Please retry, once the running migrations"
echo " finished."
echo
exit 1
fi
}
check_running_migrations
if [ "$( ssh -i $svc_priv_dsa admin@$svc_cluster_ip svcinfo lsmdiskgrp \
$mdiskgrp_new &>/dev/null ; echo $? )" = 1 ] ; then
echo "${0##*/}: The MDisk Group ($mdiskgrp_new) doesn't existent!"
exit 1
fi
echo "Legend:"
echo
echo -e " \033[0;32m*\033[0m VDisk migration started successfully"
echo -e " \033[0;36m*\033[0m VDisk migration skipped (already running?)"
echo -e " \033[0;31m*\033[0m VDisk migration failed to start (wrong name?)"
echo
echo "Starting the tasks to migrate VDisks of $mdiskgrp_old to $mdiskgrp_new"
for vdisk in $( ssh -i $svc_priv_dsa admin@$svc_cluster_ip svcinfo \
lsvdisk -nohdr -delim : -filtervalue mdisk_grp_name=$mdiskgrp_old ); do
vdisk_id="$( echo $vdisk | cut -d: -f1 )"
vdisk_name="$( echo $vdisk | cut -d: -f2 )"
# Check if there's already a migration running for this vdisk
if [ "$( ssh -i $svc_priv_dsa admin@$svc_cluster_ip svcinfo lsmigrate \
| grep "migrate_source_vdisk_index $vdisk_id\$" )" != "" ] ; then
echo -e " \033[0;36m*\033[0m VDisk $vdisk_name ($vdisk_id)"
continue
fi
check_running_migrations
ssh -i $svc_priv_dsa admin@$svc_cluster_ip svctask migratevdisk \
-mdiskgrp $mdiskgrp_new -threads $threads \
-vdisk $vdisk_name &>/dev/null
response=$?
[ $response -eq 0 ] && \
echo -e " \033[0;32m*\033[0m VDisk $vdisk_name ($vdisk_id)" \
|| echo -e " \033[0;31m*\033[0m VDisk $vdisk_name ($vdisk_id)"
running=$((running+1))
done
echo
And the execution would look like this:
svc-mgmt ~ # svctask_migratemdiskgrp DS3400_146G_R1 DS4700_500G_R6 4 The SVC is already running the maximum amount of migrations at this time. Please retry, once the running migrations finished.
Or maybe:
svc-mgmt ~ # svctask_migratemdiskgrp DS3400_146G_R1 DS4700_500G_R6 4 Legend: * VDisk migration started successfully * VDisk migration skipped (already running?) * VDisk migration failed to start (wrong name?) Starting the tasks to migrate VDisks from DS3400_146G_R1 to DS4700_500G_R6 * VDisk V_ATLAS_C_01 (25) * VDisk V_AETHER_D_01 (13) * VDisk V_DEIMOS_ROOT
IBM SVC: Copy VDisk Host-Mapping from one host to another
Oct 11th
As I wrote a few days ago, I started a new job. One of my first (voluntary) tasks was writing a shell script which would copy a VDisk Host-Mapping from a given host to another. This is useful, if you do have a lot of ESX servers for example and a few roaming ones.
Now, if say, you need to do some ESX-Updates and you would like to add the roaming one to a given farm, you would be in a dark an deary place. You would be required to either click through the GUI a dozen times (in my case, it might have needed ~200 clicks) or type svcinfo lshostvdiskmap <examplehosthere> and svctask mkhostvdiskmap <newhosthere> -force (these are incomplete command references) a few times.
Both methods ain’t optimal nor fast. Since the SVCTools (Perl, jikes) don’t really came into consideration, and the SVC SSH interface really doesn’t provide any other method to do a simple `cut -d: -f3` (as a hint: if anyone knows a nice method to emulate cut with bash patterns — yeah, I ain’t kidding — please drop me a note!), I ended up writing a simple shell script which is gonna do all the tasks from any Linux system (in possession of the SSH DSA private keys for the SVC of course).
The script looks like this:
#!/bin/bash
svc_cluster_ip=10.0.0.10
svc_priv_dsa=~/.ssh/id_dsa_svc
if [ -n $2 ] ; then
echo " copyvdiskhostmap.sh [ host_to | host_from ]"
echo
echo " host_to - Target host, for which we will create the VDisk map."
echo " host_from - Source host, from which the VDisk map will be copied."
echo
exit 1;
fi
if [ ! -f $svc_priv_dsa ] ; then
echo " copyvdiskhostmap.sh is missing the SSH DSA private key needed"
echo " to access the SAN Volume controller."
echo " Please specify the correct path!"
fi
host_to=$1
host_from=$2
for mapping in $( ssh -i $svc_priv_dsa admin@$svc_cluster_ip svcinfo \
lshostvdiskmap -nohdr -delim : $host_from ); do
vdisk_scsi_id="$( echo $mapping | cut -d: -f3 )"
vdisk_name="$( echo $mapping | cut -d: -f5 )"
ssh -i $svc_priv_dsa admin@$svc_cluster_ip svcinfo lshost $host_to || \
echo "Failed, since the target host doesn't existent!" && break
ssh -i $svc_priv_dsa admin@$svc_cluster_ip svctask mkvdiskhostmap -force \
-host $host_to -scsi $vdisk_scsi_id $vdisk_name
done
New IBM RDAC version (or not)
Sep 9th
A week ago (September 02nd), I received a mail detailing the release of IBM’s new multipathing device driver for the DS4x00 series, which finally works with SLES11 (the available software up till now doesn’t — as in fails with kernels > 2.6.26 iirc).
There wouldn’t be any trouble, if IBM (or rather the vendor providing the driver — LSI) would actually release the driver … up till today, I have yet to see the new version appear on the download page. I already tried to notify IBM about the trouble, but as usual there is lack of ways to actually get this to the right person.
Well, IBM just replied to my feedback and apparently the download is available (it is right now, after two weeks hah — finally).
Tivoli Storage Manager Server 5.5.3
Aug 28th
I spent yesterday afternoon upgrading our TS7530, and in my fad I also upgraded TSM to 5.5.3. Now, once I started TSM it quickly started complaining about the paths to the drives.
ANR8873E The path from source TSM1 to destination VTL1_DR03
(/dev/lin_tape/IBMtape03) is taken offline.
ANR8873E The path from source TSM1 to destination VTL1_DR03
(/dev/lin_tape/IBMtape03) is taken offline.
HBA_LoadLibrary: previously unfreed libraries exist, call HBA_FreeLibrary().
ANR8873E The path from source TSM1 to destination VTL1_DR07
(/dev/lin_tape/IBMtape07) is taken offline.
ANR8873E The path from source TSM1 to destination VTL1_DR07
(/dev/lin_tape/IBMtape-07) is taken offline.
I thought maybe this is a mere device problem (we have had them before), so I rebooted the boxes. But still no luck and I went home after about an hour of trying without any luck. In the morning, my co-worker called our trustworthy IBM service partner, and the TSM consultant said he had the exact, same problem yesterday. We would have two options:
- Enable the option SANDISCOVERY, with the (completely undocumented) Passive setting (setopt SANDISCOVERY PASSIVE)
- Downgrade back to 5.5.2
For now, we implemented the first option, in the hope that’ll solve our troubles. And it actually does.
Mass-updating Tivoli Storage Manager drive status
Aug 28th
I was fighting with our VTL again, and TSM was thinking all the drives were offline. In order to update the drive status, you’d need to go into the ISC and select each drive and set them to ONLINE. Since I’m a bit click-lazy, I wrote a simple nested for-loop, which gives me the output to update all the drives at once:
for i in 1 2; do
for k in $( seq -w 1 32 ); do
echo "UPDATE DRIVE VTL$i VTL${i}_DR${k} ONLINE=YES"
done
done
Result is a list like this:
... UPDATE DRIVE VTL1 VTL1_DR31 ONLINE=YES UPDATE DRIVE VTL1 VTL1_DR32 ONLINE=YES UPDATE DRIVE VTL2 VTL2_DR01 ONLINE=YES UPDATE DRIVE VTL2 VTL2_DR02 ONLINE=YES UPDATE DRIVE VTL2 VTL2_DR03 ONLINE=YES ...
The same goes for mass-updating the path status:
for i in 1 2; do
for k in $( seq -w 1 32 ); do
echo "UPDATE PATH TSM$i VTL${i}_DR${k} SRCTYPE=SERVER DESTTYPE=DRIVE LIBRARY=VTL$i ONLINE=YES"
done
done
Result is a list like this:
... UPDATE PATH TSM1 VTL1_DR31 SRCTYPE=SERVER DESTTYPE=DRIVE LIBRARY=VTL1 ONLINE=YES UPDATE PATH TSM1 VTL1_DR32 SRCTYPE=SERVER DESTTYPE=DRIVE LIBRARY=VTL1 ONLINE=YES UPDATE PATH TSM2 VTL2_DR01 SRCTYPE=SERVER DESTTYPE=DRIVE LIBRARY=VTL2 ONLINE=YES UPDATE PATH TSM2 VTL2_DR02 SRCTYPE=SERVER DESTTYPE=DRIVE LIBRARY=VTL2 ONLINE=YES
