Pagination links are incorrect

Bug #2058424 reported by Goutham Pacha Ravi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Shared File Systems Service (Manila)
Triaged
Low
christian okeke

Bug Description

Manila API supports pagination of nearly all GET requests against a wide range of resources (shares, share-replicas, share-backups, snapshots, etc). the accepted pagination parameters are:

- limit
- offset

However, the pagination links generated in the APIs uses "marker". For example:

```
curl -i -X GET "http://10.0.108.99/share/v2/share-replicas/detail?limit=2" -H "X-Auth-Token: $TOKEN" -H "X-Openstack-Manila-Api-Version: 2.82" -H "User-Agent: python-manilaclient" -H "Accept: application/json"
HTTP/1.1 200 OK
Date: Tue, 19 Mar 2024 22:47:47 GMT
Server: Apache/2.4.52 (Ubuntu)
Content-Type: application/json
Content-Length: 927
x-compute-request-id: req-2ca1933a-1891-4176-a897-81574363cbcf
X-OpenStack-Manila-API-Version: 2.82
Vary: X-OpenStack-Manila-API-Version
Connection: close

{"share_replicas": [{"id": "8779df54-9be9-4df5-9142-e92d653fe518", "share_id": "d68355db-d9e5-4c86-9a6d-aa7aa1da2241", "availability_zone": null, "created_at": "2024-03-19T22:37:52.334980", "status": "error", "share_network_id": null, "replica_state": "error", "updated_at": "2024-03-19T22:37:52.433974", "share_server_id": null, "host": "", "cast_rules_to_readonly": true}, {"id": "cead06ac-ab4e-4164-883e-4e846c5e4bdc", "share_id": "d68355db-d9e5-4c86-9a6d-aa7aa1da2241", "availability_zone": "nova", "created_at": "2024-03-19T22:37:35.676989", "status": "available", "share_network_id": null, "replica_state": "active", "updated_at": "2024-03-19T22:37:39.978913", "share_server_id": null, "host": "zorilla-cephadm@gamma#fake_pool_for_GAMMA", "cast_rules_to_readonly": false}], "share_replica_links": [{"rel": "next", "href": "http://10.0.108.99/share/v2/share-replicas?limit=2&marker=cead06ac-ab4e-4164-883e-4e846c5e4bdc"}]}
```

The link http://10.0.108.99/share/v2/share-replicas?limit=2&marker=cead06ac-ab4e-4164-883e-4e846c5e4bdc doesn't really work; because the "marker" is ignored by the API, and only limit is enforced.

Using the next link as is:
```
curl -i -X GET "http://10.0.108.99/share/v2/share-replicas/detail?limit=2&marker=cead06ac-ab4e-4164-883e-4e846c5e4bdc" -H "X-Auth-Token: $AUTH_TOKEN" -H "X-Openstack-Manila-Api-Version: 2.82" -H "User-Agent: python-manilaclient" -H "Accept: application/json"
HTTP/1.1 200 OK
Date: Tue, 19 Mar 2024 22:57:06 GMT
Server: Apache/2.4.52 (Ubuntu)
Content-Type: application/json
Content-Length: 927
x-compute-request-id: req-cddbaca5-4311-4296-9677-26126cc37747
X-OpenStack-Manila-API-Version: 2.82
Vary: X-OpenStack-Manila-API-Version
Connection: close

{"share_replicas": [{"id": "8779df54-9be9-4df5-9142-e92d653fe518", "share_id": "d68355db-d9e5-4c86-9a6d-aa7aa1da2241", "availability_zone": null, "created_at": "2024-03-19T22:37:52.334980", "status": "error", "share_network_id": null, "replica_state": "error", "updated_at": "2024-03-19T22:37:52.433974", "share_server_id": null, "host": "", "cast_rules_to_readonly": true}, {"id": "cead06ac-ab4e-4164-883e-4e846c5e4bdc", "share_id": "d68355db-d9e5-4c86-9a6d-aa7aa1da2241", "availability_zone": "nova", "created_at": "2024-03-19T22:37:35.676989", "status": "available", "share_network_id": null, "replica_state": "active", "updated_at": "2024-03-19T22:37:39.978913", "share_server_id": null, "host": "zorilla-cephadm@gamma#fake_pool_for_GAMMA", "cast_rules_to_readonly": false}], "share_replica_links": [{"rel": "next", "href": "http://10.0.108.99/share/v2/share-replicas?limit=2&marker=cead06ac-ab4e-4164-883e-4e846c5e4bdc"}]}

```

Using the next link with offset instead:

```
curl -i -X GET "http://10.0.108.99/share/v2/share-replicas/detail?limit=2&offset=2" -H "X-Auth-Token: $AUTH_TOKEN" -H "X-Openstack-Manila-Api-Version: 2.82" -H "User-Agent: python-manilaclient" -H "Accept: application/json"
HTTP/1.1 200 OK
Date: Tue, 19 Mar 2024 22:58:02 GMT
Server: Apache/2.4.52 (Ubuntu)
Content-Type: application/json
Content-Length: 424
x-compute-request-id: req-d88c1652-6888-4f13-b1bf-421d8a5aa3ee
X-OpenStack-Manila-API-Version: 2.82
Vary: X-OpenStack-Manila-API-Version
Connection: close

{"share_replicas": [{"id": "d45b6f63-9739-4b26-ad6e-8f2a16f40cf3", "share_id": "d68355db-d9e5-4c86-9a6d-aa7aa1da2241", "availability_zone": "nova", "created_at": "2024-03-19T22:37:49.713667", "status": "available", "share_network_id": null, "replica_state": "in_sync", "updated_at": "2024-03-19T22:37:54.237697", "share_server_id": null, "host": "zorilla-cephadm@delta#fake_pool_for_DELTA", "cast_rules_to_readonly": true}]}
```

Both "offset" and "marker" are useful.. Perhaps we should stick providing "marker" by default, but still continue to support "offset" as an acceptable API pagination parameter...

Revision history for this message
Carlos Eduardo (silvacarlose) wrote :
Changed in manila:
status: New → Triaged
importance: Undecided → Low
assignee: nobody → christian okeke (ccokeke)
Revision history for this message
Vida Haririan (vhariria) wrote :
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.