You are on page 1of 5

Folsom Quantum Quota Extension guide (Draft version

)

What’s quota extension?
Quota is a function to limit number of resources. You can enforce default quota for all tenant. You will get error when you try to create resources more than the number of quota value. Example: ubuntu@ubuntu:~/devstack$ quantum net-create test_net Quota exceeded for resources: ['network'] Per-tenant quota configuration is also supported by quota extension API. Furthermore, quota has driver architecture. So you can extend behavior of quota by implementing new quota driver. (eg LDAPQuotaDriver)

Configration
If you want to use quota function, quota.conf configuration is needed. This is a sample configuration. In this configuration, all tenant uses default quota values. [QUOTAS] # resource name(s) that are supported in quota features quota_items = network,subnet,port # default number of resource allowed per tenant, minus for unlimited default_quota = 1 # number of networks allowed per tenant, and minus means unlimited # quota_network = 10 # number of subnets allowed per tenant, and minus means unlimited # quota_subnet = 10 # number of ports allowed per tenant, and minus means unlimited # quota_port = 50

# default driver to use for quota checks quota_driver = quantum.quota.ConfDriver If you want to configure quota value per tenant, you need to use DbQuotaDriver.
quota_driver = quantum.extensions._quotav2_driver.DbQuotaDriver

Quantum CLI for quota
There are 4 cli for quota. quota-delete quota-list quota-show quota-update Delete a given tenant's quotas. List all tenants' quotas. Show information of a given resource Define tenant's quotas not to use defaults.

Note that the default value of quotas are enforced for all tenant by default, so there is no quota-create command. Note that ‘admin’ role is required to change a quota value. #Note quantum -h has typos https://bugs.launchpad.net/pythonquantumclient/+bug/1053099 -> in progress by Yong You can update tenant’s quota by quantum quota-update command. Here are paramters. --tenant-id tenant-id the owner tenant ID --network networks the limit of network quota --subnet subnets the limit of subnet quota --port ports the limit of port quota Note --router and --floatingip also can be used with l3 extension. --router the limit of --router --floatingip the limit of --floatingip [Example]

ubuntu@ubuntu:~/devstack$ quantum quota-update --tenant_id 3db4f5a6536c4818863dc02879797f1f --network 10 +------------+-------+ | Field | Value | +------------+-------+ | floatingip | 50 | | network | 10 | | port | 50 | | router | 10 | | subnet | 2 | +------------+-------+ You can use quantum quota-list command to check current configuration. [Example] ubuntu@ubuntu:~/devstack$ quantum quota-list +------------+---------+------+--------+--------+----------------------------------+ | floatingip | network | port | router | subnet | tenant_id | +------------+---------+------+--------+--------+----------------------------------+ | 50 | 10 | 50 | 10 | 2 | 3db4f5a6536c4818863dc02879797f1f | +------------+---------+------+--------+--------+----------------------------------+ You can delete quota of tenant using quantum quota-delete command. Paramter --tenant-id tenant-id the owner tenant ID

ubuntu@ubuntu:~/devstack$ quantum quota-delete --tenant_id 3db4f5a6536c4818863dc02879797f1f Deleted quota: 3db4f5a6536c4818863dc02879797f1f ubuntu@ubuntu:~/devstack$ quantum quota-list ( The quota is deleted )

API Specifictaion

Quota update PUT /v2.0/quotas/<tenant_id>

Request Body: { "quota": { "network": 10 } }

HTTP code: 200 OK 400 Bad Request 403 Authorized error 404 Not found 500 Internal Server Error Response Body for 200 OK: { "quota": { "floatingip": 50, "network": 10, "port": 50, "router": 10, "subnet": 2 } }

List quota GET /v2.0/quotas/ HTTP code: 200 OK 403 Authorized error 500 Internal Server Error Response Body for 200 OK:

{ "quotas": [ { "floatingip": 50, "network": 10, "port": 50, "router": 10, "subnet": 2, "tenant_id": "3db4f5a6536c4818863dc02879797f1f" } ] }

Delete quota DELETE /v2.0/quotas/<tenant_id> HTTP code: 204 No contents 403 Authorized error 404 Not found 500 Internal Server Error