|
| 1 | +============================ |
| 2 | +Manage Unified Limits Quotas |
| 3 | +============================ |
| 4 | + |
| 5 | +.. note:: |
| 6 | + |
| 7 | + This section provides deployment information about the quota feature. For |
| 8 | + end-user information about quotas, including information about the type of |
| 9 | + quotas available, refer to the :doc:`user guide </user/unified-limits>`. |
| 10 | + |
| 11 | +Since the Nova 28.0.0 (2023.2 Bobcat) release, it is recommended to use |
| 12 | +`Keystone unified limits`_ for Nova quota limits. |
| 13 | + |
| 14 | +For information about legacy quota limits, see the :doc:`legacy quota |
| 15 | +documentation </admin/quotas>`. |
| 16 | + |
| 17 | +To enable unified limits quotas, set the quota driver in the Nova |
| 18 | +configuration: |
| 19 | + |
| 20 | +.. code-block:: ini |
| 21 | +
|
| 22 | + [quota] |
| 23 | + driver = nova.quota.UnifiedLimitsDriver |
| 24 | +
|
| 25 | +Quota limits are set and retrieved for enforcement using the `Keystone API`_. |
| 26 | + |
| 27 | +.. _Keystone unified limits: https://docs.openstack.org/keystone/latest/admin/unified-limits.html |
| 28 | +.. _Keystone API: https://docs.openstack.org/api-ref/identity/v3/index.html#unified-limits |
| 29 | + |
| 30 | +To prevent system capacities from being exhausted without notification, you can |
| 31 | +set up quotas. Quotas are operational limits. For example, the number of |
| 32 | +servers allowed for each project can be controlled so that cloud resources |
| 33 | +are optimized. Quotas can be enforced at both the global (default) and the |
| 34 | +project level. |
| 35 | + |
| 36 | +Resource usage is counted from the placement service with unified limits. |
| 37 | + |
| 38 | + |
| 39 | +Checking quota |
| 40 | +-------------- |
| 41 | + |
| 42 | +When calculating limits for a given resource and project, the following checks |
| 43 | +are made in order: |
| 44 | + |
| 45 | +#. Project-specific limits |
| 46 | + |
| 47 | + Depending on the resource, is there a project-specific limit on the resource |
| 48 | + in Keystone limits? If so, use that as the limit. You can create these |
| 49 | + resource limits using: |
| 50 | + |
| 51 | + .. code-block:: console |
| 52 | +
|
| 53 | + $ openstack limit create --service nova --project <project> --resource-limit 5 servers |
| 54 | +
|
| 55 | +#. Default limits |
| 56 | + |
| 57 | + Use the Keystone registered limit for the resource as the limit. You can |
| 58 | + create these default limits using: |
| 59 | + |
| 60 | + .. code-block:: console |
| 61 | +
|
| 62 | + $ openstack registered limit create --service nova --default-limit 5 servers |
| 63 | +
|
| 64 | +
|
| 65 | +Rechecking quota |
| 66 | +~~~~~~~~~~~~~~~~ |
| 67 | + |
| 68 | +If :oslo.config:option:`quota.recheck_quota` is True (this is the default), |
| 69 | +Nova will perform a second quota check after allocating resources. The first |
| 70 | +quota check is performed before resources are allocated. Rechecking quota |
| 71 | +ensures that quota limits are strictly enforced and prevents any possibility of |
| 72 | +resource allocation going over the quota limit in the event of racing parallel |
| 73 | +API requests. |
| 74 | + |
| 75 | +It can be disabled by setting :oslo.config:option:`quota.recheck_quota` to |
| 76 | +False if strict quota enforcement is not important to the operator. |
| 77 | + |
| 78 | + |
| 79 | +Quota usage from placement |
| 80 | +-------------------------- |
| 81 | + |
| 82 | +With unified limits quotas, it is required that quota resource usage is counted |
| 83 | +from placement. As such, the |
| 84 | +:oslo.config:option:`quota.count_usage_from_placement` configuration option is |
| 85 | +ignored when :oslo.config:option:`quota.driver` is set to |
| 86 | +``nova.quota.UnifiedLimitsDriver``. |
| 87 | + |
| 88 | +There are some things to note when quota resource usage is counted from |
| 89 | +placement: |
| 90 | + |
| 91 | +* Counted usage will not be accurate in an environment where multiple Nova |
| 92 | + deployments are sharing a placement deployment because currently placement |
| 93 | + has no way of partitioning resource providers between different Nova |
| 94 | + deployments. Operators who are running multiple Nova deployments that share a |
| 95 | + placement deployment should not use the ``nova.quota.UnifiedLimitsDriver``. |
| 96 | + |
| 97 | +* Behavior will be different for resizes. During a resize, resource allocations |
| 98 | + are held on both the source and destination (even on the same host, see |
| 99 | + https://bugs.launchpad.net/nova/+bug/1790204) until the resize is confirmed |
| 100 | + or reverted. Quota usage will be inflated for servers in this state. |
| 101 | + |
| 102 | +* The ``populate_queued_for_delete`` and ``populate_user_id`` online data |
| 103 | + migrations must be completed before usage can be counted from placement. |
| 104 | + Until the data migration is complete, the system will fall back to legacy |
| 105 | + quota usage counting from cell databases depending on the result of an EXISTS |
| 106 | + database query during each quota check. Use |
| 107 | + ``nova-manage db online_data_migrations`` to run online data migrations. |
| 108 | + |
| 109 | +* Behavior will be different for unscheduled servers in ``ERROR`` state. A |
| 110 | + server in ``ERROR`` state that has never been scheduled to a compute host |
| 111 | + will not have placement allocations, so it will not consume quota usage for |
| 112 | + cores and ram. |
| 113 | + |
| 114 | +* Behavior will be different for servers in ``SHELVED_OFFLOADED`` state. A |
| 115 | + server in ``SHELVED_OFFLOADED`` state will not have placement allocations, so |
| 116 | + it will not consume quota usage for cores and ram. Note that because of this, |
| 117 | + it will be possible for a request to unshelve a server to be rejected if the |
| 118 | + user does not have enough quota available to support the cores and ram needed |
| 119 | + by the server to be unshelved. |
| 120 | + |
| 121 | + |
| 122 | +Configuration |
| 123 | +------------- |
| 124 | + |
| 125 | +View and update default quota values |
| 126 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 127 | + |
| 128 | +To list all default quotas for a project, run: |
| 129 | + |
| 130 | +.. code-block:: console |
| 131 | +
|
| 132 | + $ openstack registered limit list |
| 133 | +
|
| 134 | +.. note:: |
| 135 | + |
| 136 | + This lists default quotas for all services and not just nova. |
| 137 | + |
| 138 | +To create a default quota limit, run: |
| 139 | + |
| 140 | +.. code-block:: console |
| 141 | +
|
| 142 | + $ openstack registered limit create --service nova --default-limit <value> <resource-name> |
| 143 | +
|
| 144 | +.. note:: |
| 145 | + |
| 146 | + Creating or updating registered limits requires a system-scoped |
| 147 | + authorization token by default. See the `Keystone tokens documentation`_ for |
| 148 | + more information. |
| 149 | + |
| 150 | + .. _Keystone tokens documentation: https://docs.openstack.org/keystone/latest/admin/tokens-overview.html#operation_create_system_token |
| 151 | + |
| 152 | +To update a default value, run: |
| 153 | + |
| 154 | +.. code-block:: console |
| 155 | +
|
| 156 | + $ openstack registered limit set --default-limit <value> <registered-limit-id> |
| 157 | +
|
| 158 | +View and update quota values for a project |
| 159 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 160 | + |
| 161 | +To list quotas for a project, run: |
| 162 | + |
| 163 | +.. code-block:: console |
| 164 | +
|
| 165 | + $ openstack limit list --project <project> |
| 166 | +
|
| 167 | +.. note:: |
| 168 | + |
| 169 | + This lists project quotas for all services and not just nova. |
| 170 | + |
| 171 | +To list quotas for all projects, you must have a system-scoped authorization |
| 172 | +token and run: |
| 173 | + |
| 174 | +.. code-block:: console |
| 175 | +
|
| 176 | + $ openstack limit list |
| 177 | +
|
| 178 | +To update quotas for a project, run: |
| 179 | + |
| 180 | +.. code-block:: console |
| 181 | +
|
| 182 | + $ openstack limit set --resource-limit <value> <limit-id> |
| 183 | +
|
| 184 | +
|
| 185 | +Migration to unified limits quotas |
| 186 | +---------------------------------- |
| 187 | + |
| 188 | +There is a `nova-manage limits migrate_to_unified_limits`_ command available |
| 189 | +to help with moving from legacy Nova database quotas to Keystone unified limits |
| 190 | +quotas. The command will read quota limits from the Nova database and call the |
| 191 | +Keystone API to create the corresponding unified limits. Per-user quota limits |
| 192 | +will **not** be copied into Keystone because per-user quotas are not supported |
| 193 | +in unified limits. |
| 194 | + |
| 195 | +.. _nova-manage limits migrate_to_unified_limits: https://docs.openstack.org/nova/latest/cli/nova-manage.html#limits-migrate-to-unified-limits |
0 commit comments