Skip to content

nova: List request always uses detailed server listing #2553

@kayrus

Description

@kayrus

There is no way to list servers without details, see https://docs.openstack.org/api-ref/compute/#list-servers vs https://docs.openstack.org/api-ref/compute/#list-servers-detailed

func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {
url := listDetailURL(client)

A simple comparison for 1k servers listing:

$ time curl -s https://nova:443/v2.1/servers -H "X-Auth-Token: ${OS_AUTH_TOKEN}" | jq -r '.servers|length'
985

real    0m1,907s
user    0m0,097s
sys     0m0,015s
$ time curl -s https://nove:443/v2.1/servers/detail -H "X-Auth-Token: ${OS_AUTH_TOKEN}" | jq -r '.servers|length'
985

real    0m20,425s
user    0m0,117s
sys     0m0,039s

simple servers listing takes 10 times faster results.

Proposal:

  1. implement a NEW ListNoDetail function to list servers using listURL(client) call, keeping the backward compatibility for gophercloud
  2. rename current List func to ListDetail and implement a new List func using NO-detail URL. This will break backward compatibility. Nevertheless I prefer this solution, since other API calls do have ListDetail functions, e.g. nova images, flavors, manila shares and baremetals.

see also: kubernetes/cloud-provider-openstack#2089

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions