From owner-freebsd-scsi@FreeBSD.ORG Thu May 3 05:51:18 2012 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD6AD106566B for ; Thu, 3 May 2012 05:51:18 +0000 (UTC) (envelope-from trent@snakebite.org) Received: from exchange.liveoffice.com (exchla3.liveoffice.com [64.70.67.188]) by mx1.freebsd.org (Postfix) with ESMTP id AE4F88FC0C for ; Thu, 3 May 2012 05:51:18 +0000 (UTC) Received: from EXHUB03.exchhosting.com (192.168.11.104) by exhub09.exchhosting.com (192.168.11.107) with Microsoft SMTP Server (TLS) id 8.3.213.0; Wed, 2 May 2012 22:50:10 -0700 Received: from EXMBX10.exchhosting.com ([fe80::9c37:32f6:a508:a44f]) by EXHUB03.exchhosting.com ([fe80::ac41:fbe5:3959:ad64%12]) with mapi; Wed, 2 May 2012 22:50:11 -0700 From: Trent Nelson To: "freebsd-scsi@freebsd.org" Date: Wed, 2 May 2012 22:50:09 -0700 Thread-Topic: Programmatically getting a FC drive's WWNN, WWPN and PortID Thread-Index: Ac0o8JmdTdfGf10bRCydae+Sqzy33g== Message-ID: <6C58B329-2DFC-4F2A-9FE1-F47B142748FD@snakebite.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Programmatically getting a FC drive's WWNN, WWPN and PortID X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2012 05:51:18 -0000 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: 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: 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.