From owner-freebsd-scsi@FreeBSD.ORG Thu May 3 13:37:47 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 3B5E8106566B for ; Thu, 3 May 2012 13:37:47 +0000 (UTC) (envelope-from mj@feral.com) Received: from ns1.feral.com (ns1.feral.com [192.67.166.1]) by mx1.freebsd.org (Postfix) with ESMTP id E37DF8FC16 for ; Thu, 3 May 2012 13:37:46 +0000 (UTC) Received: from [192.168.135.100] (c-76-126-166-136.hsd1.ca.comcast.net [76.126.166.136]) (authenticated bits=0) by ns1.feral.com (8.14.4/8.14.4) with ESMTP id q43DbkeC029525 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Thu, 3 May 2012 06:37:46 -0700 (PDT) (envelope-from mj@feral.com) Message-ID: <4FA28A25.1010004@feral.com> Date: Thu, 03 May 2012 06:37:41 -0700 From: Matthew Jacob Organization: Feral Software User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: freebsd-scsi@freebsd.org References: <6C58B329-2DFC-4F2A-9FE1-F47B142748FD@snakebite.org> In-Reply-To: <6C58B329-2DFC-4F2A-9FE1-F47B142748FD@snakebite.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (ns1.feral.com [192.67.166.1]); Thu, 03 May 2012 06:37:46 -0700 (PDT) Subject: Re: Programmatically getting a FC drive's WWNN, WWPN and PortID X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: mj@feral.com List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2012 13:37:47 -0000 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: 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: 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@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-scsi > To unsubscribe, send any mail to "freebsd-scsi-unsubscribe@freebsd.org" >