PowerCLI – Disable Storage IO Control and statistics collection

  • Goal – A PowerCLI script that will select “Disable Storage I/O Control and statistics collection” on all datastores in an SDRS cluster. 
  • Upgrading ESXi hosts from VMware 6.7 to 7.0 may inadvertently turn on Storage I/O Control (SIOC) and may cause a performance issue if the settings are incorrect.
    https://www.dell.com/support/kbdoc/en-us/000182816/dell-emc-unity-esxi-host-upgrades-from-vmware-6-7-to-7-0-may-cause-performance-issues-if-sioc-is-turned-on-user-correctable
  • For an HPE HF array, the same large blocks size (128-256k) appear when there are no VMs on a datastore/volume. While the Dell post points to an upgrade, this is for new new datastores to see how SIOC with statistics is enabled. 
  • Minting a volume/datastore using the current method or the Nimble Storage vCenter plug-in has Storage I/O Control (SIOC) Disabled. No option to choose a SDRS cluster. 
  • When the datastore is addred to a SDRS cluster with “Enable I/O metric for SDRS recommendations” Enabled. SIOC is Enabled. When moved outside the SDRS cluster, SIOC remain Enabled. 
  • When the datastore is addred to a SDRS cluster with “Enable I/O metric for SDRS recommendations” Disabled, the datastore remains SIOC as Disabled 
  • Recap – New datastores have SIOC disabled. If the SDRS cluster has I/O metrics enabled, SIOC will be enabled when a datastore is added. If I/O metrics are disabled for the SDRS cluster, then SOIC will remain disabled when added to the SDRS cluster. 
  • This PowerCLI script covers the Cluster object for net-new datastores, but not existing datastores
    https://vmscribble.com/powercli/change-sdrs-vm-affinity-io-metric-space-threshold-by-cluster-script/
  • Issue. The native Set-Datastore StorageIOControlEnabled cmdlet will choose the 2nd “Disable Storage I/O Control but enable statistics collection” with “Include I/O statistics for SDRS” checked. The goal is to pick the 3rd one “Disable Storage I/O Control and statistics collection” since the statistics collection is the issue.
    https://developer.vmware.com/docs/powercli/latest/vmware.vimautomation.core/commands/set-datastore/
  • Running the vCenter – Developer Center – Code Capture amid making the change to a datastore showed:#—————– Start of code capture —————–#—————ConfigureDatastoreIORM_Task—————
    $datastore = New-Object VMware.Vim.ManagedObjectReference
    $datastore.Type = ‘Datastore’
    $datastore.Value = ‘datastore-3013’
    $spec = New-Object VMware.Vim.StorageIORMConfigSpec
    $spec.StatsAggregationDisabled = $true
    $spec.StatsCollectionEnabled = $false
    $spec.Enabled = $false
    $_this = Get-View -Id ‘StorageResourceManager-StorageResourceManager’
    $_this.ConfigureDatastoreIORM_Task($datastore, $spec)#—————– End of code capture —————–
  • Searching for spec.StatsCollectionEnabled
    https://github.com/vmware/PowerCLI-Example-Scripts/blob/master/Scripts/DatastoreSIOCStatistics.ps1
    Testing function Set-DatastoreSIOCStatCollection -Datastore realDSname -Disable hit or miss. I would see the “Configure Storage I/O Control on datastore” task complete, but the change was not made all of the time eventhough “SIOCStatCollection” in the output reported False. No reason why.
    The fix. Edit line 58 and add 2 more lines to mirrot the code capture output. Success!} elseif ($Disable) {$spec.statsCollectionEnabled = $falseNew Lines 58-60:
    $spec.StatsAggregationDisabled = $true
    $spec.StatsCollectionEnabled = $false
    $spec.Enabled = $false
  • Since I wanted to have the script only make the change on DS inside the SDRS cluster.
    I found https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Need-a-quick-one-line-script-to-disable-SIOC-on-all-Datastores/m-p/2164439I was not able to create a oneliner for all 3 specs, so I broke it down by all 3.
    Start-Sleep -seconds 5 was added to resolve “The operation is not allowed in the current state”

 

Goal
  • Goal – A PowerCLI script that will select “Disable Storage I/O Control and statistics collection” on all datastores in an SDRS cluster. 
  • Upgrading ESXi hosts from VMware 6.7 to 7.0 may inadvertently turn on Storage I/O Control (SIOC) and may cause a performance issue if the settings are incorrect.
    https://www.dell.com/support/kbdoc/en-us/000182816/dell-emc-unity-esxi-host-upgrades-from-vmware-6-7-to-7-0-may-cause-performance-issues-if-sioc-is-turned-on-user-correctable
  • For an HPE HF array, the same large blocks size (128-256k) appear when there are no VMs on a datastore/volume. While the Dell post points to an upgrade, this is for new new datastores to see how SIOC with statistics is enabled. 
  • Minting a volume/datastore using the current method or the Nimble Storage vCenter plug-in has Storage I/O Control (SIOC) Disabled. No option to choose a SDRS cluster. 
  • When the datastore is addred to a SDRS cluster with “Enable I/O metric for SDRS recommendations” Enabled. SIOC is Enabled. When moved outside the SDRS cluster, SIOC remain Enabled. 
  • When the datastore is addred to a SDRS cluster with “Enable I/O metric for SDRS recommendations” Disabled, the datastore remains SIOC as Disabled 
  • Recap – New datastores have SIOC disabled. If the SDRS cluster has I/O metrics enabled, SIOC will be enabled when a datastore is added. If I/O metrics are disabled for the SDRS cluster, then SOIC will remain disabled when added to the SDRS cluster. 
  • This PowerCLI script covers the Cluster object for net-new datastores, but not existing datastores
    https://vmscribble.com/powercli/change-sdrs-vm-affinity-io-metric-space-threshold-by-cluster-script/
Testing
  • Issue. The native Set-Datastore StorageIOControlEnabled cmdlet will choose the 2nd “Disable Storage I/O Control but enable statistics collection” with “Include I/O statistics for SDRS” checked. The goal is to pick the 3rd one “Disable Storage I/O Control and statistics collection” since the statistics collection is the issue.
    https://developer.vmware.com/docs/powercli/latest/vmware.vimautomation.core/commands/set-datastore/
  • Running the vCenter – Developer Center – Code Capture amid making the change to a datastore showed:#—————– Start of code capture —————–#—————ConfigureDatastoreIORM_Task—————
    $datastore = New-Object VMware.Vim.ManagedObjectReference
    $datastore.Type = ‘Datastore’
    $datastore.Value = ‘datastore-3013’
    $spec = New-Object VMware.Vim.StorageIORMConfigSpec
    $spec.StatsAggregationDisabled = $true
    $spec.StatsCollectionEnabled = $false
    $spec.Enabled = $false
    $_this = Get-View -Id ‘StorageResourceManager-StorageResourceManager’
    $_this.ConfigureDatastoreIORM_Task($datastore, $spec)#—————– End of code capture —————–
  • Searching for spec.StatsCollectionEnabled
    https://github.com/vmware/PowerCLI-Example-Scripts/blob/master/Scripts/DatastoreSIOCStatistics.ps1
    Testing function Set-DatastoreSIOCStatCollection -Datastore realDSname -Disable hit or miss. I would see the “Configure Storage I/O Control on datastore” task complete, but the change was not made all of the time eventhough “SIOCStatCollection” in the output reported False. No reason why.
    The fix. Edit line 58 and add 2 more lines to mirrot the code capture output. Success!} elseif ($Disable) {$spec.statsCollectionEnabled = $falseNew Lines 58-60:
    $spec.StatsAggregationDisabled = $true
    $spec.StatsCollectionEnabled = $false
    $spec.Enabled = $false
  • Since I wanted to have the script only make the change on DS inside the SDRS cluster.
    I found https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Need-a-quick-one-line-script-to-disable-SIOC-on-all-Datastores/m-p/2164439I was not able to create a oneliner for all 3 specs, so I broke it down by all 3.
    Start-Sleep -seconds 5 was added to resolve “The operation is not allowed in the current state”
The Script

[crayon-61a793ade2ab1397797906/]

 

Menu