nova flavor-show inconsistent with mixed case in names

Bug #1423885 reported by Miroslav Los
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
Low
Abhishek Talwar

Bug Description

The nova flavor-show command accepts a flavor name as its parameter. The search via names works with an exact match and all-lowercase, but not with any other character casing. E.g. given an existing flavor named 'ASAv', 'nova flavor-show ASAv' will get the same result as 'nova flavor-show asav', but 'nova flavor-show Asav' will return failure.

Also note that 'nova flavor-create Asav ...' will reject flavor creation because the flavor exists already.

# nova flavor-show asav
+----------------------------+--------------------------------------+
| Property | Value |
+----------------------------+--------------------------------------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 0 |
| extra_specs | {} |
| id | a9215596-5f05-43ff-b150-7344a3112304 |
| name | ASAv |
| os-flavor-access:is_public | True |
| ram | 2048 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 1 |
+----------------------------+--------------------------------------+

# nova flavor-show ASAv
+----------------------------+--------------------------------------+
| Property | Value |
+----------------------------+--------------------------------------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 0 |
| extra_specs | {} |
| id | a9215596-5f05-43ff-b150-7344a3112304 |
| name | ASAv |
| os-flavor-access:is_public | True |
| ram | 2048 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 1 |
+----------------------------+--------------------------------------+

# nova flavor-show Asav
ERROR: No flavor with a name or ID of 'Asav' exists.

# nova flavor-create Asav 100000 1024 10 1
ERROR: Flavor with name Asav already exists. (HTTP 409) (Request-ID: req-c90d775c-6846-47e5-a32e-9badf568fbd1)

affects: nova → python-novaclient
Changed in python-novaclient:
assignee: nobody → tcs_openstack_group (tcs-openstack-group)
assignee: tcs_openstack_group (tcs-openstack-group) → Abhishek Talwar (abhishek-talwar)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/158270

Revision history for this message
Abhishek Talwar (abhishek-talwar) wrote :

Hi,

As "nova flavor show" is inconsistent so one solution for this bug can be making the command case insensitive. As we cannot create another flavor with the same name( even with any different case pattern) so there is no benefits keeping "nova flavor show" case sensitive.
This change will help the user to show existing flavors with any case pattern.

Thanks and Regards
Abhishek Talwar

Revision history for this message
melanie witt (melwitt) wrote :

I investigated into this bug and learned some things about the inconsistency, and will document it here.

1) For 'nova flavor-show' an api call is made that looks something like this:

GET http://10.0.2.15:8774/v2/cd63ec3d95c14647932aca9248760115/flavors/BLah3

This will find the resource if it's all lowercase 'blah3' or exact case 'BLah3', but will 404 in any other case.

2) For 'nova flavor-create' it fails saying the flavor already exists if only the letter case is different.

This is because by default MySQL is case insensitive and flavor name has a unique constraint on it.

Point being, this is all behavior on the nova side, not the client side. I don't think we can do anything about 2) unless we wanted our database to be case sensitive for some reason. For 1), I'm going to dig a little more to find out why our web server (nova) accepts both all lowercase and exact case only, to find out if it's our nova wsgi code or something else.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.openstack.org/158270
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=4e79285b45ec1490c8e923f724cbaf4d42fe81c4
Submitter: Jenkins
Branch: master

commit 4e79285b45ec1490c8e923f724cbaf4d42fe81c4
Author: Abhishek Talwar <email address hidden>
Date: Mon Feb 23 17:26:53 2015 +0530

    nova flavor-show command is inconsistent

    The nova flavor-show command accepts a flavor
    name as its parameter. The command show inconsistency
    as it works with the exact flavor name and flavor name
    in all lowercase but fails for any other case pattern.

    So, updated the code so that if we run the command
    with flavor-name case patern it runs fine.

    Closes-Bug: #1423885
    Change-Id: I713bf2b5aca977df40dc745e29d4fe98a950c991

Changed in python-novaclient:
status: In Progress → Fix Committed
melanie witt (melwitt)
Changed in python-novaclient:
importance: Undecided → Low
Revision history for this message
melanie witt (melwitt) wrote :

To close the loop on what I said earlier, I couldn't find where the case sensitivity comes from (be it in paste.urlmap, eventlet wsgi server, or where), so for now the best we can do is lowercase the request in the client, which is the patch that was just committed.

Michael Still (mikal)
Changed in python-novaclient:
milestone: none → 2.23.0
status: Fix Committed → Fix Released
Revision history for this message
Mathieu Gagné (mgagne) wrote :

This fix broke it for people with flavorid with upper case like "SuperCase1".

To reproduce:
- nova --debug flavor-create SuperCase1 SuperCase1 512 10 1
- nova --debug flavor-show SuperCase1

This also breaks nova boot which won't be able to find the flavor by id.

Please also consider installations with existing flavor ids which can't be changed for obvious reasons.

Revision history for this message
melanie witt (melwitt) wrote :

I'm looking into this and so far I find it's something to do with the server side db items caching not being able to find the flavorid case-insensitively. The db queries themselves should be case-insensitive though, so I'm digging more to see if there's a nova solution here. Otherwise we might have to revert this.

Revision history for this message
melanie witt (melwitt) wrote :

I have opened https://bugs.launchpad.net/python-novaclient/+bug/1446850 for this regression and we'll either revert the patch or otherwise make novaclient work with existing nova.

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.