Listing volumes respects osapi_max_limit but does not provide a link to the next element

Bug #1504641 reported by Artom Lifshitz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Wishlist
Unassigned
tempest
Undecided
Unassigned

Bug Description

When GETting os-volumes, the returned list of volumes respects the osapi_max_limit configuration parameter but does not provide a link to the next element in the list. For example, with two volumes configured and osapi_max_limit set to 1, GETting volumes results in the following:

{
    "volumes": [
        {
            "attachments": [
                {}
            ],
            "availabilityZone": "nova",
            "createdAt": "2015-10-09T18:12:04.000000",
            "displayDescription": null,
            "displayName": null,
            "id": "08792e26-204b-4bb9-8e9b-0e37331de51c",
            "metadata": {},
            "size": 1,
            "snapshotId": null,
            "status": "error",
            "volumeType": "lvmdriver-1"
        }
    ]
}

Unsetting osapi_max_limit results in both volumes being listed:

{
    "volumes": [
        {
            "attachments": [
                {}
            ],
            "availabilityZone": "nova",
            "createdAt": "2015-10-09T18:12:04.000000",
            "displayDescription": null,
            "displayName": null,
            "id": "08792e26-204b-4bb9-8e9b-0e37331de51c",
            "metadata": {},
            "size": 1,
            "snapshotId": null,
            "status": "error",
            "volumeType": "lvmdriver-1"
        },
        {
            "attachments": [
                {}
            ],
            "availabilityZone": "nova",
            "createdAt": "2015-10-09T18:12:00.000000",
            "displayDescription": null,
            "displayName": null,
            "id": "5cf46cd2-8914-4ffd-9037-abd53c55ca76",
            "metadata": {},
            "size": 1,
            "snapshotId": null,
            "status": "error",
            "volumeType": "lvmdriver-1"
        }
    ]
}

Tags: api Edit Tag help
tags: added: api
Changed in nova:
status: New → Confirmed
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

IIUC all the items of the list (=N) can *only* be fetched if:

    "osapi_max_limit" >= N

and if N > "osapi_max_limit" then N - "osapi_max_limit" items get truncated. The code [1] has this section:

    def _get_collection_links(self,
                              request,
                              items,
                              collection_name,
                              id_key="uuid"):
        """Retrieve 'next' link, if applicable. This is included if:
        1) 'limit' param is specified and equals the number of items.
        2) 'limit' param is specified but it exceeds CONF.osapi_max_limit,
        in this case the number of items is CONF.osapi_max_limit.
        3) 'limit' param is NOT specified but the number of items is
        CONF.osapi_max_limit.
        """
        links = []
        max_items = min(
            int(request.params.get("limit", CONF.osapi_max_limit)),
            CONF.osapi_max_limit)
        if max_items and max_items == len(items):

The "==" confuses me, I would expect "<" here.

References:
[1] https://github.com/openstack/nova/blob/c857d791a2f127e63c20ae8380498ff67e76051b/nova/api/openstack/common.py#L471

Changed in nova:
assignee: nobody → Chung Chih, Hung (lyanchih)
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/237999

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Chung Chih, Hung (lyanchih) wrote :

Tempest will validate volume list response body.
It didn't accept unexpected attribute volumes_links.
We need to add volumes_links attribute in tempest first.

Changed in tempest:
assignee: nobody → Chung Chih, Hung (lyanchih)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

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

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

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tempest (master)

Change abandoned by lyanchih (<email address hidden>) on branch: master
Review: https://review.openstack.org/245627
Reason: Volume response had been move to tempest-lib repository

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to tempest-lib (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/261896

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/261897

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/261898

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/261899

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to nova-specs (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/264114

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova-specs (master)

Change abandoned by Michael Still (<email address hidden>) on branch: master
Review: https://review.openstack.org/264114
Reason: As mentioned, I am abandoning this spec to clear out the review queue ready for Newton. That said, feel free to restore this change with an updated version when you're ready to proceed.

Changed in nova:
assignee: Chung Chih, Hung (lyanchih) → nobody
status: In Progress → Confirmed
Changed in nova:
importance: Undecided → Wishlist
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Michael Still (<email address hidden>) on branch: master
Review: https://review.openstack.org/237999
Reason: This code hasn't been updated in a long time, and is in merge conflict. I am going to abandon this review, but feel free to restore it if you're still working on this.

Revision history for this message
Maciej Szankin (mszankin) wrote :

This bug report has an assignee for a while now but there is no patch
for that. It looks like that the chance of getting a patch is low.
I'm going to remove the assignee to signal to others that they can take
over if they like.
If you want to work on this, please:
* add yourself as assignee AND
* set the status to "In Progress" AND
* provide a (WIP) patch within the next 2 weeks after that.
If you need assistance, reach out on the IRC channel #openstack-nova or
use the mailing list.

Also tagging as New. It is old and requires to be verified.

Changed in tempest:
status: In Progress → New
assignee: Chung Chih, Hung (lyanchih) → nobody
Changed in nova:
status: Confirmed → New
Revision history for this message
Ghanshyam Mann (ghanshyammann) wrote :

This seems like change in API and with version bump. Now nova proxy APIs are deprecated and so volume APIs [1]. IMO, there is no much benefit of enhancing the proxy APIs, it is recommended to use volume APIs instead.

.. 1 https://developer.openstack.org/api-ref/compute/#volume-extension-os-volumes-os-snapshots-deprecated

Tempest is verifying what current API return.

I am marking invalid for both nova and tempest as per APIs are deprecated now.

Changed in tempest:
status: New → Won't Fix
Changed in nova:
status: New → Won't Fix
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tempest-lib (master)

Change abandoned by Ghanshyam Mann (<email address hidden>) on branch: master
Review: https://review.openstack.org/261899
Reason: Abandoning the change, feel free to propose the change on tempest repo if needed. Thanks.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Ghanshyam Mann (<email address hidden>) on branch: master
Review: https://review.openstack.org/261898
Reason: Abandoning the change, feel free to propose the change on tempest repo if needed. Thanks.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Ghanshyam Mann (<email address hidden>) on branch: master
Review: https://review.openstack.org/261897
Reason: Abandoning the change, feel free to propose the change on tempest repo if needed. Thanks.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Ghanshyam Mann (<email address hidden>) on branch: master
Review: https://review.openstack.org/261896
Reason: Abandoning the change, feel free to propose the change on tempest repo if needed. Thanks.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers