Hello all,
In the past months we managed to upgrade our infrastructure from 5.1 to 6.0 (that was a real pain to accomplish on such big environment). Now, we have this little annoyance with one of the scripts we were using. In order to pull out HBA Lun Path status, we used an script which counted the amount of Active, Death and standby paths. While the script it self works, hence the commands are fine, it is showing all paths as stand by. So, I thought it was an issue with the script, yet when I run it as a single line I still get same results. Any ideas why after upgrading command is showing different results?
Here is the single line and its output (obviously changing host name for security reasons) for some of the paths:
PowerCLI E:\Scripts> get-vmhost host01 | Get-VMHostHba -Type "FibreChannel" | Get-ScsiLun | Get-ScsiLunPath | select name, scsilun, state
Name ScsiLun State
---- ------- -----
vmhba5:C0:T3:L3,fc.20000024ff2f0305:21000024ff2f0305-f... naa.6005076801808631e000000000000363 Standby
vmhba5:C0:T2:L3,fc.20000024ff2f0305:21000024ff2f0305-f... naa.6005076801808631e000000000000363 Standby
vmhba64:C0:T3:L3,fc.20000024ff2f02d8:21000024ff2f02d8-... naa.6005076801808631e000000000000363 Standby
vmhba64:C0:T2:L3,fc.20000024ff2f02d8:21000024ff2f02d8-... naa.6005076801808631e000000000000363 Standby
vmhba64:C0:T0:L3,fc.20000024ff2f02d8:21000024ff2f02d8-... naa.60050768018106341800000000000358 Standby
vmhba5:C0:T1:L3,fc.20000024ff2f0305:21000024ff2f0305-f... naa.60050768018106341800000000000358 Standby
vmhba5:C0:T0:L3,fc.20000024ff2f0305:21000024ff2f0305-f... naa.60050768018106341800000000000358 Standby
vmhba64:C0:T1:L3,fc.20000024ff2f02d8:21000024ff2f02d8-... naa.60050768018106341800000000000358 Standby
Here is the script output for same server:
VMHost | HBA | Active Dead Standby |
------ | --- | ------ ---- ------- |
host01 vmhba64 0 | 0 | 72 |
host01 vmhba4 0 | 0 | 56 |
host01 vmhba65 0 | 0 | 56 |
host01 vmhba5 0 | 0 | 72 |
And which PowerCLI version are you using?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Several versions to be honest. I have tested from 5.1, 5.5. 6.0 release 3 and yesterday was testing on 6.5 update 1 (not sure who installed that one, but anyway, tested it).... All of them showed same results, all paths as standby. Now, something funny, if there are death paths, those are indeed shown as death both on command or script. So, the issue is why alive paths are being shown as standby at powercli level.
Do you get only standby paths on all ESXi nodes?
Does this show only standby?
Get-VMHost | Get-VMHostHba -Type "FibreChannel" | Get-ScsiLun | Get-ScsiLunPath | Group-Object -Property State
And does the result stay the same independent if you are connected to the vCenter or to an individual ESXi node?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Could you also have a look at 1. Re: Paths report not matching gui
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi all,
I have exactly the same issue. The gui reports the paths state correctly but using powercli, all my fc paths are stand by.
I tried different script but result is the same.
I use the last version of powercli. My host and vcenter are in vsphere 6.0.
I have the same result with vcenter or connected to the host directly.
Thanks .
What do these return
Get-VMHost | Get-VMHostHba -Type "FibreChannel" | Get-ScsiLun | Select *
Get-VMHost | Get-VMHostHba -Type "FibreChannel" | Get-ScsiLun | Get-ScsiLunPath | Select *
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
output , Get-VMHost | Get-VMHostHba -Type "FibreChannel" | Get-ScsiLun | Get-ScsiLunPath | Select *
hello LucD ,all the lun path reports state as standby , am not sure if this some kinda known issue ,.... need your assitance
That looks indeed like a problem.
I would suggest to create a SR (see PowerCLI Support Breakdown for some background info on PowerCLI and support)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello LucD
Contacted VMware wasn't really helpful in an early resolution as its a cosmetic problem as per kb 2149992 till then ,,,
i figured out an alternative while i was testing VMware powercli vs esxcli , i found esxcli output are fine , that is when i researched to find we can use esxcli in powercli
here's what i did ..
$AllHosts = Get-VMHost
$esxcli = Get-EsxCli -VMhost $AllHosts -V2
$esxcli.storage.core.path.list.invoke()| select DeviceDisplayName,Adapter , State
output simillar to
XX Fibre Channel Disk (naa.6012334892749287487290934098.. vmhba4 | active | |
XX Fibre Channel Disk (naa.6883482740872472742797297948... vmhba64 | active | |
XX Fibre Channel Disk (naa.6284372748270472947274027400... vmhba4 | active | |
XX Fibre Channel Disk (naa.6992480928409284982048208870... vmhba4 | active |
>> this helps me with results of getting 'State' results right as expected on webclient or viclient
LucD really need your help here , now that am able to get the state right using esxcli in powercli , i wanted this esxcli into this script by Andrew and Chris as below , Thanks to them ,
PowerCLI: Show HBA Path Status - The Practical Administrator
Or
You mean something like this?
foreach($esx in Get-VMHost){
$esxcli = Get-EsxCli -VMHost $esx -V2
foreach($adapter in $esxcli.storage.core.adapter.list.Invoke() | where{$_.Driver -match 'fc'}){
$esxcli.storage.core.path.list.Invoke() | where{$_.Adapter -eq $adapter.HBAName} |
Select @{N='VMHost';E={$esx.Name}},@{N='Adapter';E={$adapter.HBAName}},
Device,RuntimeName,State
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thank you for taking time LucD , am able get the output Host , Device HBA , State exactly as u mentioned , using this output can we integrate in the below script and get a count of active , standby , deadpaths
script from andrew ,
PowerCLI: Show HBA Path Status - The Practical Administrator
Try like this
foreach($esx in Get-VMHost){
$esxcli = Get-EsxCli -VMHost $esx -V2
foreach($adapter in $esxcli.storage.core.adapter.list.Invoke() | where{$_.Driver -match 'fc'}){
$obj = [ordered]@{
VMHost = $esx.Name
Adapter = $adapter.HBAName
Active = 0
Standby = 0
Dead = 0
}
$esxcli.storage.core.path.list.Invoke() | where{$_.Adapter -eq $adapter.HBAName} |
Group-Object -Property State | %{
$obj."$($_.Name)" = $_.Group.Count
}
New-Object PSObject -Property $obj
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you LucD !!! Thank you for taking your time , You make it look so simple , tested its working fine as expected, Thank you again for your guidance !!
Hi Lucd,
Thanks for the script, Could you please help me with exporting the results into csv format and can we run this only particular cluster
Try like this
foreach($esx in Get-VMHost){
$esxcli = Get-EsxCli -VMHost $esx -V2
foreach($adapter in $esxcli.storage.core.adapter.list.Invoke() | where{$_.Driver -match 'fc'}){
$obj = [ordered]@{
VMHost = $esx.Name
Adapter = $adapter.HBAName
Active = 0
Standby = 0
Dead = 0
}
$esxcli.storage.core.path.list.Invoke() | where{$_.Adapter -eq $adapter.HBAName} |
Group-Object -Property State | %{
$obj."$($_.Name)" = $_.Group.Count
}
$report += New-Object PSObject -Property $obj
}
}
$report | Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
Thanks for the reply.. It worked..
can we add hba taget and devices information as well to this. If it can be added it will be great..