вторник, 1 апреля 2014 г.

How to find information of a HBA card (WWN, …) on Rad Hat Linux

The /sys/class/fc_host directory contents information for all HBAs. A directory called hostX (the count begins at 1) is created for each available interfaces.

cd /sys/class/fc_host/
ls
host1  host2
In the directory you could find a lot of information like the speed of the connection, the status, the WWN, …
cd host1
ls
device        issue_lip        npiv_vports_inuse  port_state  speed       supported_classes  system_hostname  vport_create
dev_loss_tmo  max_npiv_vports  port_id            port_type   statistics  supported_speeds   tgtid_bind_type  vport_delete
fabric_name   node_name        port_name          power       subsystem   symbolic_name      uevent
Show the state :
cat port_state
Online
Show the speed :
cat speed
4 Gbit
Show the WWN :
cat port_name
0x21000042ee046678
But the easiest method consists to use the systool command that is not maybe installed by default. You can install it with the yum command :
yum install sysfsutils
If you cannot use yum you must install two rmp packages : libsysfs-version.ditribution.arch and sysfsutils-version.ditribution.arch.

The following command shows you all information for a card (the hosX value finded previously must be yused as parameter) :
systool -c fc_host -v -d hostX
systool -c fc_host -v -d host1
Class = "fc_host"
  Class Device = "host1"
  Class Device path = "/sys/devices/pci0000:00/0000:00:05.0/0000:03:00.0/host1/fc_host/host1"
    dev_loss_tmo        = "45"
    fabric_name         = "0x1000000422b4bc02"
    issue_lip           = <store method only>
    max_npiv_vports     = "127"
    node_name           = "0x20000042ee046678"
    npiv_vports_inuse   = "0"
    port_id             = "0xdeb580"
    port_name           = "0x21000042ee046678"
    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       = "QLE2460 FW:v5.06.05 DVR:v8.04.00.04.06.3-k"
    system_hostname     = ""
    tgtid_bind_type     = "wwpn (World Wide Port Name)"
    uevent              =
    vport_create        = <store method only>
    vport_delete        = <store method only>
    Device = "host1"
    Device path = "/sys/devices/pci0000:00/0000:00:05.0/0000:03:00.0/host1"
      fw_dump             =
      nvram               = "ISP "
      optrom              =
      optrom_ctl          = <store method only>
      reset               = <store method only>
      sfp                 = ""
      uevent              = "DEVTYPE=scsi_host"
      vpd                 = "0"