• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Nova
  5. Flavors
  6. Querying Flavors

Querying Flavors

Function Description

This interface is used to query available ECS flavors. After receiving the request, Nova uses nova-api to view the flavors from the database.

URI

  • URI format

    GET /v2/{tenant_id}/flavors

    GET /v2.1/{tenant_id}/flavors

  • Parameter description

    Parameter

    Mandatory

    Description

    tenant_id

    Yes

    Specifies the tenant or project ID.

Restrictions

N/A

Extension Description

N/A

Request

Fields in the following table can be used as URI parameters to filter query results. Usage: /v2/{tenant_id}/flavors?minDisk={minDisk}&minRam={minRam}

Parameter

Type

Mandatory

Description

minDisk

String

No

Specifies the minimum disk specification in the unit of GB. Only the ECSs with the disk specification greater than or equal to the minimum specification can be queried.

minRam

String

No

Specifies the minimum RAM in the unit of MB. Only the ECSs with the RAM specification greater than or equal to the minimum specification can be queried.

sort_key

String

No

Indicates a sorting field, the default value of which is flavorid.

The value of this parameter can also be namememory_mbvcpusroot_gb, or flavorid.

sort_dir

String

No

Specifies the ascending (asc) or descending (desc) sorting. The default value is asc.

Response

Parameter

Type

Mandatory

Description

id

String

Yes

Specifies the flavor ID.

links

List(Dict)

Yes

Specifies the shortcut link of the ECS flavor.

For details, see Table 1.

name

String

Yes

Specifies the flavor name.

Table 1 links field description

Parameter

Type

Description

rel

String

Specifies the shortcut link marker name.

href

String

Specifies the shortcut link.

Example Request

GET /v2/9c53a566cb3443ab910cf0daebca90c4/flavors
GET /v2.1/9c53a566cb3443ab910cf0daebca90c4/flavors

Example Response

{
    "flavors": [
        {
            "id": "4",
            "links": [
                {
                    "href": "http://192.168.82.222:8774/v2/9c53a566cb3443ab910cf0daebca90c4/flavors/4",
                    "rel": "self"
                },
                {
                    "href": "http://192.168.82.222:8774/9c53a566cb3443ab910cf0daebca90c4/flavors/4",
                    "rel": "bookmark"
                }
            ],
            "name": "m1.large"
        },
        {
            "id": "5",
            "links": [
                {
                    "href": "http://192.168.82.222:8774/v2/9c53a566cb3443ab910cf0daebca90c4/flavors/5",
                    "rel": "self"
                },
                {
                    "href": "http://192.168.82.222:8774/9c53a566cb3443ab910cf0daebca90c4/flavors/5",
                    "rel": "bookmark"
                }
            ],
            "name": "m1.xlarge"
        }
    ]
}     

Returned Value

See General Request Returned Values.