Nova API Calls Limited to 5000 Results
Problem
API calls to the Nova API endpoint return a maximum of 5000 results by default.
Environment
- Platform9 Managed OpenStack - All Versions
- Nova
Cause
Responses are truncated at 5000 results due to the osapi_max_limit setting of 5000 which is in place to prevent the API server from becoming overwhelmed while attempting to serve a single call.
Resolution
- Obtain an authentication token to authorize your API call and assign it to the variable TOKEN.
- Build your API call and determine the number of objects you'd like returned in each call from 1 to 5000.
- Apply the limit parameter to the URI as shown in the 'server list' example call below.
# curl -s -H "X-Auth-Token: $TOKEN" "https://[mgmtPlaneURL]/nova/v2.1/[tenantID]/servers?limit=1
- Determine the ID of the last object returned from the output or, if the endpoint supports next links, the proper URI for the subsequent API call will be provided in the output.
{"servers_links": [{"href": "https://[mgmtPlaneURL]/nova/v2.1/[tenantID]/servers?limit=1&marker=ae87a129-a0e2-43d6-9864-02133d93c593", "rel": "next"}], "servers": [{"id": "ae87a129-a0e2-43d6-9864-02133d93c593", "links": [{"href": "https://[mgmtPlaneURL]/nova/v2.1/[tenantID]/servers/ae87a129-a0e2-43d6-9864-02133d93c593", "rel": "self"}, {"href": "https://[mgmtPlaneURL]/nova/[tenantID]/servers/ae87a129-a0e2-43d6-9864-02133d93c593", "rel": "bookmark"}], "name": "testinstance1"}]}
Additional Information
Was this page helpful?