Date: Wed, 2 May 2012 22:50:09 -0700 From: Trent Nelson <trent@snakebite.org> To: "freebsd-scsi@freebsd.org" <freebsd-scsi@freebsd.org> Subject: Programmatically getting a FC drive's WWNN, WWPN and PortID Message-ID: <6C58B329-2DFC-4F2A-9FE1-F47B142748FD@snakebite.org>
next in thread | raw e-mail | index | archive | help
How can I programmatically get the WWNN, WWPN and PortID of a drive? T= he 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=20 da31: 200.000MB/s transfers WWNN 0x20000004cf83a4b2 WWPN 0x21000004= cf83a4b2 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= =20 pass32: Serial Number 3FP1G51L00007240R1BS pass32: 200.000MB/s transfers, Command Queueing Enabled It would be ace if camcontrol inquiry could be taught about WWNNs, WWPN= s and PortIDs. In the mean time, is there any `camcontrol cmd`-type magi= c 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> =3D Automatic optimal gmultipath/zpool configuration =20 Step 4 needs to be able to get at disk WWNN/WWPN/PortIDs for a given HB= A 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, Trent.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6C58B329-2DFC-4F2A-9FE1-F47B142748FD>