quota-usage error in soft-delete
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Sergey Nikitin |
Bug Description
condition: reclaim_
I am testing soft-delete , found that quota_usages table will lead to error
result. when an instance was soft-deleted , before it was deleted completely by period task i soft-delete it again, the quato_usages table will reduce double resource of this instance.
the reason is that every execution of soft-delete instance, the reservation will commit.
how to fixed it: we should make reservations=None when instance.
how to reproduct it:
i am project_
ubuntu@
+------
| ID | Name | Status | Task State | Power State | Networks |
+------
| 6f6c1258-
+------
1.first select from quota_usage, the result is :
mysql> select * from quota_usages;
+------
| created_at | updated_at | deleted_at | id | project_id | resource | in_use | reserved | until_refresh | deleted | user_id |
+------
| 2014-06-20 08:24:35 | 2014-06-23 08:35:03 | NULL | 1 | 30528b0d602c4a9
| 2014-06-20 08:24:35 | 2014-06-23 08:35:03 | NULL | 2 | 30528b0d602c4a9
| 2014-06-20 08:24:35 | 2014-06-23 08:35:03 | NULL | 3 | 30528b0d602c4a9
| 2014-06-20 08:24:35 | 2014-06-20 08:24:35 | NULL | 4 | 30528b0d602c4a9
| 2014-06-20 08:24:36 | 2014-06-23 03:56:03 | NULL | 5 | 30528b0d602c4a9
+------
5 rows in set (0.00 sec)
2.using nova-network, set reclaim_
3.nova delete 6f6c1258-
4. select from quota_usages, result is :
mysql> select * from quota_usages;
+------
| created_at | updated_at | deleted_at | id | project_id | resource | in_use | reserved | until_refresh | deleted | user_id |
+------
| 2014-06-20 08:24:35 | 2014-06-23 08:42:30 | NULL | 1 | 30528b0d602c4a9
| 2014-06-20 08:24:35 | 2014-06-23 08:42:30 | NULL | 2 | 30528b0d602c4a9
| 2014-06-20 08:24:35 | 2014-06-23 08:42:30 | NULL | 3 | 30528b0d602c4a9
| 2014-06-20 08:24:35 | 2014-06-20 08:24:35 | NULL | 4 | 30528b0d602c4a9
| 2014-06-20 08:24:36 | 2014-06-23 03:56:03 | NULL | 5 | 30528b0d602c4a9
+------
5 rows in set (0.00 sec)
5. nova delete 6f6c1258-
then select from quota_usages, result is :
mysql> select * from quota_usages;
+------
| created_at | updated_at | deleted_at | id | project_id | resource | in_use | reserved | until_refresh | deleted | user_id |
+------
| 2014-06-20 08:24:35 | 2014-06-23 08:43:38 | NULL | 1 | 30528b0d602c4a9
| 2014-06-20 08:24:35 | 2014-06-23 08:43:38 | NULL | 2 | 30528b0d602c4a9
| 2014-06-20 08:24:35 | 2014-06-23 08:43:38 | NULL | 3 | 30528b0d602c4a9
| 2014-06-20 08:24:35 | 2014-06-20 08:24:35 | NULL | 4 | 30528b0d602c4a9
| 2014-06-20 08:24:36 | 2014-06-23 03:56:03 | NULL | 5 | 30528b0d602c4a9
+------
5 rows in set (0.00 sec)
oh my god!!! instance in_use is -1 and ram in_use is -64Mb, do you think this is right?
6.nova restore 6f6c1258-
now the db result is:
mysql> select * from quota_usages;
+------
| created_at | updated_at | deleted_at | id | project_id | resource | in_use | reserved | until_refresh | deleted | user_id |
+------
| 2014-06-20 08:24:35 | 2014-06-23 08:44:41 | NULL | 1 | 30528b0d602c4a9
| 2014-06-20 08:24:35 | 2014-06-23 08:44:41 | NULL | 2 | 30528b0d602c4a9
| 2014-06-20 08:24:35 | 2014-06-23 08:44:41 | NULL | 3 | 30528b0d602c4a9
| 2014-06-20 08:24:35 | 2014-06-20 08:24:35 | NULL | 4 | 30528b0d602c4a9
| 2014-06-20 08:24:36 | 2014-06-23 03:56:03 | NULL | 5 | 30528b0d602c4a9
+------
5 rows in set (0.00 sec)
obviously, the result in db is error.now I have only one instance, but in db, i have used 2 instances, 2 cores , 128Mb ram and so on.
The correct way is that we should not allow deleting instance which status in soft-delete.
description: | updated |
Changed in nova: | |
assignee: | nobody → hzxiongwenwu (xwwzzy) |
description: | updated |
Changed in nova: | |
assignee: | nobody → Sergey Nikitin (snikitin) |
Changed in nova: | |
status: | Confirmed → In Progress |
Changed in nova: | |
status: | In Progress → Confirmed |
Changed in nova: | |
milestone: | none → kilo-1 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | kilo-1 → 2015.1.0 |
Fix proposed to branch: master /review. openstack. org/102153
Review: https:/