Storage‎ > ‎

Mass Configuring PSP... Clearing Up SATP Partner Path Misconfiguration

posted Jul 25, 2013, 1:59 PM by Kris Knight   [ updated Apr 3, 2015, 10:27 PM ]
Unfortunately the normal command to set this($vHcli.storage.nmp.satp.set($true,"VMW_PSP_RR","VMW_SATP_DEFAULT_AA")) has a bug in PowerCLI where the host will not retain these settings after a reboot. Big thanks to vitalibaruh and LucD for providing a great workaround! This will configure Default SATP PSPs for all hosts in your vCenter!

#Setting Default Path Selection Policies for all Hosts

$vHs = Get-VMHost

ForEach($vH in $vHs){
    #Getting ESX CLI for each Host
    $vHcli = Get-EsxCli -VMHost $vH
   
    #Does it have the correct PSP for IBM SVC
    $SVC = $vHcli.storage.nmp.satp.list() | Where {$_.Name -eq "VMW_SATP_SVC" -and $_.DefaultPSP -ne "VMW_PSP_RR"} | Select @{N="Cluster";E={$vH.Parent.Name}},@{N="VMHost";E={$vH.Name}},DefaultPSP,Name
   
    If($SVC.Name -eq "VMW_SATP_SVC" -and $SVC.DefaultPSP -ne "VMW_PSP_RR"){
        Write-Host "Configuring $vH SVC"
        #Create a low level object that points to the satp namespace:
        $LowLevel = $vHcli.TypeManager.CreateDynamicManagedObject( $vHcli.storage.nmp.satp.id )

        #Create a hashtable holding parameter values. Note that here we do not specify value for boot parameter:
        $Params = @{"DefaultPSP" = "VMW_PSP_RR"; satp = "VMW_SATP_SVC"}

        #Invoke set operation on the $LowLevel object:
        $LowLevel.InvokeOperation("set",$Params)
    }
   
    #Does it have the correct PSP for Defaults
    $DAA = $vHcli.storage.nmp.satp.list() | Where {$_.Name -eq "VMW_SATP_DEFAULT_AA" -and $_.DefaultPSP -ne "VMW_PSP_RR"} | Select @{N="Cluster";E={$vH.Parent.Name}},@{N="VMHost";E={$vH.Name}},DefaultPSP,Name
   
    If($DAA.Name -eq "VMW_SATP_DEFAULT_AA" -and $DAA.DefaultPSP -ne "VMW_PSP_RR"){
        Write-Host "Configuring $vH Default"
        #Create a low level object that points to the satp namespace:
        $LowLevel = $vHcli.TypeManager.CreateDynamicManagedObject( $vHcli.storage.nmp.satp.id )

        #Create a hashtable holding parameter values. Note that here we do not specify value for boot parameter:
        $Params = @{"DefaultPSP" = "VMW_PSP_RR"; satp = "VMW_SATP_DEFAULT_AA"}

        #Invoke set operation on the $LowLevel object:
        $LowLevel.InvokeOperation("set",$Params)
    }
}
Comments