Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

As anyone who's ventured into the VIO jungle can tell you, it's a pain in the ass.. Mainly due to the fact that despite functioning as a cluster*, VIO administration requires ongoing human-driven manual configuration on each node. This will eventually produce gradually divergent configurations on the nodes over time, which can come back to haunt you.

Recently, we had occasion where the failure of one VIO node caused an LPAR to go haywire. We eventually tracked the problem down to a LUN mismatch. To avoid this happening in the future, I put together a quick script to compare the LUN mappings on two VIO servers, to ensure that what was present on one was indeed present on the other, and to ensure that everything looked safe, sane, and failover-ready.

One of the problems with IBM's VIO model is that the administrator is generally jailed in a shell that doesn't permit ready access to the underlying AIX commands that are only granted after issuing oem_setup_env. This script includes a handy routine for getting around that problem, remotely.

(* = I use the term "cluster" loosely..Rather than strictly syncronized active/passive peer nodes, for some reason IBM decided it would be better to have the VIO servers in a relationship that more resembles two siblings who rarely if ever stay in touch but cooperate with eachother if a family member dies.)


Here's some example output:

(12:08:06)(foobarbaz)(~) bowie : ./ultraviolet.pl bogonvio1 bogonvio2 Ultraviolet: Starting up.. Ultraviolet: Collecting configuration info from bogonvio1 and bogonvio +2.......... Ultraviolet: Sorting things out..... Ultraviolet: Test Result Notes Ultraviolet: --------------------------------------------------------- +---------------------------------------- Ultraviolet: PV Count PASS Overall PV counts are equiv +alent between VIO servers. Ultraviolet: PV Match A to B PASS All PVIDs present on bogonv +io1 are present on bogonvio2. Ultraviolet: PV Match B to A PASS All PVIDs present on bogonv +io2 are present on bogonvio1. Ultraviolet: Active Vhost Count PASS The same number of vhosts a +re active on both VIO servers. Ultraviolet: Involved LPAR Count PASS The same number of of LPARS + are involved on both VIO servers. Ultraviolet: LPARs A to B PASS All LPARs mentioned on bogo +nvio1 are present on bogonvio2. Ultraviolet: LPARs B to A PASS All LPARs mentioned on bogo +nvio2 are present on bogonvio1. Ultraviolet: LUN ID Match FAIL LUN IDs don't match between + bogonvio1 and bogonvio2. Ultraviolet: Backing Device Match FAIL The hdisk enumeration is di +fferent between bogonvio1 and bogonvio2. Ultraviolet: Ultraviolet: Problems found: Ultraviolet: Ultraviolet: Backing device mismatch detected. (foobarbaz_foovg is hdi +sk59 on bogonvio1, but on bogonvio2 it's hdisk47) Ultraviolet: Backing device mismatch detected. (foobarbaz_bazvg is hdi +sk61 on bogonvio1, but on bogonvio2 it's hdisk49) Ultraviolet: Backing device mismatch detected. (foobarbaz_baz01 is hdi +sk51 on bogonvio1, but on bogonvio2 it's hdisk39) Ultraviolet: Backing device mismatch detected. (foobarbaz_baz02 is hdi +sk52 on bogonvio1, but on bogonvio2 it's hdisk40) Ultraviolet: Backing device mismatch detected. (foobarbaz_baz03 is hdi +sk53 on bogonvio1, but on bogonvio2 it's hdisk41) Ultraviolet: Backing device mismatch detected. (foobarbaz_baz04 is hdi +sk54 on bogonvio1, but on bogonvio2 it's hdisk42) Ultraviolet: Backing device mismatch detected. (foobarbaz_baz05 is hdi +sk55 on bogonvio1, but on bogonvio2 it's hdisk43) Ultraviolet: Backing device mismatch detected. (foobarbaz_baz06 is hdi +sk56 on bogonvio1, but on bogonvio2 it's hdisk44) Ultraviolet: Backing device mismatch detected. (foobarbaz_baz07 is hdi +sk57 on bogonvio1, but on bogonvio2 it's hdisk45) Ultraviolet: Backing device mismatch detected. (foobarbaz_foovg is hdi +sk62 on bogonvio1, but on bogonvio2 it's hdisk50) Ultraviolet: Backing device mismatch detected. (foobarbaz_foovg is hdi +sk58 on bogonvio1, but on bogonvio2 it's hdisk46) Ultraviolet: Backing device mismatch detected. (bazfoobar_foovg is hdi +sk63 on bogonvio1, but on bogonvio2 it's hdisk52) Ultraviolet: Backing device mismatch detected. (bazfoobar_baz01 is hdi +sk16 on bogonvio1, but on bogonvio2 it's hdisk18) Ultraviolet: Backing device mismatch detected. (bazfoobar_baz02 is hdi +sk17 on bogonvio1, but on bogonvio2 it's hdisk19) Ultraviolet: Backing device mismatch detected. (bazfoobar_baz04 is hdi +sk31 on bogonvio1, but on bogonvio2 it's hdisk32) Ultraviolet: Backing device mismatch detected. (bazfoobar_baz05 is hdi +sk32 on bogonvio1, but on bogonvio2 it's hdisk35) Ultraviolet: Backing device mismatch detected. (bazfoobar_baz06 is hdi +sk50 on bogonvio1, but on bogonvio2 it's hdisk38) Ultraviolet: Backing device mismatch detected. (bazfoobar_foovg is hdi +sk64 on bogonvio1, but on bogonvio2 it's hdisk53) Ultraviolet: Backing device mismatch detected. (bazfoobar_foovg is hdi +sk65 on bogonvio1, but on bogonvio2 it's hdisk54) Ultraviolet: Backing device mismatch detected. (bazbazfoo_bazfoo is hd +isk36 on bogonvio1, but on bogonvio2 it's hdisk37) Ultraviolet: Backing device mismatch detected. (bazbazfoo_bazfoo1 is h +disk37 on bogonvio1, but on bogonvio2 it's hdisk51) Ultraviolet: Backing device mismatch detected. (bazbazfoo_bazfoo2 is h +disk116 on bogonvio1, but on bogonvio2 it's hdisk105) Ultraviolet: Backing device mismatch detected. (bazbazfoo_bazfoo3 is h +disk117 on bogonvio1, but on bogonvio2 it's hdisk106) Ultraviolet: Backing device mismatch detected. (bazbazfoo_bazfoo4 is h +disk118 on bogonvio1, but on bogonvio2 it's hdisk107) Ultraviolet: Backing device mismatch detected. (bazbazfoo_foo01 is hdi +sk119 on bogonvio1, but on bogonvio2 it's hdisk108) Ultraviolet: Backing device mismatch detected. (bazbazfoo_foo is hdisk +35 on bogonvio1, but on bogonvio2 it's hdisk36) Ultraviolet: Backing device mismatch detected. (bazbarfoo92_bar01 is h +disk14 on bogonvio1, but on bogonvio2 it's hdisk13) Ultraviolet: Backing device mismatch detected. (bazbarfoo92_bar02 is h +disk18 on bogonvio1, but on bogonvio2 it's hdisk14) Ultraviolet: Backing device mismatch detected. (bazbarfoo92_bar03 is h +disk19 on bogonvio1, but on bogonvio2 it's hdisk15) Ultraviolet: Backing device mismatch detected. (bazbarfoo92_bar04 is h +disk20 on bogonvio1, but on bogonvio2 it's hdisk16) Ultraviolet: Backing device mismatch detected. (bazbarfoo92_bar01 is h +disk1 on bogonvio1, but on bogonvio2 it's hdisk0) Ultraviolet: Backing device mismatch detected. (bazbarfoo92_bar02 is h +disk11 on bogonvio1, but on bogonvio2 it's hdisk1) Ultraviolet: Backing device mismatch detected. (bazbarfoo92_bar03 is h +disk12 on bogonvio1, but on bogonvio2 it's hdisk3) Ultraviolet: Backing device mismatch detected. (bazbarfoo92_bar04 is h +disk13 on bogonvio1, but on bogonvio2 it's hdisk12) Ultraviolet: Backing device mismatch detected. (bazbarfoo_foo01 is hdi +sk130 on bogonvio1, but on bogonvio2 it's hdisk119) Ultraviolet: Backing device mismatch detected. (bazbarfoo_barvg is hdi +sk129 on bogonvio1, but on bogonvio2 it's hdisk118) Ultraviolet: Backing device mismatch detected. (bazbarfoo_foovg is hdi +sk15 on bogonvio1, but on bogonvio2 it's hdisk17) Ultraviolet: Backing device mismatch detected. (bazbarfoo_foo01 is hdi +sk136 on bogonvio1, but on bogonvio2 it's hdisk125) Ultraviolet: Backing device mismatch detected. (bazbarfoo_foo02 is hdi +sk137 on bogonvio1, but on bogonvio2 it's hdisk126) Ultraviolet: Backing device mismatch detected. (bazbarfoo_foo03 is hdi +sk138 on bogonvio1, but on bogonvio2 it's hdisk127) Ultraviolet: Backing device mismatch detected. (bazbarfoo_baz01 is hdi +sk139 on bogonvio1, but on bogonvio2 it's hdisk128) Ultraviolet: Backing device mismatch detected. (bazbarfoo_baz02 is hdi +sk140 on bogonvio1, but on bogonvio2 it's hdisk129) Ultraviolet: Backing device mismatch detected. (bazbarfoo_baz03 is hdi +sk141 on bogonvio1, but on bogonvio2 it's hdisk130) Ultraviolet: Backing device mismatch detected. (foobarfoo_bar01 is hdi +sk3 on bogonvio1, but on bogonvio2 it's hdisk4) Ultraviolet: Backing device mismatch detected. (foobarfoo_bar02 is hdi +sk4 on bogonvio1, but on bogonvio2 it's hdisk5) Ultraviolet: Backing device mismatch detected. (foobarfoo_bar03 is hdi +sk5 on bogonvio1, but on bogonvio2 it's hdisk6) Ultraviolet: Backing device mismatch detected. (foobarfoo_bar04 is hdi +sk6 on bogonvio1, but on bogonvio2 it's hdisk7) Ultraviolet: Backing device mismatch detected. (barbazfoo_barvg is hdi +sk115 on bogonvio1, but on bogonvio2 it's hdisk104) Ultraviolet: Backing device mismatch detected. (barbazfoo_bazfoo is hd +isk109 on bogonvio1, but on bogonvio2 it's hdisk83) Ultraviolet: Backing device mismatch detected. (barbazfoo_bazfoo1 is h +disk110 on bogonvio1, but on bogonvio2 it's hdisk84) Ultraviolet: Backing device mismatch detected. (barbazfoo_bazfoo2 is h +disk111 on bogonvio1, but on bogonvio2 it's hdisk85) Ultraviolet: Backing device mismatch detected. (barbazfoo_bazfoo3 is h +disk112 on bogonvio1, but on bogonvio2 it's hdisk88) Ultraviolet: Backing device mismatch detected. (barbazfoo_bazfoo4 is h +disk113 on bogonvio1, but on bogonvio2 it's hdisk102) Ultraviolet: Backing device mismatch detected. (barbazfoo_foo01 is hdi +sk114 on bogonvio1, but on bogonvio2 it's hdisk103) Ultraviolet: Backing device mismatch detected. (barbazfoo_foovg is hdi +sk60 on bogonvio1, but on bogonvio2 it's hdisk80) Ultraviolet: Backing device mismatch detected. (barbarfoo_baz01 is hdi +sk122 on bogonvio1, but on bogonvio2 it's hdisk111) Ultraviolet: Backing device mismatch detected. (barbarfoo_baz02 is hdi +sk123 on bogonvio1, but on bogonvio2 it's hdisk112) Ultraviolet: Backing device mismatch detected. (barbarfoo_baz03 is hdi +sk124 on bogonvio1, but on bogonvio2 it's hdisk113) Ultraviolet: Backing device mismatch detected. (barbarfoo_foovg is hdi +sk125 on bogonvio1, but on bogonvio2 it's hdisk114) Ultraviolet: Backing device mismatch detected. (barbarfoo_bar01 is hdi +sk7 on bogonvio1, but on bogonvio2 it's hdisk8) Ultraviolet: Backing device mismatch detected. (barbarfoo_bar02 is hdi +sk8 on bogonvio1, but on bogonvio2 it's hdisk9) Ultraviolet: Backing device mismatch detected. (barbarfoo_bar03 is hdi +sk9 on bogonvio1, but on bogonvio2 it's hdisk10) Ultraviolet: Backing device mismatch detected. (barbarfoo_bar04 is hdi +sk10 on bogonvio1, but on bogonvio2 it's hdisk11) Ultraviolet: LUN Name-to-ID mismatch detected. (foobarfoo_bar01 has a +LUN ID of 0x8400000000000000 on bogonvio1, but on bogonvio2 it's 0x85 +00000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (foobarfoo_bar02 has a +LUN ID of 0x8500000000000000 on bogonvio1, but on bogonvio2 it's 0x88 +00000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (foobarfoo_bar03 has a +LUN ID of 0x8800000000000000 on bogonvio1, but on bogonvio2 it's 0x89 +00000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (foobarfoo_bar04 has a +LUN ID of 0x8900000000000000 on bogonvio1, but on bogonvio2 it's 0x8a +00000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (barbazfoo_barvg has a +LUN ID of 0x9100000000000000 on bogonvio1, but on bogonvio2 it's 0x8d +00000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (barbazfoo_bazfoo has a + LUN ID of 0x8b00000000000000 on bogonvio1, but on bogonvio2 it's 0x8 +f00000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (barbazfoo_bazfoo1 has +a LUN ID of 0x8c00000000000000 on bogonvio1, but on bogonvio2 it's 0x +9000000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (barbazfoo_bazfoo2 has +a LUN ID of 0x8d00000000000000 on bogonvio1, but on bogonvio2 it's 0x +9100000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (barbazfoo_bazfoo3 has +a LUN ID of 0x8e00000000000000 on bogonvio1, but on bogonvio2 it's 0x +9200000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (barbazfoo_bazfoo4 has +a LUN ID of 0x8f00000000000000 on bogonvio1, but on bogonvio2 it's 0x +8b00000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (barbazfoo_foo01 has a +LUN ID of 0x9000000000000000 on bogonvio1, but on bogonvio2 it's 0x8c +00000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (barbazfoo_foovg has a +LUN ID of 0x9200000000000000 on bogonvio1, but on bogonvio2 it's 0x8e +00000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (barbarfoo_bar01 has a +LUN ID of 0x8a00000000000000 on bogonvio1, but on bogonvio2 it's 0x8b +00000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (barbarfoo_bar02 has a +LUN ID of 0x8b00000000000000 on bogonvio1, but on bogonvio2 it's 0x8c +00000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (barbarfoo_bar03 has a +LUN ID of 0x8c00000000000000 on bogonvio1, but on bogonvio2 it's 0x83 +00000000000000) Ultraviolet: LUN Name-to-ID mismatch detected. (barbarfoo_bar04 has a +LUN ID of 0x8300000000000000 on bogonvio1, but on bogonvio2 it's 0x84 +00000000000000)
Here's the code:

#!/usr/bin/perl ## ## Ultraviolet 0.1 written 060613 by Bowie Poag ## ## Ultraviolet examines two VIO servers and attempts to divine if thei +r configurations are logically equivalent. ## If not, it reports the discrepancies. ## ## Usage: ultraviolet.pl <vioA> <vioB> ## ## Example: ultraviolet.pl argonvioA.foo.com argonvioB.foo.com ## ## use Data::Dumper; ## The above dependency is optional. It's only there in the event you +wish to examine the hash visually... in which case, set $DEBUG to 1. $DEBUG=0; $vioA=$ARGV[0]; $vioB=$ARGV[1]; gatherConfigurations(); buildConfigHashes(); compareContents(); reportAnyProblems(); sub gatherConfigurations() { print "\nUltraviolet: Starting up..\n"; print "Ultraviolet: Collecting configuration info from $vioA and +$vioB.."; @lsmapDumpA=vioCommand("vio",$vioA,"lsmap -all"); print ".."; @templspvDumpA=vioCommand("vio",$vioA,"lspv"); print ".."; @lsmapDumpB=vioCommand("vio",$vioB,"lsmap -all"); print ".."; @templspvDumpB=vioCommand("vio",$vioB,"lspv"); print "..\n"; ## We don't care about hdisk enumeration, so, let's get that out +of the way. foreach $item (@templspvDumpA) { chomp($item); $item=~s/hdisk\d+\s+//g; $item=~s/\s+/ /g; $item=~s/None//g; if ($item=~/None/i) { push (@lspvDumpA,$item); } } foreach $item (@templspvDumpB) { chomp($item); $item=~s/hdisk\d+\s+//g; $item=~s/\s+/ /g; $item=~s/None//g; if ($item=~/None/i) { push (@lspvDumpB,$item); } } @lspvDumpA=sort @lspvDumpA; @lspvDumpB=sort @lspvDumpB; $vioAPVCount=scalar @lspvDumpA; $vioBPVCount=scalar @lspvDumpB; if ($DEBUG==1) { foreach $item (@lspvDumpA) { print "Ultraviolet: $vioA LSPV: $item\n"; } foreach $item (@lspvDumpB) { print "Ultraviolet: $vioB LSPV: $item\n"; } } } sub compareContents() { $numValidPVIDs=0; printf ("Ultraviolet: %-20s %-6s %-50s\n","Test","Result","Note +s"); print "Ultraviolet: --------------------------------------------- +----------------------------------------------------\n"; ## ## PV Count Test. ## if ($vioAPVCount!=$vioBPVCount) { printf ("Ultraviolet: %-20s %-6s %-50s\n","PV Count","FAIL +","Mismatch detected!"); push (@problems,"The number of PVs differs between $vioA and + $vioB. $vioA has $vioAPVCount PVs, and $vioB has $vioBPVCount PVs. B +oth should be equal.\n"); } else { printf ("Ultraviolet: %-20s %-6s %-50s\n","PV Count","PASS +","Overall PV counts are equivalent between VIO servers."); } ## ## PVID A-to-B Match Test ## foreach $item (@lspvDumpA) { if (grep(/$item/,@lspvDumpB)) { $numValidPVIDs++; } } if ($numValidPVIDs==$vioAPVCount) { printf ("Ultraviolet: %-20s %-6s %-50s\n","PV Match A + to B","PASS","All PVIDs present on $vioA are present on $vioB."); } else { printf ("Ultraviolet: %-20s %-6s %-50s\n","PV Match A + to B","FAIL","One or more PVIDs found on $vioA were not found on $vi +oB."); push (@problems,"PVID $item exists on $vioA, but does n +ot exist on $vioB\n"); } $numValidPVIDs=0; ## ## PVID B-to-A Match Test ## foreach $item (@lspvDumpB) { if (grep(/$item/,@lspvDumpA)) { $numValidPVIDs++; } } if ($numValidPVIDs==$vioBPVCount) { printf ("Ultraviolet: %-20s %-6s %-50s\n","PV Match B to A +","PASS","All PVIDs present on $vioB are present on $vioA."); } else { printf ("Ultraviolet: %-20s %-6s %-50s\n","PV Match B to A +","FAIL","One or more PVIDs found on $vioB were not found on $vioA.") +; push (@problems,"PVID $item exists on $vioB, but does not ex +ist on $vioA\n"); } ## ## Vhost Count Test ## $numActiveVhostsA=scalar(keys %vioA); $numActiveVhostsB=scalar(keys %vioB); if ($numActiveVhostsA==$numActiveVhostsB) { printf ("Ultraviolet: %-20s %-6s %-50s\n","Active Vhost Co +unt","PASS","The same number of vhosts are active on both VIO servers +."); } else { printf ("Ultraviolet: %-20s %-6s %-50s\n","Active Vhost Co +unt","FAIL","$vioA and $vioB have differing numbers of vhosts with st +orage mapped to them."); push (@problems,"The number of vhosts with storage mapped to + them differs between $vioA and $vioB.. $numActiveVhostsA and $numAct +iveVhostsB, respectively."); } ## ## LPAR Count Test ## $LPARCountA=0; $LPARCountB=0; foreach $item (sort keys %vioA) { $LPARCountA++; } foreach $item (sort keys %vioB) { $LPARCountB++; } if ($LPARCountA==$LPARCountB) { printf ("Ultraviolet: %-20s %-6s %-50s\n","Involved LPAR C +ount","PASS","The same number of of LPARS are involved on both VIO se +rvers."); } else { printf ("Ultraviolet: %-20s %-6s %-50s\n","Involved LPAR C +ount","FAIL","The VIO servers have differing numbers of LPARs involve +d..$LPARCountA and $LPARCountB, respectively."); push (@problems,"The number of LPARs that have storage mappe +d to them differ in number between $vioA and $vioB." ); } @LPARsOnA=sort keys %vioA; @LPARsOnB=sort keys %vioB; $numValidLPARs=0; foreach $item (@LPARsOnA) { if (grep(/$item/,@LPARsOnB)) { $numValidLPARs++; } } if ($numValidLPARs==$LPARCountA) { printf ("Ultraviolet: %-20s %-6s %-50s\n","LPARs A to B"," +PASS","All LPARs mentioned on $vioA are present on $vioB."); } else { printf ("Ultraviolet: %-20s %-6s %-50s\n","LPARs A to B"," +FAIL","Not all LPARs mentioned on $vioA are present on $vioB."); push (@problems,"Not all LPARs mentioned on $vioA are presen +t on $vioB." ); } $numValidLPARs=0; foreach $item (@LPARsOnB) { if (grep(/$item/,@LPARsOnA)) { $numValidLPARs++; } } if ($numValidLPARs==$LPARCountB) { printf ("Ultraviolet: %-20s %-6s %-50s\n","LPARs B to A"," +PASS","All LPARs mentioned on $vioB are present on $vioA."); } else { printf ("Ultraviolet: %-20s %-6s %-50s\n","LPARs B to A"," +FAIL","Not all LPARs mentioned on $vioB are present on $vioA."); push (@problems,"Not all LPARs mentioned on $vioB are presen +t on $vioA." ); } ## ## Definition Test (status, backingDevice, physLoc, ID..) ## foreach $LPAR (@LPARsOnA) { foreach $vhost (keys $vioA{$LPAR}) { foreach $LUN (keys $vioA{$LPAR}{$vhost}) { if ($vioA{$LPAR}{$vhost}{$LUN}{ID} ne $vioB{$LPAR} +{$vhost}{$LUN}{ID}) { push (@problems, "LUN Name-to-ID mismatch det +ected. ($LUN has a LUN ID of $vioA{$LPAR}{$vhost}{$LUN}{ID} on $vioA, + but on $vioB it's $vioB{$LPAR}{$vhost}{$LUN}{ID})"); $LUNIDMatchTestFail=1; } if ($vioA{$LPAR}{$vhost}{$LUN}{backingDevice} ne $ +vioB{$LPAR}{$vhost}{$LUN}{backingDevice}) { push (@problems, "Backing device mismatch det +ected. ($LUN is $vioA{$LPAR}{$vhost}{$LUN}{backingDevice} on $vioA, b +ut on $vioB it's $vioB{$LPAR}{$vhost}{$LUN}{backingDevice})"); $LUNBackingDeviceTestFail=1; } } } } if ($LUNIDMatchTestFail==0) { printf ("Ultraviolet: %-20s %-6s %-50s\n","LUN ID Match"," +PASS","LUN IDs match between $vioA and $vioB."); } else { printf ("Ultraviolet: %-20s %-6s %-50s\n","LUN ID Match"," +FAIL","LUN IDs don't match between $vioA and $vioB."); } if ($LUNBackingDeviceTestFail==0) { printf ("Ultraviolet: %-20s %-6s %-50s\n","Backing Device +Match","PASS","Backing devices match between $vioA and $vioB."); } else { printf ("Ultraviolet: %-20s %-6s %-50s\n","Backing Device +Match","FAIL","The hdisk enumeration is different between $vioA and $ +vioB."); } } sub reportAnyProblems() { print "Ultraviolet:\n"; print "Ultraviolet: Problems found:\n"; print "Ultraviolet:\n"; @problems=sort(@problems); foreach $item (@problems) { print "Ultraviolet: $item\n"; } } sub buildConfigHashes() { print "Ultraviolet: Sorting things out.."; foreach $item (@lsmapDumpA) { chomp ($item); $item=~s/\s+/ /g; @tempA=split(" ",$item); if ($tempA[0]=~/vhost/) { $vhost=$tempA[0]; $LPAR=$tempA[2]; $DEBUG && print "Ultraviolet: Discovered new vhost on $ +LPAR: $vhost\n"; } if ($tempA[0]=~/VTD/) { $LUNName=$tempA[1]; if ($LUNName=~/NO/) { $DEBUG && print "Ultraviolet: No LUNs are mapped t +o $vhost.\n"; } else { $vioA{$LPAR}{$vhost}{$LUNName}{ID}="Unknown"; $DEBUG && print "Ultraviolet: Found new LUN m +apping for $vioA $vhost: $LUNName\n"; } } if ($tempA[0]=~/Status/) { $LUNStatus=$tempA[1]; $vioA{$LPAR}{$vhost}{$LUNName}{status}=$LUNStatus; $DEBUG && print "Ultraviolet: Status for this + LUN is: $LUNStatus\n"; } if ($tempA[0]=~/LUN/) { $LUNID=$tempA[1]; $vioA{$LPAR}{$vhost}{$LUNName}{ID}=$LUNID; $DEBUG && print "Ultraviolet: LUN ID for for +this LUN is: $LUNID\n"; } if ($tempA[0]=~/Backing/) { $backingDevice=$tempA[2]; $vioA{$LPAR}{$vhost}{$LUNName}{backingDevice}=$backingD +evice; $DEBUG && print "Ultraviolet: Backing device +for this LUN is $backingDevice.\n"; } if ($tempA[0]=~/Physloc/) { $LUNPhysLoc=$tempA[1]; $vioA{$LPAR}{$vhost}{$LUNName}{physLoc}=$LUNPhysLoc; $DEBUG && print "Ultraviolet: Physical locati +on for this LUN is $LUNPhysLoc.\n"; } } print "..."; foreach $item (@lsmapDumpB) { chomp ($item); $item=~s/\s+/ /g; @tempB=split(" ",$item); if ($tempB[0]=~/vhost/) { $vhost=$tempB[0]; $LPAR=$tempB[2]; $DEBUG && print "Ultraviolet: Discovered new vhost on $ +LPAR: $vhost\n"; } if ($tempB[0]=~/VTD/) { $LUNName=$tempB[1]; if ($LUNName=~/NO/) { $DEBUG && print "Ultraviolet: No LUNs are mapped t +o $vhost.\n"; } else { $vioB{$LPAR}{$vhost}{$LUNName}{ID}="Unknown"; $DEBUG && print "Ultraviolet: Found new LUN m +apping for $vioB $vhost: $LUNName\n"; } } if ($tempB[0]=~/Status/) { $LUNStatus=$tempB[1]; $vioB{$LPAR}{$vhost}{$LUNName}{status}=$LUNStatus; $DEBUG && print "Ultraviolet: Status for this + LUN is: $LUNStatus\n"; } if ($tempB[0]=~/LUN/) { $LUNID=$tempB[1]; $vioB{$LPAR}{$vhost}{$LUNName}{ID}=$LUNID; $DEBUG && print "Ultraviolet: LUN ID for for +this LUN is: $LUNID\n"; } if ($tempB[0]=~/Backing/) { $backingDevice=$tempB[2]; $vioB{$LPAR}{$vhost}{$LUNName}{backingDevice}=$backingD +evice; $DEBUG && print "Ultraviolet: Backing device +for this LUN is $backingDevice.\n"; } if ($tempB[0]=~/Physloc/) { $LUNPhysLoc=$tempB[1]; $vioB{$LPAR}{$vhost}{$LUNName}{physLoc}=$LUNPhysLoc; $DEBUG && print "Ultraviolet: Physical locati +on for this LUN is $LUNPhysLoc.\n"; } } print "\n"; ##$DEBUG && print Dumper (\%vioB); ##$DEBUG && print "\n-------------------------------------------- +---------------\n"; ##$DEBUG && print Dumper (\%vioB); } sub vioCommand($$$) { my $cmdType=shift; my $vioServer=shift; my $cmdStr=shift; my $sshCmd=''; if ($cmdType=~/aix/i) { $sshCmd="echo \"$cmdStr\" | ioscli oem_setup_env"; } elsif ($cmdType=~/vio/i) { $sshCmd="ioscli $cmdStr"; } else { die ("Improper command type.\n"); } my @retvalue=`ssh padmin\@$vioServer '$sshCmd'`; chomp(@retvalue); return @retvalue; }


In reply to Ultraviolet: A script for cross-checking VIO server configurations in a IBM Power(n) LPAR environment by bpoag

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (3)
    As of 2014-09-24 03:21 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (244 votes), past polls