Jump to: navigation, search

Difference between revisions of "KeystoneCentralizedQuotaManagement"

(Implementation)
(Design)
 
(43 intermediate revisions by 2 users not shown)
Line 4: Line 4:
  
 
== Introduction ==
 
== Introduction ==
In Keystone v3 (Grizzly release), Domains encapsulates users and projects into logical entities that can represent accounts, organizations, etc. Currently there is no capability or mechanism to manage or enforce quotas at domain level. Assigning or updating quota values or limits to a domain will allow the cloud administrator to evaluate domain lists and consumption. In order to achieve these capabilities it will be required to implement quota management for Keystone domains.
+
TBD
The goal of this blueprint is to support quotas at the OpenStack Domain level. The design of the feature models, as far as possible, the style of project quotas.
 
 
 
  
 
== Openstack Quotas ==
 
== Openstack Quotas ==
Today OpenStack services make usage of quotas to limit the project resources.
 
For example,  the “Instances” quota represents the number of instances that can be created in a project. The table below summarizes the existing project quotas.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 54: Line 50:
  
 
== User Stories ==
 
== User Stories ==
Domain Quotas might impact partitioned OpenStack deployments (regions, cells, etc). Here we consider only the impact on regions. These can be
+
TBD
# Per–Region domain quotas
 
# Across region domain quotas
 
 
 
The 1st approach works similar to the current implementation of quotas per project; in a multi-region scenario, the domain quotas are enforced by each service in a non-centralized fashion. The 2nd approach, a domain quota is shared dynamically among regions, e.g. if a service from a given region needs more quota than the others, it requests more quotas.
 
This blueprint addresses the per–region domain quotas. The user stories are listed below:
 
:* As a cloud administrator, I want to create a domain with default domain quotas
 
:* As a cloud/domain administrator, I want to see the domain quotas for a domain in a region
 
:* As a cloud/domain administrator, I want to see the domain quotas usage for a domain in a region
 
:* As a cloud administrator, I want to update the quotas for a domain in a region
 
:* As a cloud administrator, I want to delete the quotas for a domain in a region
 
 
 
Since quotas deals with sensible aspects of resource consumption, we identified the need to log the interactions of users when they manage domain quotas.
 
  
 
== Design ==
 
== Design ==
Our proposal have 2 main blocks: one in keystone we are calling the Domain Quota Proxy (DQP), the other  we are calling Domain Quota Driver (DQD). The DQP is responsible to give to user one point of domain quota management, so it acts as a proxy.  The DQP is a set of extensions that can be improved to serve as a single point of management for other quotas. The DQD is a piece of code located in the quota module of Nova, Cinder and Quantum projects, and it's designed in the same fashion as the other drivers present in such module.
 
  
 +
The proposed solution implies storing Quotas in Keystone.
  
[[File:Domainquota.png|600x269px]]
+
Keystone API will get additional endpoint and set of operations to adjust Quotas for various resources for Users and Projects. Keystone DB will be extended with appropriate fields to store Quota information. Other Openstack components will be requesting resource reservations via Keystone API.
  
Quota modules need to be refactored to add DQD. Also we should extend the services REST API to provide domain quotas usage to Domain Quota Proxy. The DQP is designed to be implemented as a discrete extension and not included in the default pipeline of Keystone. The Domain Quota Driver design is similar to the current quota driver from quota.py module, given the possibility to the user to option to use it or not; they will be responsible to enforce all quotas listed in the table above in the context of domains.  
+
<b>Sample workflow: Launching VM instance</b>
 +
[[File:KeystoneQuotasSampleWorkflow.png]]<br/>
 +
1. Client obtains token from the Keystone<br/>
 +
2. Client sends request to Nova API to launch VM instance<br/>
 +
3. Nova API verifies token in Keystone<br/>
 +
4. Nova requests Keystone to get all available quotas for project/user. Nova calculates amount of used resources and allows or permits operation<br/>
 +
5. Nova API calls nova-compute via RPC to launch VM instance. <br/>
  
 
===REST API===
 
===REST API===
  
<b>Get resource list.</b>
+
<b>Get resource list</b>
 
<pre><nowiki>
 
