Flavor extra_specs extension mixed the flavor_id and instance_type_id

Bug #1031263 reported by jiang, yunhong
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
jiang, yunhong

Bug Description

The nova database API use instance_type id as parameter to access flavor extra spec ( like instance_type_extra_specs_update_or_create in nova/db/api.py).

However, the nova API extension for flavor extra specs (nova/api/openstack/compute/contrib/flavorextraspecs.py) call the DB API using the flavor_id as instance type id, for example, creaet() call instance_type_extra_specs_update_or_create() with flavor_id.

Because the flavor_id and instance_type is different in most time, this is sure to cause trouble. I meet this when I try to add the flavor extra spec support to the python-novaclient.

We think there are three methods to handle it:
1) Translation from flavor_id to instance_type id in the Nova API extension. Thus keep no changes for DB API.
2) Add new APIs to nova DB (i.e. nova/db/api.py), to get/delete/update the extra spec through flavor_id, i.e. two set of APIs to operate the flavor extra specs.
3) Change current DB APIs to use flavor_id, instead of instance_type id. After all, instance_type id is mostly a DB internal id, but I'm not sure because nova/db/api.py, does expose the instance_type id through instance_type_get().

I created a patch with method 1, but not sure if that's the right solution, hope more input from community.

Thanks
--jyh

Changed in nova:
assignee: nobody → jiang, yunhong (yunhong-jiang)
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/10595

Changed in nova:
status: New → In Progress
Revision history for this message
jiang, yunhong (yunhong-jiang) wrote :

The patch with method 1 is uploaded for review. But not sure if it's the right solution.

Mark McLoughlin (markmc)
Changed in nova:
importance: Undecided → Medium
security vulnerability: no → yes
security vulnerability: yes → no
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/10595
Committed: http://github.com/openstack/nova/commit/9575a426fa4adcd79f1fa0c3a1d1008d8010c44c
Submitter: Jenkins
Branch: master

commit 9575a426fa4adcd79f1fa0c3a1d1008d8010c44c
Author: Yunhong, Jiang <email address hidden>
Date: Tue Jul 31 18:15:59 2012 +0800

    Flavor extra specs extension use instance_type id

    bug 1031263

    The nova database API use instance_type id as parameter to access flavor
    extra spec. However, the flavor extra_specs API extension use flavor_id as
    parameter wrongly.

    As the instance_type ID is a purely nova internal ID, the database should
    not expose it and instead use flavor_id as the parameter

    Change-Id: I5f509cb7c4457d8c399df32f559a874d498be762
    Signed-off-by: Yunhong, Jiang <email address hidden>

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → folsom-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: folsom-3 → 2012.2
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.