flavor pagination incorrectly uses id rather than flavorid

Bug #1226698 reported by Bhuvan Arumugam
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Mauro S M Rodrigues
Havana
Fix Released
High
Gary Kotton

Bug Description

The "ID" in flavor-list response is really instance_types.flavorid in database. When using the marker, it use instance_types.id field. The test pass as long as instance_types.id begin with 1 and it is sequential. If it does not begin with 1 or if it does not match instance_types.flavorid, the test fail with following error:

'''
Traceback (most recent call last):
  File "/Volumes/apple/openstack/tempest/tempest/api/compute/flavors/test_flavors.py", line 91, in test_list_flavors_detailed_using_marker
    resp, flavors = self.client.list_flavors_with_detail(params)
  File "/Volumes/apple/openstack/tempest/tempest/services/compute/json/flavors_client.py", line 45, in list_flavors_with_detail
    resp, body = self.get(url)
  File "/Volumes/apple/openstack/tempest/tempest/common/rest_client.py", line 263, in get
    return self.request('GET', url, headers)
  File "/Volumes/apple/openstack/tempest/tempest/common/rest_client.py", line 394, in request
    resp, resp_body)
  File "/Volumes/apple/openstack/tempest/tempest/common/rest_client.py", line 439, in _error_checker
    raise exceptions.NotFound(resp_body)
NotFound: Object not found
Details: {"itemNotFound": {"message": "The resource could not be found.", "code": 404}}

======================================================================
FAIL: tempest.api.compute.flavors.test_flavors.FlavorsTestJSON.test_list_flavors_using_marker[gate]
'''

Really, it should use flavorid for marker. The flavor_get_all() method in nova.db.sqlalchemy.api should be fixed to use flavorid=marker in filter, as follows:
- filter_by(id=marker).\
+ filter_by(flavorid=marker).\

Tags: flavor-list
Revision history for this message
Bhuvan Arumugam (bhuvan) wrote :

The following tests should be fixed as well, to use flavorid with marker:
  - nova/tests/test_flavors.py test_get_all_flavors_sorted_list_marker()
  - nova/tests/db/test_db_api.py test_flavor_get_all_list_marker()

Changed in nova:
assignee: nobody → Mauro Sergio Martins Rodrigues (maurosr)
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/48963

Changed in nova:
status: New → In Progress
Revision history for this message
Mark McLoughlin (markmc) wrote :

Changed the title as I don't think this is just an issue with unit tests

Changed in nova:
importance: Undecided → High
summary: - test_list_flavors_using_marker fail as it refer to id in database
+ flavor pagination incorrectly uses id rather than flavorid
tags: added: havana-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/48963
Committed: http://github.com/openstack/nova/commit/c2c0958ad768581cd0e92f88207430227cb6539a
Submitter: Jenkins
Branch: master

commit c2c0958ad768581cd0e92f88207430227cb6539a
Author: Mauro S. M. Rodrigues <email address hidden>
Date: Mon Sep 30 10:24:59 2013 -0400

    Fixes inconsistency in flavors list with marker

    Flavors list with marker is supposed to use flavorid as the marker since this is
    the only id attribute the users can see, but it was using id (the confusion was
    probably caused by the fact that flavorid attribute shows up to the user as id).

    The change on db unit test shows makes the bug evident, and justify the changes
    on the filter_by criteria.

    Fixes bug 1226698

    Change-Id: I3ffa636febb63be796fffc94be6486bf74e8239b

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
tags: added: havana-backport-potential
removed: havana-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/havana)

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/53596

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/havana)

Reviewed: https://review.openstack.org/53596
Committed: http://github.com/openstack/nova/commit/0651860e1c6f2fd87b0dd65ffde05a1cb776cd4f
Submitter: Jenkins
Branch: stable/havana

commit 0651860e1c6f2fd87b0dd65ffde05a1cb776cd4f
Author: Mauro S. M. Rodrigues <email address hidden>
Date: Mon Sep 30 10:24:59 2013 -0400

    Fixes inconsistency in flavors list with marker

    Flavors list with marker is supposed to use flavorid as the marker since this is
    the only id attribute the users can see, but it was using id (the confusion was
    probably caused by the fact that flavorid attribute shows up to the user as id).

    The change on db unit test shows makes the bug evident, and justify the changes
    on the filter_by criteria.

    Fixes bug 1226698

    Change-Id: I3ffa636febb63be796fffc94be6486bf74e8239b
    (cherry picked from commit c2c0958ad768581cd0e92f88207430227cb6539a)

tags: added: in-stable-havana
Changed in nova:
milestone: none → icehouse-1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Alan Pevec (apevec)
tags: removed: havana-backport-potential in-stable-havana nova
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-1 → 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.