Add API extension `quota-check-limit-default`

This is a shim extension that indicates if Neutron quota engine
checks the resource usage before updating any quota limit. That
makes the extension ``quota-check-limit`` to be the default Neutron
quota engine behaviour and aligns it with other projects.

To enforce a quota limit without checking the resource usage, now
it is needed to pass the CLI parameter "--force".

Related-Bug: #1953170
Related-Bug: #1936408
Change-Id: I778e6090fe4d01e2bf0b51933897e80624bab38a
This commit is contained in:
Rodolfo Alonso Hernandez
2024-08-08 21:57:08 +00:00
committed by Rodolfo Alonso
parent 1b7795688a
commit 3d4e0fa1cf
7 changed files with 54 additions and 3 deletions

View File

@@ -5895,8 +5895,9 @@ quota:
type: object
quota-check-limit:
description: |
A flag used in the ``quota`` update command. If enabled, the Quota engine
will first check the resource usage before applying the new quota limit.
(deprecated) A flag used in the ``quota`` update command. If enabled, the
Quota engine will first check the resource usage before applying the new
quota limit.
in: body
required: false
type: object
@@ -5923,6 +5924,13 @@ quota-floatingip-request:
in: body
required: false
type: integer
quota-force:
description: |
A flag used in the ``quota`` update command. If enabled, the Quota engine
will not check the resource usage before applying the new quota limit.
in: body
required: false
type: object
quota-network:
description: |
The number of networks allowed for each project.

View File

@@ -119,6 +119,7 @@ Request
- subnet: quota-subnet-request
- subnetpool: quota-subnetpool-request
- check_limit: quota-check-limit
- force: quota-force
Request Example
---------------

View File

@@ -9,6 +9,7 @@
"security_group_rule": 100,
"subnet": 10,
"subnetpool": -1,
"check_limit": "True"
"check_limit": "True",
"force": "False"
}
}

View File

@@ -120,6 +120,7 @@ from neutron_lib.api.definitions import qos_rule_type_details
from neutron_lib.api.definitions import qos_rule_type_filter
from neutron_lib.api.definitions import qos_rules_alias
from neutron_lib.api.definitions import quota_check_limit
from neutron_lib.api.definitions import quota_check_limit_default
from neutron_lib.api.definitions import rbac_address_groups
from neutron_lib.api.definitions import rbac_address_scope
from neutron_lib.api.definitions import rbac_bgpvpn
@@ -279,6 +280,7 @@ _ALL_API_DEFINITIONS = {
qos_rule_type_filter,
qos_rules_alias,
quota_check_limit,
quota_check_limit_default,
rbac_address_groups,
rbac_address_scope,
rbac_bgpvpn,

View File

@@ -145,6 +145,7 @@ KNOWN_EXTENSIONS = (
'qos-rules-alias',
'quotas',
'quota-check-limit',
'quota-check-limit-default',
'port-hints',
'port-hint-ovs-tx-steering',
'port-numa-affinity-policy',

View File

@@ -0,0 +1,29 @@
# Copyright 2024 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api.definitions import quota_check_limit
ALIAS = 'quota-check-limit-default'
IS_SHIM_EXTENSION = True
IS_STANDARD_ATTR_EXTENSION = False
NAME = 'Quota engine limit check by default'
DESCRIPTION = ('By default, the Neutron quota engine checks the resource '
'usage before applying a new quota limit')
UPDATED_TIMESTAMP = '2024-08-21T16:00:00-00:00'
RESOURCE_ATTRIBUTE_MAP = {}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
REQUIRED_EXTENSIONS = [quota_check_limit.ALIAS]
OPTIONAL_EXTENSIONS = []
ACTION_STATUS = {}

View File

@@ -0,0 +1,9 @@
---
features:
- |
Add API extension ``quota-check-limit-default``. This is a shim extension
that indicates if Neutron quota engine checks the resource usage before
updating any quota limit. That makes the extension ``quota-check-limit``
to be the default Neutron quota engine behaviour and aligns it with other
projects. To enforce a quota limit without checking the resource usage,
now it is needed to pass the CLI parameter "--force".