OpsGuide-Quotas

= Quotas =

To prevent system capacities from being exhausted without notification, you can set up quotas &lt;quota&gt;. Quotas are operational limits. For example, the number of gigabytes allowed per tenant can be controlled to ensure that a single tenant cannot consume all of the disk space. Quotas are currently enforced at the tenant (or project) level, rather than the user level.

warning

Because without sensible quotas a single tenant could use up all the available resources, default quotas are shipped with OpenStack. You should pay attention to which quota settings make sense for your hardware capabilities. Using the command-line interface, you can manage quotas for the OpenStack Compute service and the Block Storage service.

Typically, default values are changed because a tenant requires more than the OpenStack default of 10 volumes per tenant, or more than the OpenStack default of 1 TB of disk space on a compute node.

note

To view all tenants, run:

$ openstack project list +-+--+ +-+--+ +-+--+
 * ID                             | Name     |
 * a981642d22c94e159a4a6540f70f9f8 | admin   |
 * 934b662357674c7b9f5e4ec6ded4d0e | tenant01 |
 * 7bc1dbfd7d284ec4a856ea1eb82dca8 | tenant02 |
 * 9c554aaef7804ba49e1b21cbd97d218 | services |

Set Image Quotas
You can restrict a project's image storage by total number of bytes. Currently, this quota is applied cloud-wide, so if you were to set an Image quota limit of 5 GB, then all projects in your cloud will be able to store only 5 GB of images and snapshots.

To enable this feature, edit the  file, and under the   section, add:

For example, to restrict a project's image storage to 5 GB, do this:

note

There is a configuration option in  that limits the number of members allowed per image, called , set to 128 by default. That setting is a different quota from the storage quota.

Set Compute Service Quotas
As an administrative user, you can update the Compute service quotas for an existing tenant, as well as update the quota defaults for a new tenant. See table_compute_quota.

View and update compute quotas for a tenant (project)
As an administrative user, you can use the nova quota-* commands, which are provided by the  package, to view and update tenant quotas.

To view and update default quota values

  List all default quotas for all tenants, as follows: $ nova quota-defaults For example: $ nova quota-defaults +-+---+ +-+---+ +-+---+   Update a default value for a new tenant, as follows: $ nova quota-class-update default key value For example: $ nova quota-class-update default --instances 15 
 * Quota                      | Limit |
 * instances                  | 10    |
 * cores                      | 20    |
 * ram                        | 51200 |
 * floating_ips               | 10    |
 * fixed_ips                  | -1    |
 * metadata_items             | 128   |
 * injected_files             | 5     |
 * injected_file_content_bytes | 10240 |
 * injected_file_path_bytes   | 255   |
 * key_pairs                  | 100   |
 * security_groups            | 10    |
 * security_group_rules       | 20    |
 * server_groups              | 10    |
 * server_group_members       | 10    |

To view quota values for a tenant (project)

  Place the tenant ID in a variable: $ tenant=$(openstack project list | awk '/tenantName/ {print $2}')   List the currently set quota values for a tenant, as follows: <pre class="sourceCode console">$ nova quota-show --tenant $tenant For example: <pre class="sourceCode console">$ nova quota-show --tenant $tenant +-+---+ +-+---+ +-+---+ </li></ol>
 * Quota                      | Limit |
 * instances                  | 10    |
 * cores                      | 20    |
 * ram                        | 51200 |
 * floating_ips               | 10    |
 * fixed_ips                  | -1    |
 * metadata_items             | 128   |
 * injected_files             | 5     |
 * injected_file_content_bytes | 10240 |
 * injected_file_path_bytes   | 255   |
 * key_pairs                  | 100   |
 * security_groups            | 10    |
 * security_group_rules       | 20    |
 * server_groups              | 10    |
 * server_group_members       | 10    |