<pre><nowiki>
GET v3/os-quotas/resources
+
GET v3/OS-QUOTAS/resources
 
Content-Type application/json
 
Content-Type application/json
 
Accept application/json
 
Accept application/json
Line 100: Line 90:
  
  
<b>Create resource.</b>
+
<b>Create resource</b>
 
<pre><nowiki>
 
<pre><nowiki>
POST v3/os-quotas/resources
+
POST v3/OS-QUOTAS/resources
 
Content-Type application/json
 
Content-Type application/json
 
Accept application/json
 
Accept application/json
Line 114: Line 104:
 
     "resource": {
 
     "resource": {
 
         "name": "nova.instances",
 
         "name": "nova.instances",
         "default_value": 10
+
         "default_limit": 10
 
     }
 
     }
 
}
 
}
Line 120: Line 110:
  
  
<b>Get resource.</b>
+
<b>Get resource</b>
 
<pre><nowiki>
 
<pre><nowiki>
GET v3/os-quotas/resources/[resource-id]
+
GET v3/OS-QUOTAS/resources/[resource-id]
 
Content-Type application/json
 
Content-Type application/json
 
Accept application/json
 
Accept application/json
Line 134: Line 124:
 
     "resource": {
 
     "resource": {
 
         "name": "nova.instances",
 
         "name": "nova.instances",
         "default_value": 10
+
         "default_limit": 10
 
     }
 
     }
 
}
 
}
Line 140: Line 130:
  
  
<b>Update resource.</b>
+
<b>Update resource</b>
 
<pre><nowiki>
 
<pre><nowiki>
PUT v3/os-quotas/resources/[resource-id]
+
PATCH v3/OS-QUOTAS/resources/[resource-id]
 
Content-Type application/json
 
Content-Type application/json
 
Accept application/json
 
Accept application/json
Line 154: Line 144:
 
     "resource": {
 
     "resource": {
 
         "name": "nova.instances",
 
         "name": "nova.instances",
         "default_value": 10
+
         "default_limit": 10
 
     }
 
     }
 
}
 
}
Line 163: Line 153:
 
     "resource": {
 
     "resource": {
 
         "name": "nova.instances",
 
         "name": "nova.instances",
         "default_value": 10
+
         "default_limit": 10
 
     }
 
     }
 
}
 
}
Line 169: Line 159:
  
  
<b>Delete resource.</b>
+
<b>Delete resource</b>
 
<pre><nowiki>
 
<pre><nowiki>
DELETE v3/os-quotas/resources/[resource-id]
+
DELETE v3/OS-QUOTAS/resources/[resource-id]
 
Content-Type application/json
 
Content-Type application/json
 
Accept application/json
 
Accept application/json
Line 180: Line 170:
  
  
<b>Get quota list.</b>
+
<b>Get quota list</b>
 
<pre><nowiki>
 
<pre><nowiki>
GET v3/os-quotas/[subject-type]/[subject-id]/quotas
+
GET v3/OS-QUOTAS/[subject-type]/[subject-id]/quotas
 
Content-Type application/json
 
Content-Type application/json
 
Accept application/json
 
Accept application/json
 
</nowiki></pre>
 
</nowiki></pre>
 +
(subject-type is 'user' or 'project')<br/>
  
 
Normal Response Code: 200<br/>
 
Normal Response Code: 200<br/>
Line 195: Line 186:
 
         {
 
         {
 
             "id": "000-id-000",
 
             "id": "000-id-000",
             "resource-name": "nova.ram",
+
             "resource_name": "nova.ram",
 
             "limit": 1024
 
             "limit": 1024
 
         },
 
         },
 
         {
 
         {
 
             "id": "111-id-111",
 
             "id": "111-id-111",
             "resource-name": "nova.vcpu",
+
             "resource_name": "nova.vcpu",
 
             "limit": 16
 
             "limit": 16
 
         },
 
         },
Line 208: Line 199:
  
  
<b>Create quota.</b>
+
<b>Create quota</b>
 
<pre><nowiki>
 
<pre><nowiki>
POST v3/os-quotas/[subject-type]/[subject-id]/quotas
+
POST v3/OS-QUOTAS/[subject-type]/[subject-id]/quotas
 
