Quota usage refresh in Openstack

Openstack stores quota usage for tenants in the database in quota_usages table. Nova and cinder have by default their own separate databases and in each database you get a new quota_usages table.

The structure of the quota_usages table is as follows

+---------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+----------------+
| created_at | datetime | YES | | NULL | |
| updated_at | datetime | YES | | NULL | |
| deleted_at | datetime | YES | | NULL | |
| id | int(11) | NO | PRI | NULL | auto_increment |
| project_id | varchar(255) | YES | MUL | NULL | |
| resource | varchar(255) | NO | | NULL | |
| in_use | int(11) | NO | | NULL | |
| reserved | int(11) | NO | | NULL | |
| until_refresh | int(11) | YES | | NULL | |
| deleted | int(11) | YES | | NULL | |
| user_id | varchar(255) | YES | MUL | NULL | |
+---------------+--------------+------+-----+---------+----------------+

 

Remember that quotas are managed per project, so in this table project_id is your navigating key. Project IDs are used to identify projects. For a particular project, you can retrieve the project ID using

openstack project list | grep $PROJECT_NAME

The other interesting fields in the quota_usages table are

resource: for example in nova, it can be “instance, ram, cores, security_groups”

in_use : This is the amount per resource that Openstack “thinks” that project is using

Occasionally the in_use field is not updated properly and you might find yourself in a situation where openstack is reporting usage that doesn’t exist. You have two options at this point

  • Use the nova-manage project quota_usage_refresh command to try to refresh the quota for a specific project. The syntax is something like
nova-manage project quota_usage_refresh --project PROJECT_ID --user USER_ID --key cores
  • If that doesn’t help, you may have to update the MySQL database using the update statement. You will need to restart the respective service after that to see the change

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.