To update quota values for a tenant (project)

  Obtain the tenant ID, as follows: <pre class="sourceCode console">$ tenant=$(openstack project list | awk '/tenantName/ {print $2}') </li>  Update a particular quota value, as follows: <pre class="sourceCode console"># nova quota-update --quotaName quotaValue tenantID For example: <pre class="sourceCode console"># nova quota-update --floating-ips 20 $tenant +-+---+ +-+---+ +-+---+ note To view a list of options for the  command, run: <pre class="sourceCode console">$ nova help quota-update </li></ol>
 * 1) nova quota-show --tenant $tenant
 * Quota                      | Limit |
 * instances                  | 10    |
 * cores                      | 20    |
 * ram                        | 51200 |
 * floating_ips               | 20    |
 * fixed_ips                  | -1    |
 * metadata_items             | 128   |
 * injected_files             | 5     |
 * injected_file_content_bytes | 10240 |
 * injected_file_path_bytes   | 255   |
 * key_pairs                  | 100   |
 * security_groups            | 10    |
 * security_group_rules       | 20    |
 * server_groups              | 10    |
 * server_group_members       | 10    |

Set Object Storage Quotas
There are currently two categories of quotas for Object Storage:


 * Container quotas
 * Limit the total size (in bytes) or number of objects that can be stored in a single container.


 * Account quotas
 * Limit the total size (in bytes) that a user has available in the Object Storage service.

To take advantage of either container quotas or account quotas, your Object Storage proxy server must have  or   (or both) added to the   pipeline. Each quota type also requires its own section in the  file:

To view and update Object Storage quotas, use the swift command provided by the  package. Any user included in the project can view the quotas placed on their project. To update Object Storage quotas on a project, you must have the role of ResellerAdmin in the project that the quota is being applied to.

To view account quotas placed on a project:

<pre class="sourceCode console">$ swift stat Account: AUTH_b36ed2d326034beba0a9dd1fb19b70f9 Containers: 0 Objects: 0 Bytes: 0 Meta Quota-Bytes: 214748364800 X-Timestamp: 1351050521.29419 Content-Type: text/plain; charset=utf-8 Accept-Ranges: bytes To apply or update account quotas on a project:

<pre class="sourceCode console">$ swift post -m quota-bytes: &lt;bytes&gt; For example, to place a 5 GB quota on an account:

<pre class="sourceCode console">$ swift post -m quota-bytes: 5368709120 To verify the quota, run the swift stat command again:

<pre class="sourceCode console">$ swift stat Account: AUTH_b36ed2d326034beba0a9dd1fb19b70f9 Containers: 0 Objects: 0 Bytes: 0 Meta Quota-Bytes: 5368709120 X-Timestamp: 1351541410.38328 Content-Type: text/plain; charset=utf-8 Accept-Ranges: bytes

Set Block Storage Quotas
As an administrative user, you can update the Block Storage service quotas for a tenant, as well as update the quota defaults for a new tenant. See table_block_storage_quota.

View and update Block Storage quotas for a tenant (project)
As an administrative user, you can use the cinder quota-* commands, which are provided by the  package, to view and update tenant quotas.

To view and update default Block Storage quota values

  List all default quotas for all tenants, as follows: <pre class="sourceCode console">$ cinder quota-defaults tenantID </li>  Obtain the tenant ID, as follows: <pre class="sourceCode console">$ tenant=$(openstack project list | awk '/tenantName/ {print $2}') For example: <pre class="sourceCode console">$ cinder quota-defaults $tenant +---+---+ +---+---+ +---+---+ </li> To update a default value for a new tenant, update the property in the  file.</li></ol>
 * Property | Value |
 * gigabytes | 1000 |
 * snapshots |  10  |
 * volumes |   10  |

To view Block Storage quotas for a tenant (project)

  View quotas for the tenant, as follows: <pre class="sourceCode console"># cinder quota-show tenantID For example: <pre class="sourceCode console"># cinder quota-show $tenant +---+---+ +---+---+ +---+---+ </li></ol>
 * Property | Value |
 * gigabytes | 1000 |
 * snapshots |  10  |
 * volumes |   10  |

To update Block Storage quotas for a tenant (project)

  Place the tenant ID in a variable: <pre class="sourceCode console">$ tenant=$(openstack project list | awk '/tenantName/ {print $2}') </li>  Update a particular quota value, as follows: <pre class="sourceCode console"># cinder quota-update --quotaName NewValue tenantID For example: <pre class="sourceCode console"># cinder quota-update --volumes 15 $tenant +---+---+ +---+---+ +---+---+ </li></ol>
 * 1) cinder quota-show $tenant
 * Property | Value |
 * gigabytes | 1000 |
 * snapshots |  10  |
 * volumes |   15  |