VMware Solutions Discussions
VMware Solutions Discussions
Hi,
I have allocated couple of NetApp LUNs from different filer to a Vmware host ? Now how do I identify NetApp LUN IDs along with their Filer name or serial number ?
Thanks
Raj
Solved! See The Solution
Amrutha,
Welcome to the community.
These commands are not part of VMware powerCLI.
You should import Data ONTAP modules to your windows PowerShell instance to start using them. Here is a doc that will help you get started https://www.netapp.com/us/media/tr-4161.pdf
on esx host, go to configuration tab, storage adapters, then highlight the vmhba (fc or iscsi) that the lun is on. Change from "devices" tab to "paths" tab...scroll to target. There, you will find the system id of the netapp filer.
lun show -m
from the command line will show you all LUN ID's
Hope this helps.
Responding to an old question but in the event this will help someone else searching. To positively know that a particular NetApp mapped LUN is the same ESXi storage device:
TL:DR version is the VMware LUN identifier is the hex of the NetApp LUN Serial No. string.
Note an alternate method to get the NetApp LUN Serial No value is in the CLI. Use: lun show -v
This worked perfectly for me. I was able to find the serial and with the -v switch determine the serial of the LUN and match them
Thanks
You can use lun serial -x <lun_path>. With -x serial number is printed in HEX format.
Can you please tell me the equivalent command in C-mode.
Here is a PowerShell script I created which connects to both the VMware environment and the cDOT controller and reports on which NetApp LUNs back the datastore
Add-PSSnapin vmware.vimautomation.core Import-Module DataONTAP Connect-VIServer your.vcenter Connect-NcController your.cdot.system $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 } } } }
Sample output:
Finding LUNs for datastore GOLD Found 2 paths NetApp LUN serial is: T0ecH>0P3ekw NetApp SVM: VMware_SVM LUN Path: /vol/vmware_gold/vmware_gold.lun Finding LUNs for datastore SILVER Found 2 paths NetApp LUN serial is: MT-gv?E8Ec5t NetApp SVM: VMware_SVM LUN Path: /vol/vmware_silver/vmware_silver.lun
Hope that helps.
Andrew
Hi,
Iam quite new to PowerCLI . On executing your script inside vmware power CLI . I get the following.
1. No snapins registered fro powershell version 3.
2. Data ontap module not found in any module directory.
I get the error but could you please give me the exact workaround that needs to be setup or installed to run the such scripts successfully?.
Thanks,
Amrutha
Hi,
Could please tell me which environment did you excute this script . I executed it in vmware PowerCLI. But got some obvious erros like "Connect-NcController not a cmdlet". Where should the DataOntap module exist?
Amrutha,
Welcome to the community.
These commands are not part of VMware powerCLI.
You should import Data ONTAP modules to your windows PowerShell instance to start using them. Here is a doc that will help you get started https://www.netapp.com/us/media/tr-4161.pdf
Hi,
Right now iam able to write a PowerShell script where I can get the corresponding datastore name and device name (naa*) of a particular VM in Vsphere. But I want to know how to get the corresponding LUN id and the Target (iqn .*) . without uisng the Data Ontap modules( Guess this isnt required to get the above attributes).
Thanks,
Amrutha
That Powershell is neat but it has one problem.
Netapp LUN serials are case-sensitive, but the comparison used is case-insensitive. I wondered why I had more LUNs than expected ...
SO that should be "$ntapLun = $naluns | ?{ $_.SerialNumber -ceq $ntapSerial }"
That command would be 'lun show -fields serial' to show the serial number for all LUNs.
You can filter it down by vserver by doing 'lun show -vserver [vserver name] -fields serial' or by specific LUN using 'lun show -lun [lun name] -fields serial'
-prw
https://www.youtube.com/watch?v=NGpe27Xp1nQ