KeystoneCentralizedQuotaManagement


 * Launchpad Entry: Store Quota Data
 * Created: 04 July 2013
 * Contributors: Dmitry Russkikh, Dmitry Stepanenko, Yehia Beyh, Glaucimar Aguiar, Tiago Martins, Akshat Kakkar Ulrich Schwickerath,

Introduction
TBD

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 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

Project_Quotas Table

User_Quotas Table

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