Category: AIX
Author/Contact Info Bowie J. Poag (bpoag@comcast.net)
Description: LSVPMembers is a simple script that produces a plain-English report of what hdisks are mapped to each virtual path (vpath), and which LUN ID on your SAN each vpath corresponds to. While written with AIX in mind, this script could presumably be modified fairly easilly to handle other multipath I/O solutions (other than SDD) on other platforms. Interestingly, this script produces a majority of the information found in the lsvp -a table, but in a fraction of the time.
#!/usr/bin/perl
##
## LSVPMembers written 062606:1051 by BJP
##
## LSVPMembers displays what hdisks belong to which vpaths on a given 
+host.
##

@vpList = `lsdev -Cc disk | grep ^vp | cut -d" " -f1`;

print "\nLSVPMembers: Spinning up..\n";

foreach $item (@vpList)
{
  $counter=0;
  chomp($item);

  chomp($LUN=`lsattr -El $item | grep disk | head -n1 | cut -d\/ -f2`)
+;

  $lunID=substr($LUN,0,3)."-".substr($LUN,3)  ;
  
  
  print "LSVPMembers: \"$item\" ($lunID) encompasses ";

  @vpMembers=split(/\s+/,`lsattr -El $item | cut -d" " -f2-3 | cut -c2
+- | grep disk | cut -d\/ -f1`);

  
  foreach $vp (@vpMembers)
  {
    print "$vp";
    $counter++;  

    if ($counter<@vpMembers)
    {
      print ", ";
    }

    else
    {
      print ".";
    }
    
    if ($counter+1==@vpMembers)
    {
      print "and ";
    }
  }

  print "\n";
}

print "LSVPMembers: Spinning down..\n\n";