Stupid Perl mistake

While messing around with Perl I ran into the following error:

$ perl -e ‘use Time::Local print (localtime)[5] + 1900;’
syntax error at -e line 1, near “)[”
Execution of -e aborted due to compilation errors.

I asked Perl guru Peter Marschall if he knew what was wrong with this statement, and Peter mentioned that ‘print’ is trying to use the ‘(‘ and ‘)’ to enclose it’s argument list (which is not applicable here). Since I am still learning Perl, I don’t feel bad making mistakes (I am learning lots!)!

Dissecting Clariion WWPNs

When zoning hosts (actually HBA ports) to EMC Clariion SP ports, it is often beneficial to know which Clariion SP and port a WWPN is associated with. You can easily determine this by taking the Clariion WWPN (50:06:10:60:10:F3:84 in the following example) and breaking it down into three pieces:

              
EMC identifier        => 50:06:10 
SP and Port #         => :60:
WWN of the array      => 10:F3:84

The fourth octet (e.g., 60 in this example) contains the port and service processor, which can be identified by comparing the value to the following chart:

60 – SPA port 0
61 – SPA port 1
62 – SPA port 2
63 – SPA port 3
68 – SPB port 0
69 – SPB port 1
6A – SPB port 2
6B – SPB port 3

So in the case of WWPN 50:06:10:60:10:F3:84, the value 60 would map to service process A, port 0. Hopefully this information will save someone a walk to their data center (walking is good exercise, so I probably shouldn’t have posted this). :)

Executing commands when the shell exits

While pruning some cruft from my .profile, I came across several important trap(1) statements that I had defined some time back. If you are unfamiliar with trap(1), this nifty little shell built-in allows the shell to setup signal handlers, which define a series of actions to take if a specific signal is received. The following trap statement will cause the script named ‘~/hi’ to be executed when the user logs out of the shell:

$ trap ‘~/hi’ 0

$ cat hi
echo Howdy!
sleep 60

$ exit
logout
Howdy!
^C

The integer argument to trap(1) indicates the SIGNAL to trap (these are defined in /usr/include/sys/iso/signal_iso.h on Solaris systems), and 0 is a trap(1) constant that will invoke the action when the shell exits.

Emulex hbacmd utility

In my previous post on printing Emulex HBA statistics and resetting Emulex HBAs, I briefly touched on the hbacmd(1m) utility. hbacmd(1m) allows you to view configuration data and print numerous statistics, and is an invaluable resource for troubleshooting SAN problems. hbacmd(1m) lives in /usr/sbin/hbanyware, and provides a help screen when invoked with the “-h” (help) option:

$ hbacmd -h

Usage: hbacmd { h=IP Address or Hostname{:port} } 
Valid Commands:

    Version

    ListHBAs

    HBAAttrib 

    PortAttrib 

    PortStat 

    ServerAttrib 

    TargetMapping 

    Reset 

    Download  

    PersistentBinding  
        Source: {C L}
             C: Configuration
             L: Live

    AllNodeInfo 

    SetPersistentBinding      
        Scope: {P I B}
            P:  Bind set Permanently
            I:  Bind set Immediately
            B:  Bind set Both Immediately and at Reboot
        BindType: {D P N}
            D:  Enable binding by D_ID
            P:  Enable binding by WWPN
            N:  Enable binding by WWNN
        Id: Either WWPN, WWNN, or D_ID (depending on BindType)

    RemoveAllPersistentBinding 

    RemovePersistentBinding     
        BindType: {D P N}
            D:  Enable binding by D_ID
            P:  Enable binding by WWPN
            N:  Enable binding by WWNN
        Id: Either WWPN, WWNN, or D_ID (depending on BindType)

    BindingCapabilities 

    BindingSupport  
        Source: {C L}
             C: Configuration
             L: Live

    SetBindingSupport  
        BindFlag: {D P N A DA PA NA}
            D:  Enable binding by D_ID
            P:  Enable binding by WWPN
            N:  Enable binding by WWNN
            A:  Enable binding by AUTOMAP
            DA: Enable binding by D_ID and AUTOMAP
            PA: Enable binding by WWPN and AUTOMAP
            NA: Enable binding by WWNN and AUTOMAP

    DriverParams 

    DriverParamsGlobal 

    SetDriverParam    
        CtrlWord: {P G B N}
            P:  Permanent
            G:  Global
            B:  Both
            N:  Neither

    SetBootBios  
        CtrlWord: {E D}
            E:  Enable
            D:  Disable

