Merge "Add API shim extension "quota-check-limit""

This commit is contained in:
Zuul 2021-09-10 14:44:18 +00:00 committed by Gerrit Code Review
commit 8d97d5ee33
8 changed files with 67 additions and 1 deletions

View File

@ -5532,6 +5532,13 @@ quota:
in: body
required: true
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.
in: body
required: false
type: object
quota-detail:
description: |
A ``quota`` detail object. Each key in the object corresponds to a resource

View File

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

View File

@ -8,6 +8,7 @@
"security_group": 10,
"security_group_rule": 100,
"subnet": 10,
"subnetpool": -1
"subnetpool": -1,
"check_limit": "True"
}
}

View File

@ -105,6 +105,7 @@ from neutron_lib.api.definitions import qos_pps_minimum_rule
from neutron_lib.api.definitions import qos_pps_rule
from neutron_lib.api.definitions import qos_rule_type_details
from neutron_lib.api.definitions import qos_rules_alias
from neutron_lib.api.definitions import quota_check_limit
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
@ -240,6 +241,7 @@ _ALL_API_DEFINITIONS = {
qos_pps_rule,
qos_rule_type_details,
qos_rules_alias,
quota_check_limit,
rbac_address_groups,
rbac_address_scope,
rbac_bgpvpn,

View File

@ -145,6 +145,7 @@ KNOWN_EXTENSIONS = (
'qos-port-network-policy',
'qos-rules-alias',
'quotas',
'quota-check-limit',
'rbac-address-group',
'rbac-address-scope',
'rbac-bgpvpn',

View File

@ -0,0 +1,27 @@
# Copyright 2021 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.
ALIAS = 'quota-check-limit'
IS_SHIM_EXTENSION = True
IS_STANDARD_ATTR_EXTENSION = False
NAME = 'Quota engine limit check'
DESCRIPTION = ('Support for checking the resource usage before applying a new '
'quota limit')
UPDATED_TIMESTAMP = '2021-09-08T16:00:00-00:00'
RESOURCE_ATTRIBUTE_MAP = {}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
REQUIRED_EXTENSIONS = []
OPTIONAL_EXTENSIONS = []
ACTION_STATUS = {}

View File

@ -0,0 +1,20 @@
# Copyright 2021 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
from neutron_lib.tests.unit.api.definitions import base
class QuotaCheckLimitDefinitionTestCase(base.DefinitionBaseTestCase):
extension_module = quota_check_limit

View File

@ -0,0 +1,7 @@
---
features:
- |
Add API extension ``quota-check-limit``. This is a shim extension that
indicates if Neutron supports checking the resource usage before applying
a new quota limit. A new API parameter ``check_limit`` is introduced; it
can be used in the ``quota`` update request to enable this check.