-MinimumIops 10 -MaximumIops 100 -PolicyType Dedicated
Looking at $10to100IOPSPolicy.PolicyId shows the GUID of the policy, which is what
is required when applying the policies via PowerShell. It is possible to set the policy ID
when creating a new policy via the -PolicyId parameter of New-StorageQosPolicy. The
reason that you may want to set the policy ID is twofold:
A policy may have been deleted that is used by VHDs, and you need to re-create it.
You want to migrate VMs between clusters. The cluster is the boundary for
policies. If you want consistency as you move VMs between clusters, you should
create the policies on all clusters with the same policy ID. Therefore, you need to
set the policy ID during creation on subsequent clusters to match the policy ID of
the policy when created on the first cluster.
To apply the policy, use Set-VMHardDiskDrive with the -QoSPolicyId. For example, to
set all VHDs with a policy for a particular VM, I could use the following:
Get-VM -Name VM1 | Get-VMHardDiskDrive |
Set-VMHardDiskDrive -QoSPolicyID $10to100IOPSPolicy.PolicyId
I could use any combination of PowerShell pipelining to apply policies. I could fetch
every VM on a host, every VM in a cluster, or any combination. Ultimately, I am
applying the policy to a VHD, and the PowerShell results in a collection of VHDs to
which I apply the QoS policy. If you wish to remove the QoS policy, set the
QoSPolicyID to $null for the VHD.
Existing policies can be modified using the Set-StorageQosPolicy cmdlet, and all
attributes can be changed. Once the policy is changed, any VHD to which it has been
applied will receive the updated values of the policy straightaway.
Because the policy manager receives metrics at so many levels, this also exposes new
levels of monitoring of storage performance. The first command to use is Get-
StorageQosVolume, which shows all of the CSV volumes with basic information
including IOPS served, latency, and the bandwidth it can serve.
Get-StorageQoSFlow enables viewing of all the flows on the storage subsystem, where
a flow can be thought of as a VHD used by a VM on storage managed by the policies.
While Get-StorageQoSFlow shows only the VHDs and the VM using the VHD, it can
also show a lot more data by using the following:
Get-StorageQoSFlow | FL *
Note that if you run this without creating policies, you will see that the default (all 0s)
policy has been applied to all flows. This will output huge amounts of data related to
each flow, including IOPS, policy applied, latency, bandwidth, and more. A slightly
neater version with the most useful information is shown here:
Get-StorageQoSFlow | FL InitiatorName, InitiatorLatency, StorageNodeLatency,
StorageNodeBandwidth, StorageNodeIOPS, InitiatorIOPS, PolicyId, FilePath