VMware Cloud Community
zenivox
Hot Shot
Hot Shot
Jump to solution

PowerCLI not catching the FIXED preferred path

Hello I need to write a report that lists the LUNs preferred path but it seems that PowerCLI does not catch the parameter in question. In the web client H5 I can read them fine. vCenter server 6.5/6816762, ESXi hosts 6U3 6921384 (which include the fixed path bug fix), and Compellent Live Volumes LUNs. Here's the script, it runs fine but it lists zero LUNs. If I change the filter on the Preferred property to False I get all of them. Anybody experiencing this?

$prefpath = foreach($esx in (Get-Cluster myCluster | Get-VMHost)){

foreach($lun in (Get-ScsiLun -VMHost $esx | ?{$_.RuntimeName.Split(":")[3] -notmatch "L256|L257" -and $_.IsLocal -ne "True" -and $_.MultipathPolicy -eq "Fixed"})){

Get-ScsiLunPath -ScsiLun $lun | ?{$_.Preferred -match "True"} | Select @{N="Host";E={$esx.Name}},@{N="LUN";E={$lun.CanonicalName}},LunPath,Preferred

     }

}

$prefpath

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Can you try with a limited Where-clause?

Just keep the Fixed policy in there, like this

foreach($lun in (Get-ScsiLun -VMHost $esx | Where-Object{$_.MultipathPolicy -eq "Fixed"})){ 

Does that make any difference?

As an alternative can you check with

foreach($esx in (Get-Cluster -Name myCluster | Get-VMHost)){

    $esxcli = Get-EsxCli -VMHost $esx

    $esxcli.storage.nmp.device.list() | where{$_.PathSelectionPolicy -eq 'VMW_PSP_FIXED'} |

        Select @{N='VMHost';E={$esx.Name}},

            Device,

            @{N='PathSelectionPolicy';E={$_.PathSelectionPolicy}},

            @{N='PreferredPath';E={$_.PathSelectionPolicyDeviceConfig.TrimStart('{').Split(';')[0].Replace('preferred=','')}}

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
5 Replies
RAJ_RAJ
Expert
Expert
Jump to solution

Can u just run only below command and check the output

Get-VMHost | Get-ScsiLun -LunType disk

RAJESH RADHAKRISHNAN VCA -DCV/WM/Cloud,VCP 5 - DCV/DT/CLOUD, ,VCP6-DCV, EMCISA,EMCSA,MCTS,MCPS,BCFA https://ae.linkedin.com/in/rajesh-radhakrishnan-76269335 Mark my post as "helpful" or "correct" if I've helped resolve or answered your query!
0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

Thanks Raj, obviously command runs fine, what is it you need to check ?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Can you try with a limited Where-clause?

Just keep the Fixed policy in there, like this

foreach($lun in (Get-ScsiLun -VMHost $esx | Where-Object{$_.MultipathPolicy -eq "Fixed"})){ 

Does that make any difference?

As an alternative can you check with

foreach($esx in (Get-Cluster -Name myCluster | Get-VMHost)){

    $esxcli = Get-EsxCli -VMHost $esx

    $esxcli.storage.nmp.device.list() | where{$_.PathSelectionPolicy -eq 'VMW_PSP_FIXED'} |

        Select @{N='VMHost';E={$esx.Name}},

            Device,

            @{N='PathSelectionPolicy';E={$_.PathSelectionPolicy}},

            @{N='PreferredPath';E={$_.PathSelectionPolicyDeviceConfig.TrimStart('{').Split(';')[0].Replace('preferred=','')}}

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

Thanks Luc, the first does not work and the second suggestion works of course as it pulls info with esxcli. However it is confirmed then that Get-ScsiLunPath does not read the fixed preferred path property. Do you get that too? I don't know if you have any...

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Confirmed, I get that too.
I think the PowerCLI Team is aware, but it won't hurt to open a SR on this.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference