Is using the NetApp PowerShell Toolkit an option?
Would be very simple to map the VMware datastore NFS mount to the ONTAP SVM LIF + junction path to get the volume (and aggr) info. For block based datastores, it's not much more difficult...use the LUN's naa ID to reverse engineer the ONTAP LUN serial number:
$naluns = Get-NcLun
$ds = Get-Datastore | ?{ $_.Type -eq "VMFS" }
$ds | %{
Write-Host "Finding LUNs for datastore $($_.Name)"
$luns = $_ | Get-ScsiLun | ?{ $_.CanonicalName -match "naa.600a0980*" }
if ($luns.length -gt 0) {
Write-Host " Found $($luns.length) paths"
$completed = @()
$luns | %{
if (!$completed.Contains($_.CanonicalName)) {
$hexSerial = ($_.CanonicalName).Substring(12)
$serial = for ($i = 0; $i -lt $hexSerial.length; $i += 2) {
[char][int]::Parse($hexSerial.substring($i,2), 'HexNumber')
}
$ntapSerial = $serial -join ""
Write-Host " NetApp LUN serial is: $($ntapSerial)"
$ntapLun = $naluns | ?{ $_.SerialNumber -eq $ntapSerial }
Write-Host " NetApp SVM: $($ntapLun.Vserver)"
Write-Host " LUN Path: $($ntapLun.Path)"
$completed += $_.CanonicalName
}
}
}
}
Note that I think ONTAP has two or three different naa IDs, so you'd want to include all of them in the expression above.
Hope that helps.
Andrew
If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.