Software Development Kit (SDK) and API Discussions
Software Development Kit (SDK) and API Discussions
Hi,
I am looking for ways to get NAA identifier for NetApp volumes and luns using DFM Server API. Does DFM's API provide such functionality?
Thanks in advance for any help.
Solved! See The Solution
Arguably the easiest way to map from a LUN to the corresponding datastore is to use the VSC. That's manual though, no programming involved.
If you need a program or a script to do the mapping, Rick's answer already was correct:
A LUN's 'naa.' number IS its WWN, it's just another name.
To get the WWN, you use the serial-number of the LUN, convert it to its hexadecimal ASCII representation* and prefix it with "naa.60a98000". You can get the LUN serial-number using the 'lun-list-info' API call (to a filer, not to the DFM).
Hope that clears it up.
* So, a '1' is 0x31, an 'a' is 0x61 etc.
Ok, folks, same story, but for c-mode?
There is no Get-NcLunSerialNumbercommand.
Just to remind you, simple script for 7-mode
$LUNs = Get-NaLun
foreach ($LUN in $LUNs)
{
$sn = Get-NaLunSerialNumber $LUN.Path
$b = $sn.ToCharArray();
Foreach ($element in $b) {$c = $c + [System.String]::Format("{0:X}", [System.Convert]::ToUInt32($element))}
$LUNWWN = "naa.60a98000" + $c
Write-Host $sn $LUNWWN $LUN.Path
}
Hi,
Sure it's possible to convert the LUN Serial number to its Naa number for clustered data ONTAP using PowerShell. Here is a simple example
Import-Module DataONTAP
$cluster = "cluster1.netapp.com"
$vserver = "vserver1"
$lunPath = "/vol/vol1/luns/lun1"
$identifier = "naa.600a0980"
$credentials = $host.ui.PromptForCredential("Connect to cluster $cluster", "Please enter the user name and password","","")
$cluster = Connect-NcController $cluster -Credential($cred)
$lun = Get-NcLun -Vserver $vserver -Path $lunPath -Controller $cluster
$serialNumber = $lun.SerialNumber
$ca = $serialNumber.ToCharArray();
$naasn = $null
Foreach($byte in $ca){
$naasn = $naasn + [System.String]::Format("{0:x}", [System.Convert]::ToUInt32($byte))
}
Write-Host "LunPath,LunSerial,NaaNumber"
Write-Host "$lunPath,$serialNumber,$identifier$naasn"
The output will look like:
LunPath,LunSerial,NaaNumber
/vol/vol1/luns/lun1,BpEwv$ElzqhW,naa.600a0980427045777624456c7a716857
Also note that you can use the "lun serial -x" command in ONTAP 8.3 if you'd prefer to use the CLI. See following KB
https://kb-stage.netapp.com/support/index?id=1012613&page=content&locale=en_US
/matt