• Elastic Volume Service

evs
  1. Help Center
  2. Elastic Volume Service
  3. API Reference
  4. API v3
  5. EVS Tag
  6. Querying Details of EVS Disks by Tag

Querying Details of EVS Disks by Tag

Function

This API is used to query the details of the EVS disks by tag.

Constraints

None

URI

  • URI format

    POST /v3/{project_id}/os-vendor-volumes/resource_instances/action

  • Parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID.

Request

  • Parameter description

    Parameter

    Type

    Mandatory

    Description

    tags

    list<resource_tag>

    No

    Specifies the key-value pairs of the tag.

    One tag list can contain a maximum of 10 keys.

    Tag keys in a tag list must be unique.

    When multiple keys are specified in a tag list, only the EVS disks having all specified keys are queried.

    NOTE:

    If multiple tag lists are specified in the request, only the EVS disks that meet the requirements of the last tag list are queried.

    limit

    string

    No

    Specifies the number of query records.

    The value ranges from 1 to 1000, and the default value is 1000. The number of query records in the response cannot exceed the limit value.

    offset

    string

    No

    Specifies the index location.

    The minimum value is 0, which is also the default value.

    The first record in the query result is the offset+1 record that meets the query criteria.

    action

    string

    Yes

    Specifies the operation identifier.

    The value can be as follows:

    • filter
    • count

    Specifying filter queries the details of EVS disks by tag.

    matches

    list<match>

    No

    Specifies the search criteria supported by disks.

    Tag keys in the list must be unique.

  • Parameters in the tags field

    Parameter

    Type

    Mandatory

    Description

    key

    string

    Yes

    Tag key:
    • Cannot be left blank.
    • Must be unique for each resource.
    • Can contain a maximum of 36 characters.
    • Can contain only digits, letters, hyphens (-), and underscores (_).

    values

    list

    Yes

    Tag value:
    • Can contain a maximum of 43 characters.
    • Can contain only digits, letters, hyphens (-), and underscores (_).

    One value list can contain a maximum of 10 values.

    Tag values in a value list must be unique.

    If the value list is left empty, any tag value can be matched.

    When multiple values are specified in a value list and the key requirements are met, EVS disks that have any of the specified values are queried.

  • Parameters in the matches field

    Parameter

    Type

    Mandatory

    Description

    key

    string

    Yes

    Specifies the tag key. The value is of the enumerated type.

    The value can be as follows:

    • resource_name: disk name.
    • service_type: service type.

    value

    string

    Yes

    Specifies the tag value.

    • It can contain up to 255 Unicode characters.
    • If resource_name is specified for key, the tag value uses a fuzzy match.
    • If service_type is specified for key, the value is of the enumerated type. It can be EVS or DSS and is case-insensitive.
  • Example request
    {
        "offset": "100", 
        "limit": "100", 
        "action": "filter", 
        "tags": [
            {
                "key": "key1", 
                "values": [
                    "value1", 
                    "value2"
                ]
            }
        ], 
        "matches": [
            {
                "key": "resource_name", 
                "value": "resource1"
            }, 
            {
                "key": "service_type", 
                "value": "EVS"
            }
        ]
    }

Response

  • Parameter description

    Parameter

    Type

    Description

    total_count

    int

    Specifies the total number of EVS disks that meet the query criteria.

    resources

    List<resource>

    Specifies the list of EVS disks that meet the query criteria.

  • Parameters in the resources field

    Parameter

    Type

    Description

    resource_id

    string

    Specifies the disk ID.

    resource_name

    string

    Specifies the disk name.

    resource_detail

    object

    Specifies the disk details.

    tags

    list<resource_tag>

    Specifies the tag list.

  • Parameters in the tags field

    Parameter

    Type

    Description

    key

    string

    Tag key:
    • Cannot be left blank.
    • Must be unique for each resource.
    • Can contain a maximum of 36 characters.
    • Can contain only digits, letters, hyphens (-), and underscores (_).

    value

    string

    Tag value:
    • Can contain a maximum of 43 characters.
    • Can contain only digits, letters, hyphens (-), and underscores (_).
  • Example response
    {
        "total_count": 1, 
        "resources": [
            {
                "sys_tags": [
                    {
                        "key": "_sys_enterprise_project_id", 
                        "value": "0"
                    }
                ], 
                "resource_name": "Test_VOLUME_20180804055602_0001", 
                "resource_detail": {
                    "status": "in-use", 
                    "migration_status": null, 
                    "volume_image_metadata": { }, 
                    "attachments": [
                        {
                            "server_id": "6b48e854-2a68-4ae6-b7d1-c05262d3ebfe", 
                            "attachment_id": "fe4589a0-916c-49ed-b518-404514926d07", 
                            "attached_at": "2018-08-03T21:56:24.502050", 
                            "host_name": null, 
                            "volume_id": "2f8d32db-25fe-4ce7-b235-8f62af285c31", 
                            "device": "/dev/vda", 
                            "id": "2f8d32db-25fe-4ce7-b235-8f62af285c31"
                        }
                    ], 
                    "links": [
                        {
                            "href": "https://172.28.11.187:8776/v2/bf1c5745683c479689c5bbdf0b029a69/volumes/2f8d32db-25fe-4ce7-b235-8f62af285c31", 
                            "rel": "self"
                        }, 
                        {
                            "href": "https://172.28.11.187:8776/bf1c5745683c479689c5bbdf0b029a69/volumes/2f8d32db-25fe-4ce7-b235-8f62af285c31", 
                            "rel": "bookmark"
                        }
                    ], 
                    "availability_zone": "kvmxen.dc1", 
                    "os-vol-host-attr:host": "az21.dc1#SAS", 
                    "encrypted": false, 
                    "dedicated_storage_id": null, 
                    "enterprise_project_id": "0", 
                    "updated_at": "2018-08-03T21:56:24.538926", 
                    "source_volid": null, 
                    "os-volume-replication:extended_status": null, 
                    "consistencygroup_id": null, 
                    "replication_status": "disabled", 
                    "snapshot_id": null, 
                    "id": "2f8d32db-25fe-4ce7-b235-8f62af285c31", 
                    "os-vol-mig-status-attr:name_id": null, 
                    "description": null, 
                    "user_id": "c9b85bd718a44b17adc75732c964750c", 
                    "name": "Test_VOLUME_20180804055602_0001", 
                    "bootable": "true", 
                    "created_at": "2018-08-03T21:56:04.599491", 
                    "multiattach": false, 
                    "volume_type": "SATA", 
                    "shareable": false, 
                    "dedicated_storage_name": null, 
                    "os-vol-tenant-attr:tenant_id": "bf1c5745683c479689c5bbdf0b029a69", 
                    "service_type": "EVS", 
                    "size": 1, 
                    "os-vol-mig-status-attr:migstat": null, 
                    "metadata": {
                        "__openstack_region_name": "az21.dc1", 
                        "__system__volume_name": "Test_VOLUME_20180804055602_0001"
                    }
                }, 
                "tags": [
                    {
                        "key": "age", 
                        "value": "1001"
                    }, 
                    {
                        "key": "age01", 
                        "value": "100101"
                    }
                ], 
                "resource_id": "2f8d32db-25fe-4ce7-b235-8f62af285c31"
            }
        ]
    }

    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:

    {
        "computeFault": {
            "message": "The server has either erred or is incapable of performing the requested operation.", 
            "code": 500
        }
    }

Returned Values

  • Normal

    200

Error Codes

For details, see Error Codes.