The quota_usage_refresh counts wrong when there exists soft-deleted instances
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Invalid
|
Undecided
|
huanhongda | ||
Ocata |
Fix Committed
|
Medium
|
huanhongda | ||
Pike |
Fix Committed
|
Medium
|
huanhongda | ||
Queens |
Fix Committed
|
Medium
|
huanhongda |
Bug Description
Description
===========
When there exists soft-deleted instances in my openstack, executing "nova-manage project quota_usage_
Steps to reproduce
==================
1) Set reclaim_
2) Boot a new instance, then check quota_usages tables. Assume instances' in_use is 1, ram's in_use is 512, cores' in_use is 4.
3) Delete that instance, and it's status will migrate to SOFT_DELETED.
4) Check quota_usages tables. Both instances, ram and cores in_use is 0.
5) Execute "nova-manage project quota_usage_refresh --project <project-id> --user <user-id>".
6) Check quota_usages tables. The instances' in_use is 1, ram's in_use is 512, cores' in_use is 4.
Expected result
===============
After the execution of quota_usage_
Actual result
=============
The instances' in_use is 1, ram's in_use is 512, cores' in_use is 4. That's because quota_usage_refresh will count all instances whose "deleted" field is 0 in "instances" table. And soft-deleted instance's "deleted" field is 0, so it will be counted as in used.
Environment
===========
This bug was found in Ocata.
Pike, Queens and master don't have this bug.
The quota_usage_refresh command has been removed in 17.0.0 (Queens). Since quota usage is counted from resources instead of being tracked separately.
https:/
And they have filtered out soft-deleted instances while counting from resources:
https:/
Fix proposed to branch: stable/ocata /review. openstack. org/570653
Review: https:/