GET /servers/details is not always returning the correct number of servers

Bug #2110044 reported by Arnaud Morin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
In Progress
Low
Arnaud Morin

Bug Description

Context
=======
Nova 2024.2 (but master seems affected)

For an unknown reason (yet), we had leftovers in our nova_api/build_requests table:

MariaDB [nova_api]> select instance_uuid from build_requests;
+--------------------------------------+
| instance_uuid |
+--------------------------------------+
| 261bce67-29ec-4e09-a172-f9fca1daa60e |
... (maybe some others)
+--------------------------------------+

The thing is that this instance does exists on the infra:
$ openstack server show 261bce67-29ec-4e09-a172-f9fca1daa60e -c Id
+--------+--------------------------------------+
| Field | Value |
+--------+--------------------------------------+
| id | 261bce67-29ec-4e09-a172-f9fca1daa60e |
| status | ACTIVE |
+--------+--------------------------------------+

Issue
=====

Because it's in both build_requests and one of the nova cell, it's then filtered by def _get_unique_filter_method [1] when requesting instances with a limit:

$ curl -H "X-Auth-Token: $T" "http://nova.57.129.93.86.xip.opensteak.fr/v2.1/servers/detail?limit=7" | jq ".servers[].id" | wc -l
6

AND the marker for next page is missing (servers_links).

The servers_links is missing because def _get_collection_links is not adding it if the number of object is lower than the limit [2] [3]

[1] https://github.com/openstack/nova/blob/a5bcaf69b1a80d4d02fe092900471a6e7a28e292/nova/compute/api.py#L3174-L3200
[2] https://github.com/openstack/nova/blob/a5bcaf69b1a80d4d02fe092900471a6e7a28e292/nova/api/openstack/compute/views/servers.py#L581
[3] https://github.com/openstack/nova/blob/a5bcaf69b1a80d4d02fe092900471a6e7a28e292/nova/api/openstack/common.py#L416

Changed in nova:
status: New → In Progress
Changed in nova:
assignee: nobody → Arnaud Morin (arnaud-morin)
Revision history for this message
Arnaud Morin (arnaud-morin) wrote :
Revision history for this message
sean mooney (sean-k-mooney) wrote :

the missing marker is a bug, the fact you get less then limit back is not really a bug.
i have set this to low as a result but we can fix it however im not entirly sure that the current fix is correct.

ill need to review it a bit more carefully.

Changed in nova:
importance: Undecided → Low
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.