• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. OpenStack Cinder API v3
  5. EVS Disk
  6. Querying EVS Disks

Querying EVS Disks

Function

This API is used to query EVS disks.

URI

  • URI format

    GET /v3/{project_id}/volumes

  • Parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID.

  • Request filter parameters

    Parameter

    Type

    Mandatory

    Description

    marker

    string

    No

    Specifies the ID of the last record on the previous page. The returned value is the value of the item after this one.

    name

    string

    No

    Specifies the disk name. The value can contain a maximum of 255 bytes.

    limit

    int

    No

    Specifies the maximum number of query results that can be returned.

    The value ranges from 1 to 1000, and the default value is 1000. The returned value cannot exceed this limit.

    If the tenant has more than 50 disks in total, you are advised to use this parameter and set its value to 50 to improve the query efficiency. Examples are provided as follows:

    GET /v2/xxx/volumes?limit=50: Queries the 1–50 disks. GET /v2/xxx/volumes?offset=50&limit=50: Queries the 51–100 disks.

    sort_key

    string

    No

    Specifies the keyword based on which the returned results are sorted. The value can be id, status, size, or created_at, and the default value is created_at.

    sort_dir

    string

    No

    Specifies the result sorting order. The default value is desc.
    • desc: indicates the descending order.
    • asc: indicates the ascending order.

    offset

    int

    No

    Specifies the offset.

    If the value is an integer greater than 0 but less than the number of disks, all disks after this offset will be queried.

    status

    string

    No

    Specifies the disk status. For details, see EVS Disk Status.

    metadata

    string

    No

    Specifies the disk metadata.

    availability_zone

    string

    No

    Specifies the AZ.

    bootable

    boolean

    No

    Specifies whether the query result contains system disks. The values are as follows:

    • True, true, and 1: The query result contains system disks only.
    • False, false, and 0: The query result does not contain system disks.

    This parameter is supported when the request version is 3.2 or later.

    migration_status

    string

    No

    Specifies the migration status. The value can be starting, migrating, success, or error.

    name~

    string

    No

    Specifies the fuzzy search by disk name. This parameter is supported when the request version is 3.31 or later.

    status~

    string

    No

    Specifies the fuzzy search by disk status. This parameter is supported when the request version is 3.31 or later.

    availability_zone~

    string

    No

    Specifies the fuzzy search by AZ. This parameter is supported when the request version is 3.31 or later.

    migration_status~

    string

    No

    Specifies the fuzzy search by migration status. This parameter is supported when the request version is 3.31 or later.

    with_count

    boolean

    No

    Specifies to return parameter counts in the response. This parameter indicates the number of disks queried. This parameter is in the with_count=true format and is supported when the request version is 3.45 or later.

    This parameter can be used together with parameters marker, limit, sort_key, sort_dir, or offset in the table. It cannot be used with other filter parameters.

Request

The following example shows how to query the disks in the available state.

  • Example request
    GET https://{endpoint}/v3/{project_id}/volumes?state=available

Response

  • Parameter description

    Parameter

    Type

    Description

    volumes

    list

    Specifies the list of queried disks. For details, see Parameters in the volumes field.

    volumes_links

    list

    Specifies the query position marker in the disk list. If only some disks are returned in this query, the URL of the last disk queried will be returned. You can use this URL to continue to query the remaining disks in the next query.

    count

    map

    Specifies the number of records returned in this query.

    error

    string

    Specifies the error message returned when an error occurs. For details, see Parameters in the error field.

  • Parameters in the volumes field

    Parameter

    Type

    Description

    id

    string

    Specifies the disk ID.

    links

    list<map<string, string>>

    Specifies the disk URI. For details, see Parameters in the links field.

    name

    string

    Specifies the disk name. The value can contain a maximum of 255 bytes.

  • Parameters in the links field

    Parameter

    Type

    Description

    href

    string

    Specifies the corresponding shortcut link.

    rel

    string

    Specifies the shortcut link marker name.

  • Parameters in the error field

    Parameter

    Type

    Description

    message

    string

    Specifies the error message returned when an error occurs.

    code

    string

    Specifies the error code returned when an error occurs.

    For details about the error code, see Error Codes.

  • Example response
    {
        "count": 3, 
        "volumes": [
            {
                "id": "6b604cef-9bd8-4f5a-ae56-45839e6e1f0a", 
                "links": [
                    {
                        "href": "https://volume.localdomain.com:8776/v2/dd14c6ac581f40059e27f5320b60bf2f/volumes/6b604cef-9bd8-4f5a-ae56-45839e6e1f0a", 
                        "rel": "self"
                    }, 
                    {
                        "href": "https://volume.localdomain.com:8776/dd14c6ac581f40059e27f5320b60bf2f/volumes/6b604cef-9bd8-4f5a-ae56-45839e6e1f0a", 
                        "rel": "bookmark"
                    }
                ], 
                "name": "zjb_u25_test"
            }, 
            {
                "id": "2bce4552-9a7d-48fa-8484-abbbf64b206e", 
                "links": [
                    {
                        "href": "https://volume.localdomain.com:8776/v2/dd14c6ac581f40059e27f5320b60bf2f/volumes/2bce4552-9a7d-48fa-8484-abbbf64b206e", 
                        "rel": "self"
                    }, 
                    {
                        "href": "https://volume.localdomain.com:8776/dd14c6ac581f40059e27f5320b60bf2f/volumes/2bce4552-9a7d-48fa-8484-abbbf64b206e", 
                        "rel": "bookmark"
                    }
                ], 
                "name": "zjb_u25_test"
            }, 
            {
                "id": "3f1b98ec-a8b5-4e92-a727-88def62d5ad3", 
                "links": [
                    {
                        "href": "https://volume.localdomain.com:8776/v2/dd14c6ac581f40059e27f5320b60bf2f/volumes/3f1b98ec-a8b5-4e92-a727-88def62d5ad3", 
                        "rel": "self"
                    }, 
                    {
                        "href": "https://volume.localdomain.com:8776/dd14c6ac581f40059e27f5320b60bf2f/volumes/3f1b98ec-a8b5-4e92-a727-88def62d5ad3", 
                        "rel": "bookmark"
                    }
                ], 
                "name": "zjb_u25_test"
            }
        ], 
        "volumes_links": [
            {
                "href": "https://volume.localdomain.com:8776/v2/dd14c6ac581f40059e27f5320b60bf2f/volumes?limit=3&marker=3f1b98ec-a8b5-4e92-a727-88def62d5ad3", 
                "rel": "next"
            }
        ]
    }
    

    or

    {
        "error": {
            "message": "XXXX", 
            "code": "XXX"
        }
    }

    In the preceding example, error indicates a general error, for example, badRequest or itemNotFound. An example is provided as follows:

    { 
        "badRequest": { 
            "message": "XXXX", 
            "code": "XXX" 
        } 
    }

Returned Values

  • Normal

    200

Error Codes

For details, see Error Codes.