nova flavor consider Lower case when create and but not in update

Bug #1435265 reported by Eli Qiao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.db
Confirmed
Low
Unassigned

Bug Description

taget@taget-ThinkStation-P300:~/devstack$ nova flavor-create Test1 100 ^C11 1 1

when create/delete a flavor, nova considers the name as lower case letter.
but it doesn't for update

for example:

1. I have a flavor named TEST1

taget@taget-ThinkStation-P300:~/devstack$ nova flavor-list
+--------------------------------------+-------------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+--------------------------------------+-------------------+-----------+------+-----------+------+-------+-------------+-----------+
| 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True |
| 101 | TEST1 | 511 | 1 | 0 | | 1 | 1.0 | True |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True |
| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True |
| 31eb8c58-2b0a-4892-80d6-ee36d4e64871 | test | 512 | 3 | 0 | | 2 | 1.0 | True |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True |
| 42 | m1.nano | 64 | 0 | 0 | | 1 | 1.0 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True |
| 78cd18c8-aa73-4cfc-8b01-9fbdad87b61b | controller-flavor | 4096 | 20 | 5 | 1 | 4 | 1.0 | True |
| 84 | m1.micro | 128 | 0 | 0 | | 1 | 1.0 | True |
+--------------------------------------+-------------------+-----------+------+-----------+------+-------+-------------+-----------+

2. I can not create a flavor named Test1, nova consider they are same.
taget@taget-ThinkStation-P300:~/devstack$ nova flavor-create Test1 100 511 1 1
ERROR (Conflict): Flavor with name Test1 already exists. (HTTP 409) (Request-ID: req-9d3a652b-84c8-4580-96f2-c684a95be5f9)

3. but When I try to update it by Test1, failed, nova considers it not exists.

taget@taget-ThinkStation-P300:~/devstack$ nova flavor-key Test1 set ram 510
ERROR (CommandError): No flavor with a name or ID of 'Test1' exists.

Tags: nova
Eli Qiao (taget-9)
Changed in nova:
assignee: nobody → Eli Qiao (taget-9)
status: New → Confirmed
tags: added: nova
Changed in nova:
importance: Undecided → Low
Revision history for this message
Eli Qiao (taget-9) wrote :

this should be related to mysql.
after some investigate.
the model of InstanceTypes has this constraint, but it's not case-sensitive, so it consider test1-0 and TEST1-0 same thing.

        schema.UniqueConstraint("name", "deleted",
                                name="uniq_instance_types0name0deleted")

affects: nova → oslo.db
Changed in oslo.db:
assignee: Eli Qiao (taget-9) → nobody
Changed in oslo.db:
assignee: nobody → jelly (coding1314)
Revision history for this message
Kuo-tung Kao (jelly) (coding1314) wrote :

I tested the bug in sqlite3, postgresql and mysql. And I found the bug happened in mysql. the collation of string column is “utf8_general_ci” in mysql. the “_ci” means case insensitive. So “Test” equals “test”. If you want the string column which supports case sensitivity, it seems that the only answer is utf8_bin. But if you use utf8_bin, it will make another bug when you use “order by”. You can write the code like “order_by(asc(collate(name,’utf8_general_ci’)))”. But the way is ugly. ref: http://stackoverflow.com/questions/4558707/case-sensitive-collation-in-mysql https://gist.github.com/ya790206/78044353e09c7a312721

Revision history for this message
Kuo-tung Kao (jelly) (coding1314) wrote :

I think that the bug should be "Won't Fix" because the bug happened when you use mysql. And there are no good ways to fix it.

Changed in oslo.db:
assignee: jelly (coding1314) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.