From 31a1d63559b4540bcc953b16703436a8e7e15b29 Mon Sep 17 00:00:00 2001 From: Amelia Cordwell Date: Mon, 11 Dec 2017 16:43:10 +1300 Subject: [PATCH] Add Quota Docs and API references Change-Id: I37de58f73993b20ff0be194f1c33271a2bfd4e26 --- api-ref/source/parameters.yaml | 15 +++- api-ref/source/taskviews.inc | 136 +++++++++++++++++++++++++++++++++ doc/source/index.rst | 1 + doc/source/quota.rst | 37 +++++++++ 4 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 doc/source/quota.rst diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml index 2867146..cf80987 100644 --- a/api-ref/source/parameters.yaml +++ b/api-ref/source/parameters.yaml @@ -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 diff --git a/api-ref/source/taskviews.inc b/api-ref/source/taskviews.inc index 972abea..e6d0355 100644 --- a/api-ref/source/taskviews.inc +++ b/api-ref/source/taskviews.inc @@ -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."] + } diff --git a/doc/source/index.rst b/doc/source/index.rst index 38dbe4a..abeaa17 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -14,6 +14,7 @@ Welcome to Adjutant's documentation! devstack-guide configuration plugins + quota .. standard task views and actions diff --git a/doc/source/quota.rst b/doc/source/quota.rst new file mode 100644 index 0000000..47df0f3 --- /dev/null +++ b/doc/source/quota.rst @@ -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.