Querying Details of EVS Disks by Tag
Function
This API is used to query the details of EVS disks by tag.
Constraints
None
URI
- URI format
POST /v2/{project_id}/cloudvolumes/resource_instances/action
- Parameter description
Parameter
Mandatory
Description
project_id
Yes
The project ID.
For details about how to obtain the project ID, see Obtaining a Project ID.
Request
- Request parameters
Parameter
Type
Mandatory
Description
tags
Array of objects
Yes
The key-value pairs of tags. For details, see Parameters in the tags field.
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 disks having all specified keys are queried.
NOTE:If multiple tag lists are specified in the request, only the disks that meet the requirements of the last tag list are queried.
limit
Integer
No
The number of query records.
The value ranges from 1 to 1000, and the default value is 1000. The returned value cannot exceed this limit.
offset
Integer
No
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
The operation identifier.
Specifying filter queries the details of disks by tag.
matches
Array of objects
No
The query criteria that the resource supports. For details, see Parameters in the matches field.
Tag keys in the list must be unique.
- Parameters in the tags field
Parameter
Type
Mandatory
Description
key
String
Yes
The tag key.
values
Array of objects
Yes
The tag value.
- 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, disks that have any of the specified values are queried.
- Parameters in the matches field
Parameter
Type
Mandatory
Description
key
String
Yes
The tag key.
The value can be as follows:
- resource_name: the disk name
- service_type: the service type
value
String
Yes
The tag value.
- It can contain up to 255 characters.
- If resource_name is specified for key, the tag value uses a fuzzy match.
- 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
- Response parameters
Parameter
Type
Description
total_count
Integer
The total number of disks that meet the query criteria.
resources
List<resource>
The list of disks that meet the query criteria. For details, see Parameters in the resources field.
error
Object
The error message returned if an error occurs. For details, see Parameters in the error field.
- Parameters in the resources field
Parameter
Type
Description
resource_id
String
The disk ID.
resource_name
String
The disk name.
resource_detail
object
The disk details. For details, see Parameters in the VolumeDetailForTag field.
tags
Array of objects
The tag list. For details, see Parameters in the tags field.
- Parameters in the tags field
Parameter
Type
Description
key
String
The tag key.
value
String
The tag value.
- Parameters in the VolumeDetailForTag field
Parameter
Type
Description
id
String
The disk ID.
links
Array of Objects
The disk URI. For details, see Parameters in the links field.
name
String
The disk name.
status
String
The disk status. For details, see EVS Disk Status.
attachments
Array of Objects
The disk URI. For details, see Parameters in the attachments field.
availability_zone
String
The AZ to which the disk belongs.
os-vol-host-attr:host
String
The reserved field.
source_volid
String
The source disk ID. This parameter has a value if the disk is created from a source disk.
This field is not supported currently.
snapshot_id
String
The snapshot ID. This parameter has a value if the disk is created from a snapshot.
description
String
The disk description.
created_at
String
The time when the disk was created. Time format: UTC YYYY-MM-DDTHH:MM:SS.XXXXXX
os-vol-tenant-attr:tenant_id
String
The ID of the tenant to which the disk belongs. The tenant ID is the same as the project ID.
volume_image_metadata
Map<String,Object>
The metadata of the disk image.
NOTE:Note:
For details about volume_image_metadata, see Querying Image Details.
volume_type
String
The disk type. The value can be SSD, SAS, or SATA. SSD: indicates the ultra-high I/O type. SAS: indicates the high I/O type. SATA: indicates the common I/O type.
size
Integer
The disk size, in GB.
consistencygroup_id
String
The reserved field.
bootable
String
Whether the disk is bootable. The value can be true (a bootable disk) or false (a non-bootable disk).
metadata
Object
The disk metadata. For details, see Parameters in the VolumeMetadata field.
updated_at
String
The time when the disk was updated. Time format: UTC YYYY-MM-DDTHH:MM:SS.XXXXXX
encrypted
Boolean
This field is currently not supported.
replication_status
String
The reserved field.
os-volume-replication:extended_status
String
The reserved field.
os-vol-mig-status-attr:migstat
String
The reserved field.
os-vol-mig-status-attr:name_id
String
The reserved field.
shareable
Boolean
Whether the disk is shareable. The value can be true (shared disk) or false (common disk). This field is no longer used. Use multiattach.
user_id
String
The reserved field.
service_type
String
The service type. The value can be EVS, DSS, or DESS.
multiattach
Boolean
Whether the disk is shareable.
dedicated_storage_id
String
The ID of the dedicated storage pool accommodating the disk.
dedicated_storage_name
String
The name of the dedicated storage pool accommodating the disk.
tags
Map<String,String>
The disk tags. This field has values if the disk has tags. Or, it is left empty.
wwn
String
The unique identifier used when attaching the disk.
enterprise_project_id
String
The ID of the enterprise project that the disk has been added to.
NOTE:Note:
For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Management User Guide.
- Parameters in the links field
Parameter
Type
Description
href
String
The corresponding shortcut link.
rel
String
The shortcut link marker name.
- Parameters in the attachments field
Parameter
Type
Description
attached_at
String
The time when the disk was attached.
Time format: UTC YYYY-MM-DDTHH:MM:SS.XXXXXX
attachment_id
String
The ID of the attachment information.
device
String
The device name.
host_name
String
The name of the physical host housing the cloud server to which the disk is attached.
id
String
The ID of the attached disk.
server_id
String
The ID of the server to which the disk is attached.
volume_id
String
The disk ID.
- Parameters in the VolumeMetadata field
Parameter
Type
Description
__system__cmkid
String
The encryption CMK ID in metadata. This parameter is used together with __system__encrypted for encryption. The length of cmkid is fixed at 36 bytes.
NOTE:For details about how to obtain the CMK ID, see Querying the List of CMKs.
__system__encrypted
String
The encryption field in metadata. The value can be 0 (not encrypted) or 1 (encrypted). If this parameter does not appear, the encryption attribute of the disk is the same as that of the data source. If the disk is not created from a data source, the disk is not encrypted by default.
full_clone
String
The method of creation when the disk is created from a snapshot.
- 0: linked clone
- 1: full clone
hw:passthrough
String
- Value true indicates the SCSI device type, which allows ECS OSs to directly access the underlying storage media. SCSI reservation commands are supported.
- Value false indicates the VBD device type, which supports only simple SCSI read/write commands.
- If this parameter does not appear, the disk device type is VBD.
orderID
String
The parameter that describes the disk billing mode in metadata. If this parameter has a value, the disk is billed on a yearly/monthly basis. If not, the disk is billed on a pay-per-use basis.
- Parameters in the error field
Parameter
Type
Description
message
String
The error message returned if an error occurs.
code
String
The error code returned if an error occurs.
For details about the error code, see Error Codes.
- Example response
{ "total_count": 1, "resources": [{ "resource_name": "resource1", "resource_detail": { "attachments": [{ "server_id": "2080869e-ba46-4ea5-b45e-3191ac0f1d54", "attachment_id": "1335f039-7a42-4d1e-be49-ac584db0ba0b", "attached_at": "2019-08-06T07:00:21.842812", "host_name": null, "volume_id": "7fa6b592-ac75-460d-a28a-bb17429d1eb2", "device": "/dev/vda", "id": "7fa6b592-ac75-460d-a28a-bb17429d1eb2" }], "links": [{ "href": "https://volume.Region.dc1.domainname.com/v2/051375756c80d5eb2ff0c014498645fb/volumes/7fa6b592-ac75-460d-a28a-bb17429d1eb2", "rel": "self" }, { "href": "https://volume.Region.dc1.domainname.com/051375756c80d5eb2ff0c014498645fb/volumes/7fa6b592-ac75-460d-a28a-bb17429d1eb2", "rel": "bookmark" }], "availability_zone": "kvmxen.dc1", "os-vol-host-attr:host": "az21.dc1#2", "encrypted": false, "dedicated_storage_id": null, "enterprise_project_id": "0", "updated_at": "2019-08-09T06:19:35.874737", "os-volume-replication:extended_status": null, "replication_status": "disabled", "snapshot_id": null, "id": "7fa6b592-ac75-460d-a28a-bb17429d1eb2", "size": 40, "user_id": "75f26e17348643bfb7718578b04635c2", "os-vol-tenant-attr:tenant_id": "051375756c80d5eb2ff0c014498645fb", "service_type": "EVS", "os-vol-mig-status-attr:migstat": null, "metadata": { }, "status": "in-use", "volume_image_metadata": { "size": "0", "__quick_start": "False", "container_format": "bare", "min_ram": "0", "image_name": "test-hua-centos7.3-0725", "image_id": "c6c153a6-dde8-4bac-8e40-3d7619436934", "__os_type": "Linux", "min_disk": "20", "__support_kvm": "true", "virtual_env_type": "FusionCompute", "__description": "", "__os_version": "CentOS 7.3 64bit", "__os_bit": "64", "__image_source_type": "uds", "__support_xen": "true", "file_format": "zvhd2", "checksum": "d41d8cd98f00b204e9800998ecf8427e", "__imagetype": "gold", "disk_format": "zvhd2", "__image_cache_type": "Not_Cache", "__isregistered": "true", "__image_location": "192.168.46.200:5443:pcsimsregion:c6c153a6-dde8-4bac-8e40-3d7619436934", "__image_size": "911269888", "__platform": "CentOS" }, "description": "", "multiattach": false, "source_volid": null, "consistencygroup_id": null, "os-vol-mig-status-attr:name_id": null, "name": "resource1", "bootable": "true", "created_at": "2019-08-06T06:59:03.056682", "volume_type": "SAS", "shareable": false, "dedicated_storage_name": null }, "tags": [{ "key": "key1", "value": "value1" }, { "key": "key1", "value": "value2" }], "resource_id": "7fa6b592-ac75-460d-a28a-bb17429d1eb2" }] }
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 } }
Error Codes
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.