Removing project access to volume type will not work after 128+ access rule
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cinder |
Fix Released
|
Medium
|
Michal Dulko |
Bug Description
I was having fun with Cinder, when I have spotted a bug in a mechanism that is being used to grant access for projects (aka 'tenants') to volume types. To be more specific: the problem is related to removing project access.
How to reproduce the bug:
1. In a loop, about 150 times:
a) create non-public volume type ( is_public=False )
b) grant access for project to newly created type
2. Try to remove project access to one of recently created type
3. You can expect from python-cinderclient an error 500 (~ Server is incapable of performing operation)
4. On Cinder's log there is an error: "Out of range value for column 'deleted' at row 1"
Packages' versions on my host:
cinder-api 1:2015.
cinder-common 1:2015.
cinder-scheduler 1:2015.
cinder-volume 1:2015.
python-cinder 1:2015.
python-cinderclient 1:1.3.1-2
python-oslo-db 1.7.1-0ubuntu2~
Description:
The problem is related to database - column 'deleted' on table 'volume_
Here you can see that it is created as *Boolean* type:
https:/
During conversion process, the result of db-sync in database is type *tinyint(1)*:
mysql> desc volume_
+------
| Field | Type | Null | Key | Default | Extra |
+------
| id | int(11) | NO | PRI | NULL | auto_increment |
| created_at | datetime | YES | | NULL | |
| updated_at | datetime | YES | | NULL | |
| deleted_at | datetime | YES | | NULL | |
| volume_type_id | varchar(36) | YES | MUL | NULL | |
| project_id | varchar(255) | YES | | NULL | |
| deleted | tinyint(1) | YES | | NULL | |
+------
Type *tinyint(1)* is, in fact, a reason why the bug does not occur before 128 access rules.
Now, what in fact causes bug is usage of soft_delete() function during access removing. See it here:
https:/
The mentioned function is definied in *oslo.db* as:
https:/
So, what happens when project access is removed? To the column 'deleted' in table 'volume_
Possible solutions:
a) replace soft_delete() function with just update() - like it is done in rest of the code, see example here:
https:/
b) upgrade the db schema
Changed in cinder: | |
assignee: | nobody → Michal Dulko (michal-dulko-f) |
status: | Confirmed → In Progress |
Changed in cinder: | |
importance: | Undecided → Medium |
Changed in cinder: | |
milestone: | none → liberty-rc1 |
status: | Fix Committed → Fix Released |
Changed in cinder: | |
milestone: | liberty-rc1 → 7.0.0 |
I think we should probably stick with the use of oslo.db's soft delete and update the schema to allow this. Interesting that they set that to the id though. Not sure the reason for that.
It might be good to get other's opinion on this as well.
And it might be good to review all our table schema's and see if there are other instances where this could be an issue. Luckily I doubt there's anyone who currently uses anywhere near 128 volume types.