1. 程式人生 > >【轉】How to check HBA host and its corresponding WWPN on RHEL 5, 6 or 7?

【轉】How to check HBA host and its corresponding WWPN on RHEL 5, 6 or 7?

https://access.redhat.com/solutions/55334

 SOLUTION UNVERIFIED - 已更新 2018年二月6日05:35 - 

English 

環境

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • FC/FCoE Host Bus Adapter (QLogic, Emulex, Brocade, Cisco, etc.)

問題

  • How to check HBA host and its corresponding WWPN?
  • How do I lookup WWN of installed HBAs?
  • How do I locate the world wide number of an hba WWPN (world wide port name)?
  • How do I locate the world wide name of an hba?
  • How to find out which Port Name is being used by an HBA Fibre Channel port?
  • I need to associated my HBA ports WWPN within the Fibre Channel switch. How can I found out the correct name?

決議

 

  • For more information about setting up SAN storage refer to the appropriate storage guide:

  • The wwpn (world wide port name) and companion wwnn (world wide node name) of an hba within the current configuration are available within the sysfs tree, can be found using a find

     command and viewed either via systool command from sysfsutils package (#yum install sysfsutils), or via simple grep command:

Raw

$ find /sys/class/fc_host/*/ -name 'port_name'             << retrieve path to wwpn entry
$ find /sys/class/fc_host/*/ -name 'node_name'             << retrieve path to wwnn entry


$ grep -v "zZzZ" -H /sys/class/fc_host/host*/*_name
/sys/class/fc_host/host6/fabric_name:0x100000051e900105    << switch port name, wwpn
/sys/class/fc_host/host6/node_name:0x200000e08b87de9a      <<    HBA node name, wwnn
/sys/class/fc_host/host6/port_name:0x210000e08b87de9a      <<    HBA port name, wwpn
/sys/class/fc_host/host6/symbolic_name:QLE2462 FW:v7.03.00 DVR:v8.07.00.18.07.2-k
:
.

In the case where it is insufficient to know just the WWNN/WWPN that exists for a scsi host and it is desired 
to know the actual pci address assigned to a particular scsi host -- then the following can be used:
$ find ./sys/devices -type d -name 'host*' | egrep -v "host_busy|fc_host|scsi_host" | sort
./sys/devices/pci0000:00/0000:00:01.0/0000:04:00.0/host4
./sys/devices/pci0000:00/0000:00:04.0/0000:08:00.0/host10
./sys/devices/pci0000:00/0000:00:05.0/0000:0b:00.0/host5
./sys/devices/pci0000:00/0000:00:07.0/0000:0e:00.0/host8
./sys/devices/pci0000:00/0000:00:07.0/0000:0e:00.1/host9
./sys/devices/pci0000:00/0000:00:0a.0/0000:14:00.0/host6   <<   card pci address for host6/scsi6
./sys/devices/pci0000:00/0000:00:0a.0/0000:14:00.1/host7
:
.


$ systool -c fc_host -v
Class = "fc_host"

  Class Device = "host6"
  Class Device path = "/sys/devices/pci0000:00/0000:00:0a.0/0000:14:00.0/host6/fc_host/host6"
    dev_loss_tmo        = "45"
    fabric_name         = "0x100000051e900105"             << switch port name, wwpn
    issue_lip           = 
    max_npiv_vports     = "127"
    node_name           = "0x200000e08b87de9a"             <<   HBA node name, wwnn
    npiv_vports_inuse   = "0"
    port_id             = "0x010300"
    port_name           = "0x210000e08b87de9a"             <<   HBA port name, wwpn
    port_state          = "Online"
    port_type           = "NPort (fabric via point-to-point)"
    speed               = "4 Gbit"
    supported_classes   = "Class 3"
    supported_speeds    = "1 Gbit, 2 Gbit, 4 Gbit"
    symbolic_name       = "QLE2462 FW:v7.03.00 DVR:v8.07.00.18.07.2-k"
    system_hostname     = ""
    tgtid_bind_type     = "wwpn (World Wide Port Name)"
    uevent              = 
:
.
  • Additional information is available within "How do I find the FC ID (WWN) of a disk/LUN", which discusses end-to-end transport identification (disk, scsi address, host [hba/pci address], switch port, storage port, lun). This references an unsupported/as-is utility called mapdevs that can be run on RHEL 5, 6, and 7 to display, among other things, an hba-to-storage wwn map.

Raw

# ./mapdevs -Hp
#scsi_addr   name                   version                f/w                       device
#----------- ---------------------- ---------------------- ------------------------- ----------------------------------------------
:
 6:*:*:*     qla2xxx                8.07.00.38.07.4-k1     8.06.00 (9496)            /sys/devices/pci0000:00/0000:00:0a.0/0000:14:00.0/host6
 7:*:*:*     qla2xxx                8.07.00.38.07.4-k1     8.06.00 (9496)            /sys/devices/pci0000:00/0000:00:0a.0/0000:14:00.1/host7

#            --------- PCI -------------
#                          subsystem      model        model
#scsi_addr   vendor device vendor device  name         description
#----------- ------ ------ ------ ------  ------------ --------------------------------------------------
:
 6:*:*:*     0x1077 0x2432 0x1077 0x0138  QLE2462      PCI-Express Dual Channel 4Gb Fibre Channel HBA
 7:*:*:*     0x1077 0x2432 0x1077 0x0138  QLE2462      PCI-Express Dual Channel 4Gb Fibre Channel HBA

#scsi_addr   name               speed    state    symbolic_name                                  port_type
#----------- ------------------ -------- -------- ---------------------------------------------- -----------------------------------------------
:
 6:*:*:*     qla2xxx            4 Gbit   Online   QLE2462 FW:v8.06.00 DVR:v8.07.00.38.07.4-k1    NPort (fabric via point-to-point)
 7:*:*:*     qla2xxx            4 Gbit   Online   QLE2462 FW:v8.06.00 DVR:v8.07.00.38.07.4-k1    NPort (fabric via point-to-point)


:
#SCSI               HBA                                             Fabric              Storage                                        Port
#Addr          Luns wwnn               wwpn               portid    wwn                 wwnn               wwpn                portid  info
#------------- ---- ------------------/------------------/--------  ------------------  ------------------/------------------/--------/---------    
6:0:0:-          65 0x200000e08b87de9a 0x210000e08b87de9a 0x010300  0x100000051e900105  0x5001438005663d33 0x5001438005663d32 0x0a0400 FCP Target
6:0:1:-          67 0x200000e08b87de9a 0x210000e08b87de9a 0x010300  0x100000051e900105  0x5001438005663d31 0x5001438005663d30 0x0a0500 FCP Target
6:0:2:-           - 0x200000e08b87de9a 0x210000e08b87de9a 0x010300  0x100000051e900105  0x20000024ff0d7d65 0x21000024ff0d7d65 0x010800 FCP Target
6:0:x:-           - 0x200000e08b87de9a 0x210000e08b87de9a 0x010300  0x100000051e900105  0x2000001018d6aa11 0x2001001018d6aa11 0x0a0e01 FCP Initiator
6:0:x:-           - 0x200000e08b87de9a 0x210000e08b87de9a 0x010300  0x100000051e900105  0x200100e08ba7de9a 0x210100e08ba7de9a 0x010600 FCP Initiator
6:0:x:-           - 0x200000e08b87de9a 0x210000e08b87de9a 0x010300  0x100000051e900105  0x20000090fa1927e8 0x10000090fa1927e8 0x0a0100 FCP Initiator
6:0:x:-           - 0x200000e08b87de9a 0x210000e08b87de9a 0x010300  0x100000051e900105  0x20000090fa1927e9 0x10000090fa1927e9 0x0a0000 FCP Initiator
6:0:x:-           - 0x200000e08b87de9a 0x210000e08b87de9a 0x010300  0x100000051e900105  0x20000090fa16f41e 0x10000090fa16f41e 0x010200 FCP Initiator
6:0:x:-           - 0x200000e08b87de9a 0x210000e08b87de9a 0x010300  0x100000051e900105  0x20000090fa16f41f 0x10000090fa16f41f 0x010700 FCP Initiator
:
.