Content-Type application/json
 
Content-Type application/json
 
Accept application/json
 
Accept application/json
 
</nowiki></pre>
 
</nowiki></pre>
 +
(subject-type is 'user' or 'project')<br/>
  
 
Normal Response Code: 200<br/>
 
Normal Response Code: 200<br/>
Line 221: Line 213:
 
{
 
{
 
     "quota": {
 
     "quota": {
         "resource-name": "nova.ram",
+
         "resource_name": "nova.ram",
 
         "limit": 1024
 
         "limit": 1024
 
     }
 
     }
Line 230: Line 222:
 
{
 
{
 
     "quota": {
 
     "quota": {
         "resource-name": "nova.ram",
+
         "resource_name": "nova.ram",
 
         "limit": 1024
 
         "limit": 1024
 
     }
 
     }
Line 237: Line 229:
  
  
<b>Get quota.</b>
+
<b>Get quota</b>
 
<pre><nowiki>
 
<pre><nowiki>
GET v3/os-quotas/[subject-type]/[subject-id]/quotas/[quota-id]
+
GET v3/OS-QUOTAS/[subject-type]/[subject-id]/quotas/[quota-id]
 
Content-Type application/json
 
Content-Type application/json
 
Accept application/json
 
Accept application/json
 
</nowiki></pre>
 
</nowiki></pre>
 +
(subject-type is 'user' or 'project')<br/>
  
 
Normal Response Code: 200<br/>
 
Normal Response Code: 200<br/>
Line 250: Line 243:
 
{
 
{
 
     "quota": {
 
     "quota": {
         "resource-name": "nova.ram",
+
         "resource_name": "nova.ram",
 
         "limit": 1024
 
         "limit": 1024
 
     }
 
     }
Line 256: Line 249:
 
</nowiki></pre>
 
</nowiki></pre>
  
<b>Update quota.</b>
+
<b>Update quota</b>
 
<pre><nowiki>
 
<pre><nowiki>
PUT v3/os-quotas/[subject-type]/[subject-id]/quotas/[quota-id]
+
PATCH v3/OS-QUOTAS/[subject-type]/[subject-id]/quotas/[quota-id]
 
Content-Type application/json
 
Content-Type application/json
 
Accept application/json
 
Accept application/json
 
</nowiki></pre>
 
</nowiki></pre>
 +
(subject-type is 'user' or 'project')<br/>
  
 
Normal Response Code: 200<br/>
 
Normal Response Code: 200<br/>
Line 269: Line 263:
 
{
 
{
 
     "quota": {
 
     "quota": {
         "resource-name": "nova.ram",
+
         "resource_name": "nova.ram",
 
         "limit": 1024
 
         "limit": 1024
 
     }
 
     }
Line 286: Line 280:
  
  
<b>Delete quota.</b>
+
<b>Delete quota</b>
 
<pre><nowiki>
 
<pre><nowiki>
DELETE v3/os-quotas/[subject-type]/[subject-id]/quotas/[quota-id]
+
DELETE v3/OS-QUOTAS/[subject-type]/[subject-id]/quotas/[quota-id]
 
Content-Type application/json
 
Content-Type application/json
 
Accept application/json
 
Accept application/json
 
</nowiki></pre>
 
</nowiki></pre>
 +
(subject-type is 'user' or 'project')<br/>
  
 
Normal Response Code: 200<br/>
 
Normal Response Code: 200<br/>
 
Error Response Codes: Unauthorized (401), Not Found (404)<br/>
 
Error Response Codes: Unauthorized (401), Not Found (404)<br/>
 
 
<b>Create reservation.</b>
 
<pre><nowiki>
 
POST v3/os-quotas/[subject-type]/[subject-id]/reservations
 
Content-Type application/json
 
Accept application/json
 
</nowiki></pre>
 
 
Normal Response Code: 200<br/>
 
Error Response Codes: Unauthorized (401)<br/>
 
Request:<br/>
 
<pre><nowiki>
 
{
 
    "reservations": [
 
        {
 
            "resource-name": "nova.ram",
 
            "amount": 1024
 
        },
 
        {
 
            "resource-name": "nova.vcpu",
 
            "amount": 1
 
        }
 
    ]
 
}
 
</nowiki></pre>
 
Response:<br/>
 
<pre><nowiki>
 
{
 
    "reservations": [
 
        {
 
            "id": "000-id-000",
 
            "resource-name": "nova.ram",
 
            "amount": 1024
 
        },
 
        {
 
            "id": "111-id-111",
 
            "resource-name": "nova.vcpu",
 
            "amount": 1
 
        }
 
    ]
 
}
 
</nowiki></pre>
 
 
 
<b>Delete reservation.</b>
 
<pre><nowiki>
 
DELETE v3/os-quotas/[subject-type]/[subject-id]/reservations
 
Content-Type application/json
 
Accept application/json
 
</nowiki></pre>
 
 
Normal Response Code: 200<br/>
 
Error Response Codes: Unauthorized (401), Not Found (404)<br/>
 
 
 
<b>Get reservation.</b>
 
<pre><nowiki>
 
GET v3/os-quotas/[subject-type]/[subject-id]/reservations/[reservation-id]
 
Content-Type application/json
 
Accept application/json
 
</nowiki></pre>
 
 
Normal Response Code: 200<br/>
 
Error Response Codes: Unauthorized (401), Not Found (404)<br/>
 
Response:<br/>
 
<pre><nowiki>
 
{
 
    "reservation": {
 
        "id": "000-id-000",
 
        "resource-name": "nova.ram",
 
        "amount": 1024
 
    }
 
}
 
</nowiki></pre>
 
 
<b>Get reservation list.</b>
 
<pre><nowiki>
 
GET v3/os-quotas/[subject-type]/[subject-id]/reservations?filter=...
 
Content-Type application/json
 
Accept application/json
 
</nowiki></pre>
 
 
Normal Response Code: 200<br/>
 
Error Response Codes: Unauthorized (401)<br/>
 
 
Response:<br/>
 
<pre><nowiki>
 
{
 
    "reservations": [
 
        {
 
            "id": "000-id-000",
 
            "resource-name": "nova.ram",
 
            "amount": 1024
 
        },
 
        {
 
            "id": "111-id-111",
 
            "resource-name": "nova.vcpu",
 
            "amount": 1
 
        }
 
    ]
 
}
 
</nowiki></pre>
 
  
 
== Implementation ==
 
== Implementation ==
 
<b>Data structure</b>
 
 
Resources:<br/>
 
- id (String)<br/>
 
- resource_name (String)<br/>
 
- description (Text)<br/>
 
 
ProjectQuotas:<br/>
 
- id<br/>
 
- project_id<br/>
 
- resource_id<br/>
 
- limit<br/>
 
 
UserQuotas:<br/>
 
- id<br/>
 
- project_id<br/>
 
- resource_id<br/>
 
- limit<br/>
 
 
Reservations<br/>
 
- id<br/>
 
- resource_id<br/>
 
- user_id<br/>
 
- project_id<br/>
 
- delta<br/>
 
 
 
  
 
----------------------------
 
----------------------------
For '''Domain Quota Proxy''', information will be stored in new tables in keystone which are as shown below <br/>
+
Information will be stored in new tables in keystone which are as shown below <br/>
  
[[File:DB Tables Domain Quota Proxy.png]]<br/>
 
  
Tables are made generic enough so as to accommodate quotas for any resource of any service. 'resources' table stores the information required for the resources. 'quotas' table is capable enough to store quota for any entity (and not just domain). Entity for which a quota is set is called as child in generic terms. Entity responsible for managing quota of a child is called parent. A child and a parent, need not be described just by a single field like user-id alone. There can be multiple fields (like user-id, role, project-id, etc.) and its values which in combination describes a child or a parent. This can be seen as best represented in general by a dictionary. For simple DB implementation, it is suggested to store this dictionary as separate key-value data in separate tables. These tables are 'child_field_data' and 'parent_field_data' tables.
+
'resources' table stores information required for the resources. <br/>
 +
'project_quotas' table stores quotas information for projects.<br/>
 +
'user_quotas' table stores quotas information for users.<br/>
  
 
Details of fields of various DB tables is mentioned below,
 
Details of fields of various DB tables is mentioned below,
Line 443: Line 308:
 
! Column || Description  
 
! Column || Description  
 
|-
 
|-
|id||primary key
+
|id || primary key
 
|-
 
|-
|name||name of the resource in the format <Service-Name>.<Resource Name>. For eg., nova.instances
+
|name || name of the resource in the format <Service-Name>.<Resource Name>. For example, nova.instances
 
|-
 
|-
|description||resource description
+
|description || resource description
 
|}
 
|}
  
Line 457: Line 322:
 
| id || primary key
 
| id || primary key
 
|-
 
|-
| project_id || primary key
+
| project_id || foreign key to projects table
 
|-
 
|-
| resource_id||foreign key to resources table
+
| resource_id || foreign key to resources table
 
|-
 
|-
| limit||absolute quota limit
+
| limit || absolute quota limit
 
|}
 
|}
  
Line 471: Line 336:
 
| id || primary key
 
| id || primary key
 
|-
 
|-
| user_id || primary key
+
| user_id || foreign key to users table
|-
 
| resource_id||foreign key to resources table
 
|-
 
| limit||absolute quota limit
 
|}
 
 
 
'''Reservations Table'''
 
{| class="wikitable"
 
|-
 
! Column || Description
 
|-
 
| id || primary key
 
|-
 
| user_id || primary key
 
 
|-
 
|-
| project_id || primary key
+
| resource_id || foreign key to resources table
 
|-
 
|-
| resource_id||foreign key to resources table
+
| limit || absolute quota limit
|-
 
| delta||absolute quota limit
 
|-
 
| object_id || object_id
 
|-
 
| expiration_time | time
 
 
|}
 
|}
 
 
For history tracking, updates done in table <<nowiki />table-name> (orange heading) will be stored in the corresponding history table h_<<nowiki />table-name> (blue heading). For eg., 'h_quotas' table will be used for keeping track of updates done in the table 'quotas'.<br/>
 
 
For '''Domain Quota Driver''', the information will be stored in new tables in services which are as shown below 
 
<br/>
 
[[File:DB_Tables_Domain_Quota_Driver.png]]
 
<br/>
 
Columns of 'domain_quotas' table are similar to columns of 'quotas' table in keystone mentioned above. It will be used to store only domain quotas, as there are other tables already present to store other quotas. This can be used in future to store all types of quotas in a single table. 'resource_id' is a foreign key to already existing resource table in corresponding service.
 
  
 
== Open Stack Quota References ==
 
== Open Stack Quota References ==
This is a list of URLs of work on quotas within OpenStack.
+
This is a list of URLs which shows current status of work on quotas within OpenStack.
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Topic || URI || Notes
 
! Topic || URI || Notes
 
|-
 
|-
| Per-user quotas support || https://blueprints.launchpad.net/nova/+spec/per-user-quotas || Blocked to be re-introduced in Grizzly
+
| Per-user quotas support || https://blueprints.launchpad.net/nova/+spec/per-user-quotas || Blocked. To be re-introduced in Grizzly
 
|-
 
|-
| Stores Quotas centrally in Keystone || http://wiki.openstack.org/KeystoneStoreQuotaData ||  
+
| Keystone as a central Quota Storage || http://wiki.openstack.org/KeystoneStoreQuotaData ||  
 
|-
 
|-
 
| Quantum Quotas ||  http://docs.openstack.org/api/openstack-network/2.0/content/List_Quotas.html ||
 
| Quantum Quotas ||  http://docs.openstack.org/api/openstack-network/2.0/content/List_Quotas.html ||
Line 523: Line 359:
 
| Quota Project: An effective way to manage the usage of your Swift-based storage cloud || http://www.zmanda.com/blogs/?cat=22 ||
 
| Quota Project: An effective way to manage the usage of your Swift-based storage cloud || http://www.zmanda.com/blogs/?cat=22 ||
 
|-
 
|-
! Update Limits and Quotas to Key On volume_type || https://blueprints.launchpad.net/cinder/+spec/quotas-limits-by-voltype ||  Not started, grizzly-3 target
+
! Update Limits and Quotas to Key On volume_type || https://blueprints.launchpad.net/cinder/+spec/quotas-limits-by-voltype ||  Not started yet, targeted at grizzly-3  
 
|-
 
|-
 
| Demystifying OpenStack Folsom Quotas ||  http://ops.anthonygoddard.com/OpenStack/demystifying-openstack-folsom-quotas/ || Explains Cinder/Nova quota separation
 
| Demystifying OpenStack Folsom Quotas ||  http://ops.anthonygoddard.com/OpenStack/demystifying-openstack-folsom-quotas/ || Explains Cinder/Nova quota separation

Latest revision as of 11:07, 16 July 2013

Introduction

TBD

Openstack Quotas

quotas type default values description
nova.instances reservable 10 number of instances allowed per project
nova.cores reservable 20 number of instance cores allowed per project
nova.ram reservable 50*1024 megabytes of instance ram allowed per project
nova.floating_ips reservable 10 number of floating ips allowed per project
nova.fixed_ips reservable -1 number of fixed ips allowed per project
nova.metadata_items absolute 128 number of metadata items allowed per instance
nova.injected_files absolute 5 number of injected files allowed
nova.injected_files_content_bytes absolute 10*1024 number of bytes allowed per injected file
nova.injected_file_path_bytes absolute 255 number of bytes allowed per injected file path
nova.security_groups reservable 10 number of security groups per project
nova.security_groups_rules countable 20 number of security rules per security group
nova.key_pairs countable 100 number of key pairs per user
cinder.volumes reservable 10 number of volumes allowed per project
cinder.snapshots reservable 10 number of volume snapshots allowed per project
cinder.gigabytes reservable 1000 number of volume gigabytes (snapshots are also included) per project
quantum.network countable 10 Number of networks allowed per tenant
quantum.subnet countable 10 Number of subnets allowed per tenant
quantum.port countable 50 number of ports allowed per tenant

User Stories

TBD

Design

The proposed solution implies storing Quotas in Keystone.

Keystone API will get additional endpoint and set of operations to adjust Quotas for various resources for Users and Projects. Keystone DB will be extended with appropriate fields to store Quota information. Other Openstack components will be requesting resource reservations via Keystone API.

Sample workflow: Launching VM instance KeystoneQuotasSampleWorkflow.png
1. Client obtains token from the Keystone
2. Client sends request to Nova API to launch VM instance
3. Nova API verifies token in Keystone
4. Nova requests Keystone to get all available quotas for project/user. Nova calculates amount of used resources and allows or permits operation
5. Nova API calls nova-compute via RPC to launch VM instance.

REST API

Get resource list

GET v3/OS-QUOTAS/resources
Content-Type application/json
Accept application/json

Normal Response Code: 200
Error Response Codes: Unauthorized (401)
Response:

{
    "resources": [
        "nova.instances",
        "nova.cores",
        "nova.ram",
        "cinder.volumes"
    ]
}


Create resource

POST v3/OS-QUOTAS/resources
Content-Type application/json
Accept application/json

Normal Response Code: 200
Error Response Codes: Unauthorized (401)
Request:

{
    "resource": {
        "name": "nova.instances",
        "default_limit": 10
    }
}


Get resource

GET v3/OS-QUOTAS/resources/[resource-id]
Content-Type application/json
Accept application/json

Normal Response Code: 200
Error Response Codes: Unauthorized (401), Not Found (404)
Response:

{
    "resource": {
        "name": "nova.instances",
        "default_limit": 10
    }
}


Update resource

PATCH v3/OS-QUOTAS/resources/[resource-id]
Content-Type application/json
Accept application/json

Normal Response Code: 200
Error Response Codes: Unauthorized (401), Not Found (404)
Request:

{
    "resource": {
        "name": "nova.instances",
        "default_limit": 10
    }
}

Response:

{
    "resource": {
        "name": "nova.instances",
        "default_limit": 10
    }
}


Delete resource

DELETE v3/OS-QUOTAS/resources/[resource-id]
Content-Type application/json
Accept application/json

Normal Response Code: 200
Error Response Codes: Unauthorized (401), Not Found (404)


Get quota list

GET v3/OS-QUOTAS/[subject-type]/[subject-id]/quotas
Content-Type application/json
Accept application/json

(subject-type is 'user' or 'project')

Normal Response Code: 200
Error Response Codes: Unauthorized (401)
Response:

{
    "quotas": [
        {
            "id": "000-id-000",
            "resource_name": "nova.ram",
            "limit": 1024
        },
        {
            "id": "111-id-111",
            "resource_name": "nova.vcpu",
            "limit": 16
        },
    ]
}


Create quota

POST v3/OS-QUOTAS/[subject-type]/[subject-id]/quotas
Content-Type application/json
Accept application/json

(subject-type is 'user' or 'project')

Normal Response Code: 200
Error Response Codes: Unauthorized (401)
Request:

{
    "quota": {
        "resource_name": "nova.ram",
        "limit": 1024
    }
}

Response:

{
    "quota": {
        "resource_name": "nova.ram",
        "limit": 1024
    }
}


Get quota

GET v3/OS-QUOTAS/[subject-type]/[subject-id]/quotas/[quota-id]
Content-Type application/json
Accept application/json

(subject-type is 'user' or 'project')

Normal Response Code: 200
Error Response Codes: Unauthorized (401), Not Found (404)
Response:

{
    "quota": {
        "resource_name": "nova.ram",
        "limit": 1024
    }
}

Update quota

PATCH v3/OS-QUOTAS/[subject-type]/[subject-id]/quotas/[quota-id]
Content-Type application/json
Accept application/json

(subject-type is 'user' or 'project')

Normal Response Code: 200
Error Response Codes: Unauthorized (401), Not Found (404)
Request:

{
    "quota": {
        "resource_name": "nova.ram",
        "limit": 1024
    }
}

Response:

{
    "quota": {
        "id": "000-id-000",
        "resource-name": "nova.ram",
        "limit": 1024
    }
}


Delete quota

DELETE v3/OS-QUOTAS/[subject-type]/[subject-id]/quotas/[quota-id]
Content-Type application/json
Accept application/json

(subject-type is 'user' or 'project')

Normal Response Code: 200
Error Response Codes: Unauthorized (401), Not Found (404)

Implementation


Information will be stored in new tables in keystone which are as shown below 


'resources' table stores information required for the resources.
'project_quotas' table stores quotas information for projects.
'user_quotas' table stores quotas information for users.

Details of fields of various DB tables is mentioned below,

Resources Table

Column Description
id primary key
name name of the resource in the format <Service-Name>.<Resource Name>. For example, nova.instances
description resource description

Project_Quotas Table

Column Description
id primary key
project_id foreign key to projects table
resource_id foreign key to resources table
limit absolute quota limit

User_Quotas Table

Column Description
id primary key
user_id foreign key to users table
resource_id foreign key to resources table
limit absolute quota limit

Open Stack Quota References

This is a list of URLs which shows current status of work on quotas within OpenStack.

Topic URI Notes
Per-user quotas support https://blueprints.launchpad.net/nova/+spec/per-user-quotas Blocked. To be re-introduced in Grizzly
Keystone as a central Quota Storage http://wiki.openstack.org/KeystoneStoreQuotaData
Quantum Quotas http://docs.openstack.org/api/openstack-network/2.0/content/List_Quotas.html
Swift Quotas https://blueprints.launchpad.net/swift/+spec/storage-quotas Implementation status unknown
Quota Project: An effective way to manage the usage of your Swift-based storage cloud http://www.zmanda.com/blogs/?cat=22
Update Limits and Quotas to Key On volume_type https://blueprints.launchpad.net/cinder/+spec/quotas-limits-by-voltype Not started yet, targeted at grizzly-3
Demystifying OpenStack Folsom Quotas http://ops.anthonygoddard.com/OpenStack/demystifying-openstack-folsom-quotas/ Explains Cinder/Nova quota separation
per-user quotas support https://blueprints.launchpad.net/nova/+spec/per-user-quotas Blocked by bug https://bugs.launchpad.net/nova/+bug/1034384. It will be re-introduced into Grizzly