Add Quota Docs and API references

Change-Id: I37de58f73993b20ff0be194f1c33271a2bfd4e26
This commit is contained in:
Amelia Cordwell 2017-12-11 16:43:10 +13:00 committed by Adrian Turjak
parent 6790c51b3f
commit 31a1d63559
4 changed files with 188 additions and 1 deletions

View File

@ -45,7 +45,7 @@ filters:
type: dictionary
region:
description: |
Region to setup the default network in.
Region to perform actions in.
in: query
required: true
type: string
@ -112,12 +112,25 @@ notifications:
in: body
required: true
type: array
regions:
description: |
Regions to perform actions in.
in: body
required: false
type: array
roles:
description: |
List of roles for the user.
in: body
required: true
type: array
size:
description: |
Which size out of the selections shown in the quota get request should
the region(s) be updated to.
in: body
required: true
type: string
task_data:
description: |
A dictionary replacing all the data for a task. See the task details

View File

@ -295,3 +295,139 @@ Response Example
{
"notes": ["task created"]
}
Show Quota Details
========================
.. rest_method:: GET /v1/openstack/quota
Authentication: Project Moderator or Admin
List details of the quota for the current project.
.. rest_parameters:: parameters.yaml
- region: region
Request Example
----------------
.. code-block:: bash
curl -H "X-Auth-Token: $NOS_TOKEN" http://0.0.0.0:5050/v1/openstack/quota
Response Example
-----------------
.. code-block:: javascript
{
"active_quota_tasks": [],
"quota_size_order": [
"small",
"medium",
"large"
],
"quota_sizes": {
"large": {
"cinder": {
"gigabytes": 50000,
"snapshots": 600,
"volumes": 200
},
"neutron": {
"floatingip": 50,
"network": 10,
"port": 500,
...
},
"nova": {
"cores": 200,
"fixed_ips": 0,
"floating_ips": 50,
"injected_file_content_bytes": 10240,
...
}
},
'small': { ... },
'medium': { ... }
},
"regions": [
{
"current_quota": {
"cinder": {
"backup_gigabytes": 1000,
"backups": 10,
"gigabytes": 1000,
...
},
"neutron": {
"floatingip": 50,
"network": 10,
"port": 50,
...
},
"nova": {
"cores": 20,
"fixed_ips": -1,
"floating_ips": 10,
"injected_file_content_bytes": 10240,
...
}
},
"current_quota_size": "custom",
"current_usage": {
"cinder": {
"gigabytes": 1,
"snapshots": 0,
"volumes": 1
},
"neutron": {
"floatingip": 0,
"network": 1,
"port": 2,
"router": 1
...
},
"nova": {
"cores": 0,
"floating_ips": 0,
...
}
},
"quota_change_options": [],
"region": "RegionOne"
}
]
}
Update Quota
========================
.. rest_method:: POST /v1/openstack/quota
Authentication: Project Moderator or Admin
Starts an update quota task. If regions are not specified it will update
the quota across all regions.
.. rest_parameters:: parameters.yaml
- regions: regions
- size: size
Request Example
----------------
.. code-block:: bash
curl -H "X-Auth-Token: $NOS_TOKEN" http://0.0.0.0:5050/v1/openstack/quotas
-d '{"region": "RegionOne", "size": "small"}' -H "Content-Type: application/json"
Response Example
-----------------
.. code-block:: javascript
{
"notes": ["Task processed. Awaiting Aprroval."]
}

View File

@ -14,6 +14,7 @@ Welcome to Adjutant's documentation!
devstack-guide
configuration
plugins
quota
.. standard task views and actions

37
doc/source/quota.rst Normal file
View File

@ -0,0 +1,37 @@
####################################
Quota Management
####################################
The quota API will allow users to change their quota values in any region to
a number of preset quota definitions. If a user has updated their quota in
the past 30 days or are attempting to jump across quota values, administrator
approval is required. The exact number of days can be modified in the
configuration file.
Adjutant will assume that you have quotas setup for nova, cinder and neutron.
Adjutant offers deployers a chance to define what services they offer in which
region that require quota updates. At present Adjutant does not check the
catalog for what services are available, but will in future, with the below
setting acting as an override.
The setting ``QUOTA_SERVICES`` can be modified to include or remove a service
from quota listing and updating, and it is a mapping of region name to services
with ``*`` acting as a wildcard for all regions:
.. code-block:: yaml
QUOTA_SERVICES:
"*":
- cinder
- neutron
- nova
- octavia
RegionThree:
- nova
- cinder
- neutron
A new service can be added by creating a new helper object, like
``adjutant.common.quota.QuotaManager.ServiceQuotaCinderHelper`` and adding
it into the ``_quota_updaters`` class value dictionary. The key being the
name that is specified in ``QUOTA_SERVICES`` and on the quota definition.