Flavor ExtraSpecs containing '/' cannot be deleted.

Bug #1256119 reported by Leandro Ignacio Costantino
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Leandro Ignacio Costantino
OpenStack Dashboard (Horizon)
Fix Released
Undecided
Leandro Ignacio Costantino
python-novaclient
Fix Released
Low
Sergio Cazzolato

Bug Description

When adding extraspec to a flavor, both from Horizon or nova CLI , if the key contains '/' or any other character not being encoded, then those keys cannot be removed using nova CLI / Horizon.

Example NOVA CLI Request on Delete

2013-11-28 16:14:59.301 DEBUG routes.middleware [-] No route matched for DELETE /64801605b4b6408da8fa1dde686cf02f/flavors/2/os-extra_specs/<key>1</key> from (pid=7915) __call__ /usr/lib/python2.7/dist-packages/routes/middleware.py:97
2013-11-28 16:14:59.302 INFO nova.osapi_compute.wsgi.server [req-79ec0b8b-8f8f-48df-8f87-798489e29b03 admin admin] 10.0.2.15 "DELETE /v2/64801605b4b6408da8fa1dde686cf02f/flavors/2/os-extra_specs/%3Ckey%3E1%3C/key%3E HTTP/1.1" status: 404 len: 176 time: 0.0031309

How to reproduce: http://paste.openstack.org/show/54141/

On Horizon when listing the extraSpecs an error will be thrown on reverse_url if key contains '/'.

Maybe we should setup a Regexp for the key names like heat?
Or restrict the name to [a-zA-Z0-9] and some characters?

Tags: api
Changed in horizon:
assignee: nobody → Leandro Ignacio Costantino (leandro-i-costantino)
Changed in horizon:
status: New → Confirmed
tags: added: api
Changed in python-novaclient:
importance: Undecided → Low
status: New → Triaged
Changed in nova:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Matt Riedemann (mriedem) wrote :

Nova enforces certain flavor id/name here:

https://github.com/openstack/nova/blob/master/nova/compute/flavors.py#L57

I'm assuming the same could be done for extra specs.

Revision history for this message
Leandro Ignacio Costantino (leandro-i-costantino) wrote :

Thanks Matt.

Proposed change will include only the regex format limit.
There are several ways to approach this issue, and it's seems that doing that may be the only way without touching the API at all.

Another alternatives, that include changes on the API but allow any kind of character may be:
     [1] Keep using key name as ID, but change delete/update/show to receive that keyname on the body ( instead of the url. kinda anti-REST )
    [2] Use the real ID of the keys. This may be a better approach to be REST 'compliant', but, need changes also on how those keys are displayed, and the user will need to remember that ID to remove/update them.

Changed in nova:
assignee: nobody → Leandro Ignacio Costantino (leandro-i-costantino)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

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

Changed in horizon:
status: Confirmed → In Progress
Changed in python-novaclient:
assignee: nobody → Sergio Cazzolato (sergio-j-cazzolato)
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/68695

Changed in python-novaclient:
status: Triaged → In Progress
Changed in nova:
status: In Progress → Fix Committed
Changed in python-novaclient:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/68200
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=c52286ac3a9583319360aeda75776363ca625998
Submitter: Jenkins
Branch: master

commit c52286ac3a9583319360aeda75776363ca625998
Author: Leandro I. Costantino <email address hidden>
Date: Tue Jan 21 12:35:13 2014 -0500

    Enforce FlavorExtraSpecs Key format

    When creating a key name with characters like '/' that are not
    being encoded or cannot be handled as expected by routes when
    matching the url, then it's not possible to remove them anymore.
    The new format apply the restriction: r"^[\w\.\-: ]+$"

    Change-Id: Ie6f982a0e44212bf0d58da66b89aff7740d06e8f
    Closes-Bug: #1256119

Changed in horizon:
status: In Progress → Fix Committed
Revision history for this message
melanie witt (melwitt) wrote :

novaclient 2.16.0 released on 2/26/2014

Changed in python-novaclient:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: none → icehouse-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-3 → 2014.1
Thierry Carrez (ttx)
Changed in horizon:
milestone: icehouse-3 → 2014.1
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.