One question I’ve been asked a number of times is, “How do I find my HBA WWNs with XenServer?” Typically, the easy answer is to use the HBA vendor’s tools -- hbanyware for Emulex and scli (FC) or iscli (iSCSI) for QLogic. XenServer 5.6 FP1 shipped with a conflict between the kernel and the libraries required for hbanyware to run, and therefore hbanyware cannot be used to interact with the HBAs. Luckily, there is a lot of information that can be gathered from the sys filesystem that can be used to accomplish the required storage tasks.

The following procedure is a quick ‘n dirty method to gather information from the HBAs. Note that it was tested with Emulex HBAs, but is expected to work with QLogic and other vendors, possibly with slight modification.

First, we need to identify the nodes in the sys filesystem that represent the HBAs. To do this I typically issue a find command for an element name that typically only exists for HBA devices:

[root@jeckle ~]# find /sys/class/scsi_host/ -name modelname

If “modelname” doesn’t return results try “model*”. This output tells us that our HBAs are represented by the host4 and host5 nodes. To get the WWN (actually, what you’re probably looking for is the Worldwide Port Name, or WWPN, for zoning and access control purposes) issue the following commands, replacing hostN with the proper numbers for your system:

cat /sys/class/scsi_host/host4/device/fchost\:host4/port_name
cat /sys/class/scsi_host/host5/device/fchost\:host5/port_name