Automation

 View Only
  • 1.  Change to RR if SATP matches

    Posted Oct 10, 2011 01:54 PM

    Hello Luc,

    Can you pls correct it for me ? I dont know why i mess things up.I want to change every single path to RR if SATP -eq "VMW_SATP_SYMM" .Esxcli way i only found nmp.roundrobin.setconfig(bytes,device,iops,type,useano) method which can be used for devices. Multipathing is on LUN (device) level or path level ? Thank you in advance.

    $user = "root"
    $pswd = "xyz*"
    $psp = "VMW_PSP_RR"
    $satp = "VMW_SATP_SYMM"
    $oldConfig = Get-PowerCLIConfiguration
    Set-PowerCLIConfiguration -DefaultVIServerMode "Multiple" -Confirm:$false | Out-Null
    connect-VIServer -server vcenter -username abc -password "abc"
    $vmhost = Get-VMHost
    foreach($esx in $vmhost){
      $esxconnect = connect-VIServer -server $esx.name -user $user -password $pswd
      $esxcli = Get-EsxCli -Server $esxconnect | select Device, PathSelectionPolicy, StorageArrayType | Where {$_.StorageArrayType -eq "VMW_SATP_SYMM"} | %{
      $esxcli.nmp.satp.setdefaultpsp($psp, $satp)
      $esxcli.nmp.device.setpolicy($null, $_.device, $psp)
      $esxcli.nmp.roundrobin.setconfig($null, $_.device, 1, ”iops”, $null)
      Disconnect-VIServer -Server $esx.Name -Confirm:$false
          }}
    Set-PowerCLIConfiguration -DefaultVIServerMode $oldConfig.DefaultVIServerMode -Confirm:$false | Out-Null



  • 2.  RE: Change to RR if SATP matches
    Best Answer

    Posted Oct 10, 2011 07:34 PM

    I don't think that Select cmdlet will do the trick.

    $esxcli.nmp.device.list()

    commands to find the devices you want to reconfigure.

    The script would look something like this

    $user = "root" 
    $pswd
    = "xyz"
    $psp
    = "VMW_PSP_RR"
    $satp
    = "VMW_SATP_SYMM"
    $oldConfig
    = Get-PowerCLIConfiguration Set-PowerCLIConfiguration -DefaultVIServerMode "Multiple" -Confirm:$false | Out-Null connect-VIServer -server vcenter -username abc -password "abc"
    foreach
    ($esx in Get-VMHost){     $esxconnect = connect-VIServer -server $esx.name -user $user -password $pswd
        $esxcli = Get-EsxCli -Server $esxconnect
            $esxcli.nmp.satp.setdefaultpsp($psp, $satp)     $esxcli.nmp.device.list() | where {$_.StorageArrayType -eq $satp} | %{         $esxcli.nmp.device.setpolicy($null, $_.device, $psp)         $esxcli.nmp.roundrobin.setconfig($null, $_.device, 1, ”iops”, $null)     }     Disconnect-VIServer -Server $esx.Name -Confirm:$false
    } Set-PowerCLIConfiguration -DefaultVIServerMode
    $oldConfig.DefaultVIServerMode -Confirm:$false | Out-Null


  • 3.  RE: Change to RR if SATP matches

    Posted Oct 11, 2011 06:43 AM

    Thanks Luc. I spent a bit time on this last night. I run the one below.Exactly the same what you answered me.Today when i check the each devices Right click -> manage path > I still see "fixed" for  "VMW_SATP_SYMM" .Am I missing smth on that ? Also I have a few RDMs. Shall I worry about them ? It is not about scripting but what would you do if you were me ?

    $user = "root"

    $pswd = "abc

    $psp = "VMW_PSP_RR"

    $satp = "VMW_SATP_SYMM"

    $oldConfig = Get-PowerCLIConfiguration

    Set-PowerCLIConfiguration -DefaultVIServerMode "Multiple" -Confirm:$false | Out-Null

    connect-VIServer -server vcenter -username abc -password "password"

    foreach($esx in Get-VMHost){

    $esxConnect = Connect-VIServer -Server $esx.name -User $user -Password $pswd

    $esxcli = Get-EsxCli -Server $esxConnect

    $nmpdevicelist = $esxcli.nmp.device.list() | Where {$_.StorageArrayType -eq "VMW_SATP_SYMM"}

    foreach($item in $nmpdevicelist){

    $esxcli.nmp.device.setpolicy($null, $item.device, $psp) | Out-Null

    $esxcli.nmp.roundrobin.setconfig($null, $item.device, 1, "iops", $null) | Out-Null

    }

    $esxcli.nmp.satp.setdefaultpsp($psp, $satp) | Out-Null

    Disconnect-VIServer -Server

    $esx.Name -Confirm:$false

    }

    Disconnect-VIServer -server vcenter -Confirm:$false

    Set-PowerCLIConfiguration -DefaultVIServerMode

    $oldConfig.DefaultVIServerMode -Confirm:$false | Out-Null

    $esxcli.nmp.satp.setdefaultpsp($psp, $satp) | Out-Null

    Disconnect-VIServer -Server

    $esx.Name -Confirm:$false

    }

    Disconnect-VIServer -server vcenter -Confirm:$false

    Set-PowerCLIConfiguration -DefaultVIServerMode

    $oldConfig.DefaultVIServerMode -Confirm:$false | Out-Null

    $esxcli.nmp.satp.setdefaultpsp($psp, $satp) | Out-Null

    Disconnect-VIServer -Server

    $esx.Name -Confirm:$false

    }

    Disconnect-VIServer -server vcenter -Confirm:$false

    Set-PowerCLIConfiguration -DefaultVIServerMode

    $oldConfig.DefaultVIServerMode -Confirm:$false | Out-Null



  • 4.  RE: Change to RR if SATP matches

    Posted Oct 11, 2011 06:48 AM

    Sorry mates somehow I copied much.Please ignore the last two paragraph.



  • 5.  RE: Change to RR if SATP matches

    Posted Oct 11, 2011 07:02 AM

    oh my goodness, I forgot to end my active vSphere Client session :smileyhappy: It works

    The second part about RDM,what do you think ?



  • 6.  RE: Change to RR if SATP matches

    Posted Oct 11, 2011 07:18 AM

    The deault pathing policy will be active for new LUNs after a reboot.

    The path policy that was changed for existing LUNs should be active immediatly.

    Perhaps you are seeing the behaviour that Jason described in  his Configure VMware ESX(i) Round Robin on EMC Storage, see the remark about the useANO setting.

    I personally, would handle LUNs used for RDMs in the same way as LUNs used for VMFS datastores.

    But perhaps there is a best practice that contradicts this ?



  • 7.  RE: Change to RR if SATP matches

    Posted Oct 12, 2011 10:42 AM

    Some says Path Selection Policy Device Config's IOPS value change from "1" to random after rebooting host. I tested it with my esxi host 4.1 U1. It didn't change to random. Script seems to be working fine. Agree with you Luc for Active Passive SPs, useANO might cause LUN trashing. In my case , it is active active SPs so I pass $null value anyway not to take any risk. Also I didn't find any good reason to myself why I use non optimal path. At this topic , I couldn't find a complete checklist before changing PSP to RR. Maybe some advanced settings must also be changed on ESX host etc. I still dont know...