diff --git a/api-ref/source/index.rst b/api-ref/source/index.rst index 1fd4481aac..e573c4b646 100644 --- a/api-ref/source/index.rst +++ b/api-ref/source/index.rst @@ -47,6 +47,7 @@ the `API guide `_. .. include:: os-migrations.inc .. include:: server-migrations.inc .. include:: os-quota-sets.inc +.. include:: os-quota-class-sets.inc .. include:: os-server-groups.inc .. include:: os-server-tags.inc .. include:: os-services.inc diff --git a/api-ref/source/os-quota-class-sets.inc b/api-ref/source/os-quota-class-sets.inc new file mode 100644 index 0000000000..8588737d8d --- /dev/null +++ b/api-ref/source/os-quota-class-sets.inc @@ -0,0 +1,148 @@ +.. -*- rst -*- + +======================================= + Quota class sets (os-quota-class-sets) +======================================= + +Show, Create or Update the quotas for a Quota Class. +Nova supports implicit 'default' Quota Class only. + +.. note:: + Once a default limit is set via the ``default`` quota class via the API, + that takes precedence over any changes to that resource limit in the + configuration options. In other words, once you've changed things via + the API, you either have to keep those synchronized with the configuration + values or remove the default limit from the database manually as there is + no REST API for removing quota class values from the database. + + For Example: If you updated default quotas for instances, to 20, but + didn't change ``quota_instances`` in your ``nova.conf``, you'd now + have default quota for instances as 20 for all projects. + If you then change ``quota_instances=5`` in nova.conf, but didn't + update the ``default`` quota class via the API, you'll still have + a default quota of 20 for instances regardless of ``nova.conf``. + Refer: `Quotas + `__ + for more details. + +.. warning:: + There is a bug in the v2.1 API and the legacy v2 compatible API which does + not return the ``server_groups`` and ``server_group_members`` quotas in + GET and PUT ``os-quota-class-sets`` API response, whereas the v2 API + used to return those keys in the API response. + There is workaround to get the ``server_groups`` and + ``server_group_members`` quotas using + :ref:`list-default-quotas-for-tenant` + API but that is per project quota. + +Show the quota for Quota Class +============================== + +.. rest_method:: GET /os-quota-class-sets/{id} + +Show the quota for the Quota Class. + +Normal response codes: 200 + +Error response codes: unauthorized(401), forbidden(403) + +Request +------- + +.. rest_parameters:: parameters.yaml + + - id: quota_class_id + +Response +-------- + +.. rest_parameters:: parameters.yaml + + - quota_class_set: quota_class_set + - cores: cores_quota_class + - fixed_ips: fixed_ips_quota_class + - floating_ips: floating_ips_quota_class + - id: quota_class_id_body + - injected_file_content_bytes: injected_file_content_bytes + - injected_file_path_bytes: injected_file_path_bytes + - injected_files: injected_files_quota_class + - instances: instances_quota_class + - key_pairs: key_pairs_quota_class + - metadata_items: metadata_items + - ram: ram_quota_class + - security_group_rules: security_group_rules_quota_class + - security_groups: security_groups_quota_class + - networks: networks_quota_optional + +**Example Show A Quota Class: JSON response** + +.. literalinclude:: ../../doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json + :language: javascript + +Create or Update Quotas for Quota Class +======================================= + +.. rest_method:: PUT /os-quota-class-sets/{id} + +Update the quotas for the Quota Class. + +If the requested Quota Class is not found in the DB, then the API will create the one. +Only 'default' quota class is valid and used to set the default quotas, all other quota class +would not be used anywhere. + +Normal response codes: 200 + +Error response codes: badRequest(400), unauthorized(401), forbidden(403) + +Request +------- + +.. rest_parameters:: parameters.yaml + + - id: quota_class_id + - quota_class_set: quota_class_set + - cores: cores_quota_class_optional + - fixed_ips: fixed_ips_quota_class_optional + - floating_ips: floating_ips_quota_class_optional + - injected_file_content_bytes: injected_file_content_bytes_quota_optional + - injected_file_path_bytes: injected_file_path_bytes_quota_optional + - injected_files: injected_files_quota_class_optional + - instances: instances_quota_class_optional + - key_pairs: key_pairs_quota_class_optional + - metadata_items: metadata_items_quota_optional + - ram: ram_quota_class_optional + - security_group_rules: security_group_rules_quota_class_optional + - security_groups: security_groups_quota_class_optional + - server_groups: server_groups_quota_class_optional + - server_group_members: server_group_members_quota_optional + - networks: networks_quota_optional + +**Example Update Quotas: JSON request** + +.. literalinclude:: ../../doc/api_samples/os-quota-class-sets/quota-classes-update-post-req.json + :language: javascript + +Response +-------- + +.. rest_parameters:: parameters.yaml + + - quota_class_set: quota_class_set + - cores: cores_quota_class + - fixed_ips: fixed_ips_quota_class + - floating_ips: floating_ips_quota_class + - injected_file_content_bytes: injected_file_content_bytes + - injected_file_path_bytes: injected_file_path_bytes + - injected_files: injected_files_quota_class + - instances: instances_quota_class + - key_pairs: key_pairs_quota_class + - metadata_items: metadata_items + - ram: ram_quota_class + - security_group_rules: security_group_rules_quota_class + - security_groups: security_groups_quota_class + - networks: networks_quota_optional + +**Example Update Quotas: JSON response** + +.. literalinclude:: ../../doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json + :language: javascript diff --git a/api-ref/source/os-quota-sets.inc b/api-ref/source/os-quota-sets.inc index a796eca3c9..8a650c3171 100644 --- a/api-ref/source/os-quota-sets.inc +++ b/api-ref/source/os-quota-sets.inc @@ -162,6 +162,8 @@ Response There is no body content for the response of a successful DELETE operation. +.. _list-default-quotas-for-tenant: + List Default Quotas For Tenant ============================== diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml index 9cd638bb5d..6353753dcb 100644 --- a/api-ref/source/parameters.yaml +++ b/api-ref/source/parameters.yaml @@ -207,6 +207,13 @@ port_id_path: in: path required: true type: string +quota_class_id: "a_class_id + description: | + The ID of the quota class. + Nova supports the ``default`` Quota Class only. + in: path + required: true + type: string request_id: description: | The ID of the request. @@ -1602,12 +1609,19 @@ contents: in: body required: true type: string -cores: +cores: &cores description: | The number of allowed instance cores for each tenant. in: body required: true type: integer +cores_quota_class: &cores_quota_class + <<: *cores + description: | + The number of allowed server cores for the quota class. +cores_quota_class_optional: + <<: *cores_quota_class + required: false cores_quota_details: description: | The object of detailed cores quota, including in_use, limit and @@ -2143,11 +2157,21 @@ fixed_ips: fixed_ips_quota: description: | The number of allowed fixed IP addresses for each tenant. Must be equal to or - greater than the number of allowed instances. + greater than the number of allowed servers. in: body required: true type: integer max_version: 2.35 +fixed_ips_quota_class: &fixed_ips_quota_class + description: | + The number of allowed fixed IP addresses for the quota class. Must be + equal to or greater than the number of allowed servers. + in: body + required: true + type: integer +fixed_ips_quota_class_optional: + <<: *fixed_ips_quota_class + required: false fixed_ips_quota_details: description: | The object of detailed fixed ips quota, including in_use, limit and @@ -2485,6 +2509,15 @@ floating_ips_list: in: body required: true type: array +floating_ips_quota_class: &floating_ips_quota_class + description: | + The number of allowed floating IP addresses for the quota class. + in: body + required: true + type: integer +floating_ips_quota_class_optional: + <<: *floating_ips_quota_class + required: false floating_ips_quota_details: description: | The object of detailed floating ips quota, including in_use, limit and @@ -3030,12 +3063,19 @@ injected_file_path_bytes_quota_optional: in: body required: false type: integer -injected_files: +injected_files: &injected_files description: | The number of allowed injected files for each tenant. in: body required: true type: integer +injected_files_quota_class: &injected_files_quota_class + <<: *injected_files + description: | + The number of allowed injected files for the quota class. +injected_files_quota_class_optional: + <<: *injected_files_quota_class + required: false injected_files_quota_details: description: | The object of detailed injected files quota, including in_use, limit and @@ -3116,12 +3156,19 @@ instanceActions: in: body required: true type: array -instances: +instances: &instances description: | - The number of allowed instances for each tenant. + The number of allowed servers for each tenant. in: body required: true type: integer +instances_quota_class: &instances_quota_class + <<: *instances + description: | + The number of allowed servers for the quota class. +instances_quota_class_optional: + <<: *instances_quota_class + required: false instances_quota_details: description: | The object of detailed instances quota, including in_use, limit and @@ -3213,12 +3260,19 @@ key_name_resp: in: body required: true type: string -key_pairs: +key_pairs: &key_pairs description: | The number of allowed key pairs for each user. in: body required: true type: integer +key_pairs_quota_class: &key_pairs_quota_class + <<: *key_pairs + description: | + The number of allowed key pairs for the quota class. +key_pairs_quota_class_optional: + <<: *key_pairs_quota_class + required: false key_pairs_quota_details: description: | The object of detailed key pairs quota, including in_use, limit and @@ -3753,6 +3807,12 @@ networks: in: body required: true type: object +networks_quota_optional: + description: | + The number of private networks that can be created per project. + in: body + required: false + type: integer new_file: description: | The name of the qcow2 file that Block Storage creates, which becomes the active @@ -4301,6 +4361,15 @@ project_id_value: in: body required: true type: string +quota_class_id_body: + <<: *quota_class_id + in: body +quota_class_set: + description: | + A ``quota_class_set`` object. + in: body + required: true + type: object quota_set: description: | A ``quota_set`` object. @@ -4313,12 +4382,19 @@ quota_tenant_or_user_id_body: in: body required: true type: string -ram: +ram: &ram description: | The amount of allowed instance RAM, in MB, for each tenant. in: body required: true type: integer +ram_quota_class: &ram_quota_class + <<: *ram + description: | + The amount of allowed instance RAM, in MB, for the quota class. +ram_quota_class_optional: + <<: *ram_quota_class + required: false ram_quota_details: description: | The object of detailed key ram quota, including in_use, @@ -4570,6 +4646,15 @@ security_group_rules_quota: required: true type: integer max_version: 2.35 +security_group_rules_quota_class: &security_group_rules_quota_class + description: | + The number of allowed rules for each security group. + in: body + required: true + type: integer +security_group_rules_quota_class_optional: + <<: *security_group_rules_quota_class + required: false security_group_rules_quota_details: description: | The object of detailed security group rules quota, including in_use, @@ -4599,6 +4684,15 @@ security_groups_quota: required: true type: integer max_version: 2.35 +security_groups_quota_class: &security_groups_quota_class + description: | + The number of allowed security groups for the quota class. + in: body + required: true + type: integer +security_groups_quota_class_optional: + <<: *security_groups_quota_class + required: false security_groups_quota_details: description: | The object of detailed security groups, including in_use, @@ -4668,7 +4762,7 @@ server_group_members_quota_optional: in: body required: false type: integer -server_groups: +server_groups: &server_groups description: | The number of allowed server groups for each tenant. in: body @@ -4680,6 +4774,11 @@ server_groups_list: in: body required: true type: array +server_groups_quota_class_optional: + <<: *server_groups + description: | + The number of allowed server groups for the quota class. + required: false server_groups_quota_details: description: | The object of detailed server groups, including in_use, diff --git a/doc/api_samples/os-quota-class-sets/quota-classes-update-post-req.json b/doc/api_samples/os-quota-class-sets/quota-classes-update-post-req.json index f074c829ff..483fda8c53 100644 --- a/doc/api_samples/os-quota-class-sets/quota-classes-update-post-req.json +++ b/doc/api_samples/os-quota-class-sets/quota-classes-update-post-req.json @@ -4,6 +4,7 @@ "cores": 50, "ram": 51200, "floating_ips": 10, + "fixed_ips": -1, "metadata_items": 128, "injected_files": 5, "injected_file_content_bytes": 10240,