Creating custom SATP claimrules for EMC Symmetrix

As part of my migration work to EMC storage I need to create a custom SATP rule on each of my vSphere 5.0 hosts. The two obvious options are using ESXCLI from a SSH session to each host, or using PowerShell where ESXCLI is exposed using the Get-EsxCli cmdlet. The PowerShell option suits me better as I can add this claimrule to all my hosts in one go.

These are the two options;

Using ESXCLI via SSH;

## START ##

## Add custom SATP claimrule
esxcli storage nmp satp rule add -s "VMW_SATP_SYMM" -V "EMC" -M "SYMMETRIX" -P "VMW_PSP_RR" -O "iops=1" -e "EMC Symmetrix (custom rule)"

## List all SATP rules (filtered)
esxcli storage nmp satp rule list -s VMW_SATP_SYMM

## Results
Name           Device  Vendor  Model      Driver  Transport  Options  Rule Group  Claim Options  Default PSP  PSP Options  Description
-------------  ------  ------  ---------  ------  ---------  -------  ----------  -------------  -----------  -----------  ---------------------------
VMW_SATP_SYMM          EMC     SYMMETRIX                              user                       VMW_PSP_RR   iops=1       EMC Symmetrix (custom rule)
VMW_SATP_SYMM          EMC     SYMMETRIX                              system                                               EMC Symmetrix

## END ##

For the PowerShell method, make sure you check out the ESXCLI syntax;

Refer to the vSphere documentation for ESXCLI options, and Robert van den Nieuwendijk blog for the ESXCLI syntax;

#$esxcli.storage.nmp.satp.rule.add(boolean boot, string claimoption, string description, string device, string driver, boolean force, string model, string option, string psp, string pspoption, string satp, string transport, string type, string vendor)

Using ESXCLI via PowerShell;

## START ##

## Required syntax for ESXCLI (see note above)
$esxcli.storage.nmp.satp.rule.add(boolean boot, string claimoption, string description, string device, string driver, boolean force, string model, string option, string psp, string pspoption, string satp, string transport, string type, string vendor)

## This syntax translates to this (my example)
$esxcli.storage.nmp.satp.rule.add($null,$null,"EMC Symmetrix (custom rule)",$null,$null,$null,"SYMMETRIX",$null,"VMW_PSP_RR","iops=1","VMW_SATP_SYMM",$null,$null,"EMC")

## List SATP claimrules (filterd)
$esxcli.storage.nmp.satp.rule.list() | where {$_.Description -like "*Symmetrix*"} | Format-Table -AutoSize

## Results
ClaimOptions DefaultPSP Description                 Device Driver Model     Name          Options PSPOptions RuleGroup
------------ ---------- -----------                 ------ ------ -----     ----          ------- ---------- ---------
             VMW_PSP_RR EMC Symmetrix (custom rule)               SYMMETRIX VMW_SATP_SYMM         iops=1     user
                        EMC Symmetrix                             SYMMETRIX VMW_SATP_SYMM                    system   

## END ##

Now that you have the correct syntax, use PowerShell to apply this change to all your hosts. Just remember to update the scope to reflect your own environment.

Adding SATP claimrule to multiple hosts;

## START ##

Clear-Host

## Connect to vCenter
Connect-VIServer -Server 'myvcenter.fqdn'
Write-host ""

## Get list of hosts that you want to create the SATP claimrule on
$scope = Get-Datacenter 'MY-DATACENTER' | Get-Cluster * | Get-VMHost * | Sort-Object Name

## Action for each of the hosts in scope
Foreach ($esx in $scope){

  Write-Host $esx -ForegroundColor Yellow

  ## Exposes the ESXCLI functionality
  $esxcli = Get-EsxCli -VMHost $esx

  ## Create user defined SATP rule for EMC/Symmetrix (Vendor/Model)
  $esxcli.storage.nmp.satp.rule.add($null,$null,"EMC Symmetrix (custom rule)",$null,$null,$null,"SYMMETRIX",$null,"VMW_PSP_RR","iops=1","VMW_SATP_SYMM",$null,$null,"EMC")

  ## List SATP rule with "Symmetrix" in the description
  $esxcli.storage.nmp.satp.rule.list() | where {$_.Description -like "*Symmetrix*"} | Format-Table -AutoSize

}

## Disconnect from vCenter
Disconnect-VIServer -Server * -Force -Confirm:$false 

## END ##

If you just want to list the rules across all your hosts then comment out line 21 (which creates the claimrule) and execute the script again. The formatting is not the best in this instance, but it’s a quick way of validating what you’ve just done.

12,775 total views, 2 views today

Share on LinkedInShare on FacebookTweet about this on TwitterShare on Google+Digg thisShare on RedditPin on PinterestEmail this to someonePrint this page

Speak Your Mind

*