When VMware released vSphere 6.x they introduced 3 new VAAI claim rules that can be utilized with the VMAX and VMAX3. By setting these values you can change the max transfer size up to a maximum 240MB. A white paper released by dellEMC goes into the technology if far more detail than this post. Page 29 of the attached link if you are interested.
https://www.emc.com/collateral/hardware/white-papers/h8115-vmware-vstorage-vmax-wp.pdf
What I am more concerned about is setting these values across all my VMware hosts without having to enable ssh, then ssh to each host and run the same esxcli commands on each host and disabling ssh. Also, I would like to be able to set it on all future host will very little effort. In order to achieve that, I want to use PowerCli as much a possible. I’m going to convert esxcli commands into a syntax that PowerCli understands and run them against all the host in my vCenter Instance.
Recap on Running esxcli via Powercli
First of all, let’s look at the current configuration so we know where we are starting from. I have highlighted the settings in question. You can see the three new values that were introduced in 6.x. All current values are set to Zero or False by default.
- XCOPYUseArrayReportedValues
- XCOPYUseMultipleSegments
- XCOPYMaxTransferSize
Let’s look at the commands that are suggested by the whitepaper and break them down a little so we fully understand what we are setting.
#List the VAAI Claim Rules esxcli storage core claimrule list --claimrule-class=VAAI #Remove the old Rule esxcli storage core claimrule remove --rule 65430 --claimrule-class=VAAI #Add the New Rule esxcli storage core claimrule add -r 65430 -t vendor -V EMC -M SYMMETRIX -P VMW_VAAIP_SYMM -c VAAI -a -s -m 240 #Load the rule esxcli storage core claimrule load --claimrule-class=VAAI
Okay, that looked straight forward enough but what are all the flag options in the add rule syntax? Here is a list of the flags used and their corresponding setting.
-r = Rule ( 65430)
-t = Type ( vendor)
-V = Vendor ( EMC)
-M = Model ( Symmetrix)
-p = Plugin (VMW_VAAIP_SYMM)
-c = Rule Class (VAAI)
-a = XCOPYUseArrayReportedValues (True)
-s = XCOPYUseMultipleSegments(True)
-m = XCOPYMaxTransferSize (240)
Now that we understand what we are setting let’s go figure out how to complete the task in PowerCli. Note: I have added a commented out line which lists the command syntax. So you can reference the syntax and the command with the options enabled side by side which hopefully will add some clarity.
#List the VAAI Claim rules $esxcli.storage.core.claimrule.list("VAAI") #Remove VAAI Rule 65430 #$esxcli.storage.core.claimrule.remove(string claimruleclass, string plugin, long rule) $esxcli.storage.core.claimrule.remove("VAAI", $null, "65430")
Notice the Rule still active in runtime. The Claim Rule load command will clear that up.
#Load the VAAI Claim rules #$esxcli.storage.core.claimrule.load(string claimruleclass) $esxcli.storage.core.claimrule.load(VAAI) #List the VAAI Claim rules #$esxcli.storage.core.claimrule.list(string claimruleclass) $esxcli.storage.core.claimrule.list(VAAI)
Rule 65430 is no more.
Now to re-create the rule with dellEMC recommended values, reload the rule and list the new values.
#Adding Rule 65430 with dellEMC recommended settings #$esxcli.storage.core.claimrule.add(string adapter, boolean autoassign, long channel, string claimruleclass, string device, string driver, boolean force, string ifunset, string iqn, long lun, string model, string plugin, long rule, long target, string transport, string type, string vendor, string wwnn, string wwpn, long xcopymaxtransfersize, boolean xcopyusearrayvalues, boolean xcopyusemultisegs) $esxcli.storage.core.claimrule.add($null, $null, $null, "VAAI", $null, $null, $null, $null, $null, $null,"SYMMETRIX", "VMW_VAAIP_SYMM", "65430", $null, $null, "vendor", "EMC", $null, $null, "240", $true , $true) #$esxcli.storage.core.claimrule.load(string claimruleclass) $esxcli.storage.core.claimrule.load("VAAI") #$esxcli.storage.core.claimrule.list(string claimruleclass) $esxcli.storage.core.claimrule.list("VAAI")
That worked nicely. But I wanted to run this on every host within my vSphere instance. I introduced a simple loop.
$cluster = Get-Cluster -name * ForEach ($VMhostname in ($cluster | Get-VMHost -name *)| sort) { $esxcli = Get-EsxCli -VMHost $VMhostname #$esxcli.storage.core.claimrule.remove(string claimruleclass, string plugin, long rule) $esxcli.storage.core.claimrule.remove("VAAI", $null, "65430") #$esxcli.storage.core.claimrule.add(string adapter, boolean autoassign, long channel, string claimruleclass, string device, string driver, boolean force, string ifunset, string iqn, long lun, string model, string plugin, long rule, long target, string transport, string type, string vendor, string wwnn, string wwpn, long xcopymaxtransfersize, boolean xcopyusearrayvalues, boolean xcopyusemultisegs) #$esxcli.storage.core.claimrule.add($null, $null, $null, "VAAI", $null, $null, $null, $null, $null, $null, "SYMMETRIX", "VMW_VAAIP_SYMM", "65430", $null, $null, "vendor", "EMC", $null, $null, "240", $true , $true ) $esxcli.storage.core.claimrule.add($null, $null, $null, "VAAI", $null, $null, $null, $null, $null, $null,"SYMMETRIX", "VMW_VAAIP_SYMM", "65430", $null, $null, "vendor", "EMC", $null, $null, "240", $true , $true) #$esxcli.storage.core.claimrule.load(string claimruleclass) $esxcli.storage.core.claimrule.load("VAAI") #$esxcli.storage.core.claimrule.list(string claimruleclass) $esxcli.storage.core.claimrule.list("VAAI") }