{"id":1101,"date":"2018-02-16T03:44:10","date_gmt":"2018-02-16T03:44:10","guid":{"rendered":"https:\/\/mohamedelsakhawy.wordpress.com\/?p=1101"},"modified":"2018-02-16T03:44:10","modified_gmt":"2018-02-16T03:44:10","slug":"quota-usage-refresh-in-openstack","status":"publish","type":"post","link":"https:\/\/mohamede.com\/?p=1101","title":{"rendered":"Quota usage refresh in Openstack"},"content":{"rendered":"<p>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.<\/p>\n<p>The structure of the quota_usages table is as follows<\/p>\n<pre>+---------------+--------------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+---------------+--------------+------+-----+---------+----------------+\n| created_at | datetime | YES | | NULL | |\n| updated_at | datetime | YES | | NULL | |\n| deleted_at | datetime | YES | | NULL | |\n| id | int(11) | NO | PRI | NULL | auto_increment |\n| project_id | varchar(255) | YES | MUL | NULL | |\n| resource | varchar(255) | NO | | NULL | |\n| in_use | int(11) | NO | | NULL | |\n| reserved | int(11) | NO | | NULL | |\n| until_refresh | int(11) | YES | | NULL | |\n| deleted | int(11) | YES | | NULL | |\n| user_id | varchar(255) | YES | MUL | NULL | |\n+---------------+--------------+------+-----+---------+----------------+<\/pre>\n<p>&nbsp;<\/p>\n<p>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<\/p>\n<pre>openstack project list | grep $PROJECT_NAME<\/pre>\n<p>The other interesting fields in the quota_usages table are<\/p>\n<p>resource: for example in nova, it can be &#8220;instance, ram, cores, security_groups&#8221;<\/p>\n<p>in_use : This is the amount per resource that Openstack &#8220;thinks&#8221; that project is using<\/p>\n<p>Occasionally the in_use field is not updated properly and you might find yourself in a situation where openstack is reporting usage that doesn&#8217;t exist. You have two options at this point<\/p>\n<ul>\n<li>Use the nova-manage project quota_usage_refresh command to try to refresh the quota for a specific project. The syntax is something like<\/li>\n<\/ul>\n<pre>nova-manage project quota_usage_refresh --project PROJECT_ID --user USER_ID --key cores<\/pre>\n<ul>\n<li>If that doesn&#8217;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<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>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 +&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+ | Field | Type | Null | Key | Default | Extra |<a class=\"read-more \" href=\"https:\/\/mohamede.com\/?p=1101\" title=\"Read More\"> <span class=\"button default\">Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-1101","post","type-post","status-publish","format-standard","hentry","category-openstack"],"_links":{"self":[{"href":"https:\/\/mohamede.com\/index.php?rest_route=\/wp\/v2\/posts\/1101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mohamede.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohamede.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohamede.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohamede.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1101"}],"version-history":[{"count":0,"href":"https:\/\/mohamede.com\/index.php?rest_route=\/wp\/v2\/posts\/1101\/revisions"}],"wp:attachment":[{"href":"https:\/\/mohamede.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohamede.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohamede.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}