To view all of the Emulex HBAs installed in a server, hbacmd(1m) can be invoked with the “listhbas” option:

$ hbacmd listhbas

Manageable HBA List

Port WWN   : 10:00:00:00:c9:49:28:42
Node WWN   : 20:00:00:00:c9:49:28:42
Fabric Name: 10:00:00:60:69:80:2d:ee
Flags      : 8000f980
Host Name  : server01
Mfg        : Emulex Corporation

Port WWN   : 10:00:00:00:c9:49:28:47
Node WWN   : 20:00:00:00:c9:49:28:47
Fabric Name: 10:00:00:60:69:80:0e:fc
Flags      : 8000f980
Host Name  : fraudmgmt01
Mfg        : Emulex Corporation

[ ..... ]

To list firmware versions, serial numbers, WWN and a variety of model specific information, the hbacmd(1m) utility can be invoked with the “hbaattrib” option and the WWN to probe:

$ hbacmd HBAAttrib 10:00:00:00:c9:49:28:47

HBA Attributes for 10:00:00:00:c9:49:28:47

Host Name      : server01
Manufacturer   : Emulex Corporation
Serial Number  : MS51403247
Model          : LP9802
Model Desc     : Emulex LightPulse LP9802 2 Gigabit PCI Fibre Channel Adapter
Node WWN       : 20 00 00 00 c9 49 28 47
Node Symname   : Emulex LP9802 FV1.91A1 DV6.02f
HW Version     : 2003806d
Opt ROM Version: 1.50a4
FW Version     : 1.91A1 (H2D1.91A1)
Vender Spec ID : 80F9
Number of Ports: 1
Driver Name    : lpfc
Device ID      : F980
HBA Type       : LP9802
Operational FW : SLI-2 Overlay
SLI1 FW        : SLI-1 Overlay 1.91a1
SLI2 FW        : SLI-2 Overlay 1.91a1
IEEE Address   : 00 00 c9 49 28 47
Boot BIOS      : Fcode Firmware1.50a4
Driver Version : 6.02f; HBAAPI(I) v2.0.e, 11-07-03

To view host port information (e.g., port speed, device paths) and fabric parameters (e.g., fabric ID (S_ID), # of ports zoned along with this port), hbacmd(1m) can be invoked with the “portattrib” option:

$ hbacmd PortAttrib 10:00:00:00:c9:49:28:47

Port Attributes for 10:00:00:00:c9:49:28:47

Node WWN            : 20 00 00 00 c9 49 28 47
Port WWN            : 10 00 00 00 c9 49 28 47
Port Symname        :
Port FCID           : 6D0900
Port Type           : Fabric
Port State          : Operational
Port Service Type   : 6
Port Supported FC4  : 00 00 01 20 00 00 00 01
                      00 00 00 00 00 00 00 00
                      00 00 00 00 00 00 00 00
                      00 00 00 00 00 00 00 00
Port Active FC4     : 00 00 01 20 00 00 00 01
                      00 00 00 00 00 00 00 00
                      00 00 00 00 00 00 00 00
                      00 00 00 00 00 00 00 00
Port Supported Speed: 2 GBit/sec.
Port Speed          : 2 GBit/sec.
Max Frame Size      : 2048
OS Device Name      : /devices/pci@84,2000/lpfc@1
Num Discovered Ports: 3
Fabric Name         : 10 00 00 60 69 80 0e fc

In addition to providing super high performance HBAS, Emulex has done a great job with their CLI (their GUI is actually pretty good as well) management utilites!