Comment 0 for bug 1773542

Revision history for this message
huanhongda (hongda) wrote :

Description
===========
When there exists soft-deleted instances in my openstack,

Steps to reproduce
==================
1) Set reclaim_instance_interval>0 to enable soft-delete;
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_refresh, both instances, ram and cores in_use should be 0.

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 counted as in used.

Environment
===========
This bug was found in Ocata. But Pike, Queens and master don't have this bug. As they have filtered out soft-deleted instances in quota usage counting.