Querying Details About All EVS Disks
Function
This API is used to query details about all EVS disks.
Calling Method
For details, see Calling APIs.
URI
GET /v2/{project_id}/cloudvolumes/detail
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
The project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
marker |
No |
String |
The pagination query by disk ID. Data on the first page is queried by default. When a disk ID is specified in marker, information of all disks following the specified disk is queried. (Information of the specified disk is not included in the query results.) |
name |
No |
String |
The disk name. |
limit |
No |
Integer |
The maximum number of query results that can be returned. The default value is 1000. Minimum: 1 Maximum: 1000 Default: 1000 |
sort_key |
No |
String |
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. |
offset |
No |
Integer |
The query offset. This parameter is used together with *limit when you query EVS disks. For example, there are a total of 30 EVS disk. If you set offset to 11 and limit to 10, the query starts from the twelfth disk, and a maximum of 10 disks can be queried at a time. |
sort_dir |
No |
String |
The result sorting order. The default value is desc. desc: the descending order asc: the ascending order |
status |
No |
String |
The disk status. For details, see EVS Disk Status. |
metadata |
No |
String |
The disk metadata. |
availability_zone |
No |
String |
The AZ information. |
multiattach |
No |
Boolean |
Whether the disk is shareable. true: The disk is shareable. false: The disk is not shareable. |
service_type |
No |
String |
The service type. Supported services are EVS, DSS, and DESS. |
dedicated_storage_id |
No |
String |
The dedicated storage pool ID. All disks in the dedicated storage pool can be filtered by exact match. |
dedicated_storage_name |
No |
String |
The dedicated storage pool name. All disks in the dedicated storage pool can be filtered by fuzzy match. |
volume_type_id |
No |
String |
The disk type ID. To obtain the ID, see the value of id in the table for describing the volume_types parameter in Querying EVS Disk Types.. |
id |
No |
String |
The disk ID. |
ids |
No |
String |
The disk IDs. The value is in the ids=['id1','id2',...,'idx'] format. In the response, the ids value contains valid disk IDs only. Invalid disk IDs are ignored. The details about a maximum of 60 disks can be queried. If id and ids are both specified in the request, id will be ignored. |
enterprise_project_id |
No |
String |
The enterprise project ID, which is used for filtering. If all_granted_eps is transferred, the disks in all enterprise projects that are within the permission scope will be queried. For details about how to obtain enterprise project IDs and enterprise project features, see Overview. |
server_id |
No |
String |
The server ID. |
root_resource_type |
No |
String |
The root resource type. |
root_resource_id |
No |
String |
The root resource ID. |
parent_resource_type |
No |
String |
The parent resource type. |
parent_resource_id |
No |
String |
The parent resource ID. |
bootable |
No |
Boolean |
Whether the disk is a boot disk or system disk. true indicates that the disk is a boot disk or system disk, and false indicates that the disk is a data disk. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
The user token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
count |
Integer |
The number of queried disks. This value is not affected by the pagination. |
volumes_links |
Array of Link objects |
The query position marker in the disk list. If only some disks are returned in this query, the URL of the last disk queried is returned. You can use this URL to continue to query the remaining disks in the next query. |
volumes |
Array of VolumeDetail objects |
The list of returned disks. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
The disk ID. |
links |
Array of Link objects |
The disk URI. |
name |
String |
The disk name. |
status |
String |
The disk status. For details, see EVS Disk Status. |
attachments |
Array of Attachment objects |
The disk attachment information. |
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 currently not supported. |
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:
For details about the volume_image_metadata field, see Querying Image Details (Native OpenStack API). |
volume_type |
String |
The disk type. The value can be SATA, SAS, GPSSD, SSD, ESSD, GPSSD2, or ESSD2.
|
size |
Integer |
The disk size, in GiB. |
consistencygroup_id |
String |
The reserved field. |
bootable |
String |
Whether the disk is bootable. true: The disk is bootable. false: The disk is not bootable. |
metadata |
Map<String,Object> |
The disk metadata. __system__cmkid: The encryption CMK ID in metadata. This parameter is used together with __system__encrypted for encryption. The length of the CMK ID is fixed at 36 bytes. For details about how to obtain the key ID, see Querying the Key List. __system__encrypted The encryption field in metadata. The value can be 0 (no encryption) or 1 (encryption). If this parameter is not specified, 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 The creation method when the disk is created from a snapshot.
hw:passthrough
orderID 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 this parameter is not specified, the disk is billed on a pay-per-use basis. |
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 |
String |
Whether the disk is shareable. The value can be true (shareable) or false (non-shareable). This field has been deprecated. Use multiattach. |
user_id |
String |
The reserved field. |
service_type |
String |
The service type. Supported services are EVS, DSS, and DESS. |
multiattach |
Boolean |
Whether the disk is shareable. |
dedicated_storage_id |
String |
The ID of the dedicated storage pool housing the disk. |
dedicated_storage_name |
String |
The name of the dedicated storage pool housing 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. For details about how to obtain enterprise project IDs and enterprise project features, see Overview. |
serial_number |
String |
The disk serial number. This field is returned only for non-HyperMetro SCSI disks and is used for disk mapping in the VM. |
iops |
iops object |
The disk IOPS information. This parameter appears only for a general purpose SSD V2 or an extreme SSD V2 disk. |
throughput |
throughput object |
The disk throughput information. This parameter appears only for a general purpose SSD V2 disk. |
root_resource_type |
String |
The root resource type. |
root_resource_id |
String |
The root resource ID. |
parent_resource_type |
String |
The parent resource type. |
parent_resource_id |
String |
The parent resource ID. |
Parameter |
Type |
Description |
---|---|---|
href |
String |
The corresponding shortcut link. |
rel |
String |
The shortcut link marker name. |
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 attachment ID. |
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. |
Parameter |
Type |
Description |
---|---|---|
frozened |
Boolean |
The frozen tag. Default: false |
id |
String |
The ID of the disk IOPS. |
total_val |
Integer |
The IOPS. |
Parameter |
Type |
Description |
---|---|---|
frozened |
Boolean |
The frozen tag. Default: false |
id |
String |
The throughput ID. |
total_val |
Integer |
The throughput. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
The error message returned if an error occurs. For details, seeParameters in the error field. |
Parameter |
Type |
Description |
---|---|---|
code |
String |
The error code returned if an error occurs. For the error codes and their meanings, see Error Codes. |
message |
String |
The error message returned if an error occurs. |
Example Requests
-
Querying details of disks whose IDs are e92ba908-82f8-4728-b8cc-82f2f56bd461, 40g42920-4243-420f-8bb2-a0bd7660fbd8, and b1fd8dcc-dd67-4edf-b89e-87c3485112ec (The disks are sorted by size.)
GET https://{endpoint}/v2/{project_id}/cloudvolumes/detail?ids=['e92ba908-82f8-4728-b8cc-82f2f56bd461', '40g42920-4243-420f-8bb2-a0bd7660fbd8', 'b1fd8dcc-dd67-4edf-b89e-87c3485112ec']&offset=0&limit=100&sort_key=size&sort_dir=asc
-
Query details of all shared data disks of an ECS (The ECS ID is 3ffcbe9d-e5bf-45f4-aa0a-670b54bda66c. The returned results are sorted in ascending order.)
GET https://{endpoint}/v2/{project_id}/cloudvolumes/detail?server_id=3ffcbe9d-e5bf-45f4-aa0a-670b54bda66c&multiattach=true&sort_dir=asc
Example Responses
Status code: 200
OK
{ "count" : 1, "volumes" : [ { "attachments" : [ ], "availability_zone" : "az-dc-1", "bootable" : "false", "created_at" : "2016-05-25T02:42:10.856332", "id" : "b104b8db-170d-441b-897a-3c8ba9c5a214", "links" : [ { "href" : "https://volume.localdomain.com:8776/v2/dd14c6ac581f40059e27f5320b60bf2f/volumes/b104b8db-170d-441b-897a-3c8ba9c5a214", "rel" : "self" }, { "href" : "https://volume.localdomain.com:8776/dd14c6ac581f40059e27f5320b60bf2f/volumes/b104b8db-170d-441b-897a-3c8ba9c5a214", "rel" : "bookmark" } ], "metadata" : { }, "name" : "zjb_u25_test", "os-vol-host-attr:host" : "pod01.xxx#SATA", "volume_image_metadata" : { }, "os-vol-tenant-attr:tenant_id" : "dd14c6ac581f40059e27f5320b60bf2f", "replication_status" : "disabled", "multiattach" : false, "size" : 1, "status" : "available", "updated_at" : "2016-05-25T02:42:22.341984", "user_id" : "b0524e8342084ef5b74f158f78fc3049", "volume_type" : "SATA", "service_type" : "EVS", "wwn" : " 688860300000d136fa16f48f05992360" } ], "volumes_links" : [ { "href" : "https://volume.localdomain.com:8776/v2/dd14c6ac581f40059e27f5320b60bf2f/volumes/detail?limit=1&marker=b104b8db-170d-441b-897a-3c8ba9c5a214", "rel" : "next" } ] }
Status code: 400
Bad Request
{ "error" : { "message" : "XXXX", "code" : "XXX" } }
SDK Sample Code
The SDK sample code is as follows.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.evs.v2.region.EvsRegion; import com.huaweicloud.sdk.evs.v2.*; import com.huaweicloud.sdk.evs.v2.model.*; public class ListVolumesSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); EvsClient client = EvsClient.newBuilder() .withCredential(auth) .withRegion(EvsRegion.valueOf("<YOUR REGION>")) .build(); ListVolumesRequest request = new ListVolumesRequest(); request.withMarker("<marker>"); request.withName("<name>"); request.withLimit(<limit>); request.withSortKey("<sort_key>"); request.withOffset(<offset>); request.withSortDir("<sort_dir>"); request.withStatus("<status>"); request.withMetadata("<metadata>"); request.withAvailabilityZone("<availability_zone>"); request.withMultiattach(<multiattach>); request.withServiceType("<service_type>"); request.withDedicatedStorageId("<dedicated_storage_id>"); request.withDedicatedStorageName("<dedicated_storage_name>"); request.withVolumeTypeId("<volume_type_id>"); request.withId("<id>"); request.withIds("<ids>"); request.withEnterpriseProjectId("<enterprise_project_id>"); request.withServerId("<server_id>"); try { ListVolumesResponse response = client.listVolumes(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkevs.v2.region.evs_region import EvsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkevs.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = EvsClient.new_builder() \ .with_credentials(credentials) \ .with_region(EvsRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListVolumesRequest() request.marker = "<marker>" request.name = "<name>" request.limit = <limit> request.sort_key = "<sort_key>" request.offset = <offset> request.sort_dir = "<sort_dir>" request.status = "<status>" request.metadata = "<metadata>" request.availability_zone = "<availability_zone>" request.multiattach = <Multiattach> request.service_type = "<service_type>" request.dedicated_storage_id = "<dedicated_storage_id>" request.dedicated_storage_name = "<dedicated_storage_name>" request.volume_type_id = "<volume_type_id>" request.id = "<id>" request.ids = "<ids>" request.enterprise_project_id = "<enterprise_project_id>" request.server_id = "<server_id>" response = client.list_volumes(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" evs "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/evs/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/evs/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/evs/v2/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := evs.NewEvsClient( evs.EvsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListVolumesRequest{} markerRequest:= "<marker>" request.Marker = &markerRequest nameRequest:= "<name>" request.Name = &nameRequest limitRequest:= int32(<limit>) request.Limit = &limitRequest sortKeyRequest:= "<sort_key>" request.SortKey = &sortKeyRequest offsetRequest:= int32(<offset>) request.Offset = &offsetRequest sortDirRequest:= "<sort_dir>" request.SortDir = &sortDirRequest statusRequest:= "<status>" request.Status = &statusRequest metadataRequest:= "<metadata>" request.Metadata = &metadataRequest availabilityZoneRequest:= "<availability_zone>" request.AvailabilityZone = &availabilityZoneRequest multiattachRequest:= <multiattach> request.Multiattach = &multiattachRequest serviceTypeRequest:= "<service_type>" request.ServiceType = &serviceTypeRequest dedicatedStorageIdRequest:= "<dedicated_storage_id>" request.DedicatedStorageId = &dedicatedStorageIdRequest dedicatedStorageNameRequest:= "<dedicated_storage_name>" request.DedicatedStorageName = &dedicatedStorageNameRequest volumeTypeIdRequest:= "<volume_type_id>" request.VolumeTypeId = &volumeTypeIdRequest idRequest:= "<id>" request.Id = &idRequest idsRequest:= "<ids>" request.Ids = &idsRequest enterpriseProjectIdRequest:= "<enterprise_project_id>" request.EnterpriseProjectId = &enterpriseProjectIdRequest serverIdRequest:= "<server_id>" request.ServerId = &serverIdRequest response, err := client.ListVolumes(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot