#!/usr/bin/perl -w
##################################################################################
#### Script to show mappings between vxdisk list output and emcpower devices. ####
#### It also display the did device number if this is in a cluster. ##############
#### Version 1.0 - RPW 28/07/09 ##################################################
#### Version 1.1 - RPW 29/07/09 - code tidy up #################################
##################################################################################
use strict;
my @vxdisklist=`/usr/sbin/vxdisk list`;
my @inq=`/usr/local/bin/inq 2>/dev/null`;
my $vxdisk;
my $SERNUM;
my $emcpower;
my $hostname=`/usr/bin/hostname`; chomp ($hostname);
my $ctd;
my $diddevice;
my @scdidadmL;
# Check to see if we are a cluster, and if so save the scdidadm -L output
@scdidadmL=`/usr/cluster/bin/scdidadm -L` if -e "/usr/cluster/bin/scdidadm";
# Step through each emcpower vxdisk list entry
foreach (@vxdisklist){
if (/^(emcpower\d+)(s2)*/){
$vxdisk = $1;
# Pull out SER NUM for each vxdisk list entry
$emcpower = $vxdisk."c";
foreach (@inq){
$SERNUM = $1 if /^\/dev\/rdsk\/$emcpower\s+:\w+\s+:[\w\s]+:\d+\s+:(\w+)\s+:\d+/;
}
# Here's the output
print "\nVxVM device: $vxdisk\n";
print "EMC devices:\n";
foreach (@inq){
# print a match for each device with our SER NUM
print if /:$SERNUM\s+:/;
if (/(\/dev\/rdsk\/c.+)s2.+$SERNUM/){
$ctd = $1;
$diddevice = undef;
foreach (@scdidadmL){
# Extract did number if we have a match for hostname and disk device in our scdidadm -L output
$diddevice = $1 if /(\d+)\s+$hostname\:$ctd\s.+/;
}
}
}
# If we have a matching did device, output it here
print "did device: $diddevice\n" if $diddevice;
}
}
Tuesday, July 28, 2009
vxvm/emcpower/did devices - more robust
I found a problem with my previous script (it wasn't happy with Clarion arrays) so I rewrote it in perl. This one seems to do the trick but if I make any updates I'll post them up..
Labels:
emc
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment