Programmatically getting a FC drive's WWNN, WWPN and PortID

Matthew Jacob mj at feral.com
Thu May 3 13:37:47 UTC 2012


On 5/2/2012 10:50 PM, Trent Nelson wrote:
>      How can I programmatically get the WWNN, WWPN and PortID of a drive?  The
>      info is available via dmesg when the drive is detected:
>
>          % dmesg | grep da31
>          da31 at isp1 bus 0 scbus6 target 13 lun 0
>          da31:<SEAGATE ST336605FC 0005>  Fixed Direct Access SCSI-3 device
>          da31: 200.000MB/s transfers WWNN 0x20000004cf83a4b2 WWPN 0x21000004cf83a4b2 PortID 0xcd
>          da31: Command Queueing enabled
>          da31: 35003MB (71687371 512 byte sectors: 255H 63S/T 4462C)
>
>      I figured `camcontrol inquiry` would be my best shot, but no dice:
>
>          % camcontrol inquiry da31
>          pass32:<SEAGATE ST336605FC 0005>  Fixed Direct Access SCSI-3 device
>          pass32: Serial Number 3FP1G51L00007240R1BS
>          pass32: 200.000MB/s transfers, Command Queueing Enabled
>
>      It would be ace if camcontrol inquiry could be taught about WWNNs, WWPNs
>      and PortIDs.  In the mean time, is there any `camcontrol cmd`-type magic
>      I could use to get at the values?
>
>      Use case: some Python code I'm working on that basically does this:
>          <1. knowledge of which disks are in which JBOD arrays>  +
>          <2. knowledge of JBOD ports->SAN switch ports>  +
>          <3. knowledge of localhost HBA->SAN switch port>  +
>          <4. knowledge of localhost HBA->accessible disks by WWPN>  +
>          <5. knowledge of port bandwidth limits>  +
>          <6. knowledge of other systems' 'claimed' disks+paths>
>
>            = Automatic optimal gmultipath/zpool configuration
>
>      Step 4 needs to be able to get at disk WWNN/WWPN/PortIDs for a given HBA
>      in a programatic/reliable fashion (`dmesg | grep da33` isn't reliable).
>
>      If there isn't some sort of magic `camcontrol cmd` I can send in the
>      interim, I'm all ears for what I'd need to hack in order to implement
>      this functionality :-)
>
>      Regards,

There's a lot functionality like this that has never been completed in 
FreeBSD/camcontrol.
Linux sort of does this under sysfs, but really the right approach would 
have been to implement the SNIA HBAAPI interfaces.

That said, there are ioctls for some of this stuff for isp.

See http://people.freebsd.org/~mjacob/isp_tools.tgz


>          Trent.
>
> _______________________________________________
> freebsd-scsi at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-scsi
> To unsubscribe, send any mail to "freebsd-scsi-unsubscribe at freebsd.org"
>



More information about the freebsd-scsi mailing list