VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Set Out standing IO value to all Naa

Hi,

I would like to set the out standing IO value to all naa devices using the input csv file.

Is there a way to perform using the PowerCLI for below command

esxcli storage core device set -O 128 -d naa.6000xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Please help

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You could try something like this

Get-VMHost -PipelineVariable esx |

ForEach-Object -Process {

    $esxcli = Get-EsxCli -VMHost $esx -V2

    Import-Csv -Path .\names.csv -UseCulture -PipelineVariable row |

    ForEach-Object -Process {

        try{

            $lun = $esxcli.storage.core.device.list.Invoke(@{device="$($row.CanonicalName)"})

            if($lun.NoofoutstandingIOswithcompetingworlds -ne 128){

                $newValue = @{

                    device = "$($row.CanonicalName)"

                    schednumreqoutstanding = 128

                }

                $esxcli.storage.core.device.set.Invoke()

                Write-Host "LUN $($row.CanonicalName) on $($esx.Name) outstanding IO value set to 128"

            }

            else{

                Write-Host "LUN $($row.CanonicalName) on $($esx.Name) already has outstanding IO value of 128"

            }

        }

        catch{

            Write-Host "LUN $($row.CanonicalName) not found on $($esx.Name)"

        }

    }

}


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Just to make sure I understand correctly, you have the CanonicalName of the LUN and the IO value in the CSV?


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

0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Hi LucD,

I have CanonicalName of the LUN in the list, I want to change the value from 32 to 128

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You could try something like this

Get-VMHost -PipelineVariable esx |

ForEach-Object -Process {

    $esxcli = Get-EsxCli -VMHost $esx -V2

    Import-Csv -Path .\names.csv -UseCulture -PipelineVariable row |

    ForEach-Object -Process {

        try{

            $lun = $esxcli.storage.core.device.list.Invoke(@{device="$($row.CanonicalName)"})

            if($lun.NoofoutstandingIOswithcompetingworlds -ne 128){

                $newValue = @{

                    device = "$($row.CanonicalName)"

                    schednumreqoutstanding = 128

                }

                $esxcli.storage.core.device.set.Invoke()

                Write-Host "LUN $($row.CanonicalName) on $($esx.Name) outstanding IO value set to 128"

            }

            else{

                Write-Host "LUN $($row.CanonicalName) on $($esx.Name) already has outstanding IO value of 128"

            }

        }

        catch{

            Write-Host "LUN $($row.CanonicalName) not found on $($esx.Name)"

        }

    }

}


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

0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Perfect LucD. That worked. Smiley Happy

0 Kudos