3.7. Quotas and Service Level Agreement Policy 3.7.1. Introduction to Quota Quota is a resource limitation tool provided with Red Hat Virtualization. Quota may be thought of as a layer of limitations on top of the layer of limitations set by User Permissions. Quota is a data center object. Quota allows administrators of Red Hat Virtualization environments to limit user access to memory, CPU, and storage. Quota defines the memory resources and storage resources an administrator can assign users. As a result users may draw on only the resources assigned to them. When the quota resources are exhausted, Red Hat Virtualization does not permit further user actions. There are two different kinds of Quota: Table 3.3. The Two Different Kinds of Quota Quota type Definition Run-time Quota This quota limits the consumption of runtime resources, like CPU and memory. Storage Quota This quota limits the amount of storage available. Quota, like SELinux, has three modes: Table 3.4. Quota Modes Quota Mode Function Enforced This mode puts into effect the quota that you have set in Audit mode, limiting resources to the group or user affected by the quota. Audit This mode logs quota violations without blocking users and can be used to test quotas. In Audit mode, you can increase or decrease the amount of runtime quota and the amount of storage quota available to users affected by it. Disabled This mode turns off the runtime and storage limitations defined by the quota. When a user attempts to run a virtual machine, the specifications of the virtual machine are compared to the storage allowance and the runtime allowance set in the applicable quota. If starting a virtual machine causes the aggregated resources of all running virtual machines covered by a quota to exceed the allowance defined in the quota, then the Manager refuses to run the virtual machine. When a user creates a new disk, the requested disk size is added to the aggregated disk usage of all the other disks covered by the applicable quota. If the new disk takes the total aggregated disk usage above the amount allowed by the quota, disk creation fails. Quota allows for resource sharing of the same hardware. It supports hard and soft thresholds. Administrators can use a quota to set thresholds on resources. These thresholds appear, from the user's point of view, as 100% usage of that resource. To prevent failures when the customer unexpectedly exceeds this threshold, the interface supports a "grace" amount by which the threshold can be briefly exceeded. Exceeding the threshold results in a warning sent to the customer. Important Quota imposes limitations upon the running of virtual machines. Ignoring these limitations is likely to result in a situation in which you cannot use your virtual machines and virtual disks. When quota is running in enforced mode, virtual machines and disks that do not have quotas assigned cannot be used. To power on a virtual machine, a quota must be assigned to that virtual machine. To create a snapshot of a virtual machine, the disk associated with the virtual machine must have a quota assigned. When creating a template from a virtual machine, you are prompted to select the quota that you want the template to consume. This allows you to set the template (and all future machines created from the template) to consume a different quota than the virtual machine and disk from which the template is generated. 3.7.2. Shared Quota and Individually Defined Quota Users with SuperUser permissions can create quotas for individual users or quotas for groups. Group quotas can be set for Active Directory users. If a group of ten users are given a quota of 1 TB of storage and one of the ten users fills the entire terabyte, then the entire group will be in excess of the quota and none of the ten users will be able to use any of the storage associated with their group. An individual user's quota is set for only the individual. Once the individual user has used up all of his or her storage or runtime quota, the user will be in excess of the quota and the user will no longer be able to use the storage associated with his or her quota. 3.7.3. Quota Accounting When a quota is assigned to a consumer or a resource, each action by that consumer or on the resource involving storage, vCPU, or memory results in quota consumption or quota release. Since the quota acts as an upper bound that limits the user's access to resources, the quota calculations may differ from the actual current use of the user. The quota is calculated for the max growth potential and not the current usage. Example 3.15. Accounting example A user runs a virtual machine with 1 vCPU and 1024 MB memory. The action consumes 1 vCPU and 1024 MB of the quota assigned to that user. When the virtual machine is stopped 1 vCPU and 1024 MB of RAM are released back to the quota assigned to that user. Run-time quota consumption is accounted for only during the actual run-time of the consumer. A user creates a virtual thin provision disk of 10 GB. The actual disk usage may indicate only 3 GB of that disk are actually in use. The quota consumption, however, would be 10 GB, the max growth potential of that disk. 3.7.4. Enabling and Changing a Quota Mode in a Data Center This procedure enables or changes the quota mode in a data center. You must select a quota mode before you can define quotas. You must be logged in to the Administration Portal to follow the steps of this procedure. Use Audit mode to test your quota to verify that it works as you expect it to. You do not need to have your quota in Audit mode to create or change a quota. Procedure Click Compute Data Centers and select a data center. Click Edit . In the Quota Mode drop-down list, change the quota mode to Enforced . Click OK . If you set the quota mode to Audit during testing, then you must change it to Enforced in order for the quota settings to take effect. 3.7.5. Creating a New Quota Policy You have enabled quota mode, either in Audit or Enforcing mode. You want to define a quota policy to manage resource usage in your data center. Procedure Click Administration Quota . Click Add . Fill in the Name and Description fields. Select a Data Center . In the Memory & CPU section, use the green slider to set Cluster Threshold . In the Memory & CPU section, use the blue slider to set Cluster Grace . Click the All Clusters or the Specific Clusters radio button. If you select Specific Clusters , select the check box of the clusters that you want to add a quota policy to. Click Edit . This opens the Edit Quota window. Under the Memory field, select either the Unlimited radio button (to allow limitless use of Memory resources in the cluster), or select the limit to radio button to set the amount of memory set by this quota. If you select the limit to radio button, input a memory quota in megabytes (MB) in the MB field. Under the CPU field, select either the Unlimited radio button or the limit to radio button to set the amount of CPU set by this quota. If you select the limit to radio button, input a number of vCPUs in the vCpus field. Click OK in the Edit Quota window. In the Storage section, use the green slider to set Storage Threshold . In the Storage section, use the blue slider to set Storage Grace . Click the All Storage Domains or the Specific Storage Domains radio button. If you select Specific Storage Domains , select the check box of the storage domains that you want to add a quota policy to. Click Edit . This opens the Edit Quota window. Under the Storage Quota field, select either the Unlimited radio button (to allow limitless use of Storage) or the limit to radio button to set the amount of storage to which quota will limit users. If you select the limit to radio button, input a storage quota size in gigabytes (GB) in the GB field. Click OK in the Edit Quota window. Click OK in the New Quota window. 3.7.6. Explanation of Quota Threshold Settings Table 3.5. Quota thresholds and grace Setting Definition Cluster Threshold The amount of cluster resources available per data center. Cluster Grace The amount of the cluster available for the data center after exhausting the data center's Cluster Threshold. Storage Threshold The amount of storage resources available per data center. Storage Grace The amount of storage available for the data center after exhausting the data center's Storage Threshold. If a quota is set to 100 GB with 20% Grace, then consumers are blocked from using storage after they use 120 GB of storage. If the same quota has a Threshold set at 70%, then consumers receive a warning when they exceed 70 GB of storage consumption (but they remain able to consume storage until they reach 120 GB of storage consumption.) Both "Threshold" and "Grace" are set relative to the quota. "Threshold" may be thought of as the "soft limit", and exceeding it generates a warning. "Grace" may be thought of as the "hard limit", and exceeding it makes it impossible to consume any more storage resources. 3.7.7. Assigning a Quota to an Object Assigning a Quota to a Virtual Machine Click Compute Virtual Machines and select a virtual machine. Click Edit . Select the quota you want the virtual machine to consume from the Quota drop-down list. Click OK . Assigning a Quota to a Disk Click Compute Virtual Machines . Click a virtual machine's name. This opens the details view. Click the Disks tab and select the disk you plan to associate with a quota. Click Edit . Select the quota you want the virtual disk to consume from the Quota drop-down list. Click OK . Important Quota must be selected for all objects associated with a virtual machine, in order for that virtual machine to work. If you fail to select a quota for the objects associated with a virtual machine, the virtual machine will not work. The error that the Manager throws in this situation is generic, which makes it difficult to know if the error was thrown because you did not associate a quota with all of the objects associated with the virtual machine. It is not possible to take snapshots of virtual machines that do not have an assigned quota. It is not possible to create templates of virtual machines whose virtual disks do not have assigned quotas. 3.7.8. Using Quota to Limit Resources by User This procedure describes how to use quotas to limit the resources a user has access to. Procedure Click Administration Quota . Click the name of the target quota. This opens the details view. Click the Consumers tab. Click Add . In the Search field, type the name of the user you want to associate with the quota. Click GO . Select the check box to the user's name. Click OK . After a short time, the user will appear in the Consumers tab in the details view. 3.7.9. Editing Quotas This procedure describes how to change existing quotas. Procedure Click Administration Quota and select a quota. Click Edit . Edit the fields as required. Click OK . 3.7.10. Removing Quotas This procedure describes how to remove quotas. Procedure Click Administration Quota and select a quota. Click Remove . Click OK . 3.7.11. Service Level Agreement Policy Enforcement This procedure describes how to set service level agreement CPU features. Procedure Click Compute Virtual Machines . Click New , or select a virtual machine and click Edit . Click the Resource Allocation tab. Specify CPU Shares . Possible options are Low , Medium , High , Custom , and Disabled . Virtual machines set to High receive twice as many shares as Medium , and virtual machines set to Medium receive twice as many shares as virtual machines set to Low . Disabled instructs VDSM to use an older algorithm for determining share dispensation; usually the number of shares dispensed under these conditions is 1020. The CPU consumption of users is now governed by the policy you have set.

Commands: