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 |
Definition The project ID. For details, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
marker |
No |
String |
Definition 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 about the specified disk is not included in the query results.) Constraints N/A Range N/A Default Value N/A |
|
name |
No |
String |
Definition The disk name. Constraints N/A Range N/A Default Value N/A |
|
limit |
No |
Integer |
Definition The maximum number of query results that can be returned. Constraints N/A Range N/A Default Value 1000 |
|
sort_key |
No |
String |
Definition The keyword based on which the returned results are sorted. Constraints N/A Range
-size: The disk capacity, in GiB. Default Value created_at |
|
offset |
No |
Integer |
Definition The query offset. Constraints This parameter is used together with *limit when you query EVS disks. Assume that there are 30 disks. If you set offset to 11 and limit to 10, the query starts from the twelfth disk. A maximum of 10 disks can be queried at a time. Range N/A Default Value N/A |
|
sort_dir |
No |
String |
Definition The result sorting order. Constraints N/A Range desc: the descending order asc: the ascending order Default Value desc |
|
status |
No |
String |
Definition The disk status. [For details, see EVS Disk Status.] Constraints N/A Range N/A Default Value N/A |
|
metadata |
No |
String |
Definition The disk metadata. Constraints N/A Range N/A Default Value N/A |
|
availability_zone |
No |
String |
Definition The AZ information. Constraints N/A Range N/A Default Value N/A |
|
multiattach |
No |
Boolean |
Definition Whether the disk is shareable. Constraints N/A Range true: The disk is shareable. false: The disk is not shareable. Default Value N/A |
|
service_type |
No |
String |
Definition The service type. Constraints N/A Range
Default Value N/A |
|
dedicated_storage_id |
No |
String |
Definition The dedicated storage pool ID. You can use this parameter to filter all disks in this dedicated storage pool by exact match. Constraints N/A Range N/A Default Value N/A |
|
dedicated_storage_name |
No |
String |
Definition The dedicated storage pool name. You can use this parameter to filter all disks in this dedicated storage pool by fuzzy match. Constraints N/A Range N/A Default Value N/A |
|
volume_type_id |
No |
String |
Definition The disk type ID. You can call the Querying EVS Disk Types API and obtain the value of id from the table that describes the volume_types field. Constraints N/A Range N/A Default Value N/A |
|
id |
No |
String |
Definition The disk ID. Constraints N/A Range N/A Default Value N/A |
|
ids |
No |
String |
Definition The disk IDs. The value is in the ids=['id1','id2',...,'idx'] format. In the response, the ids value only contains valid disk IDs. Invalid disk IDs are ignored. Constraints You can query details about up to 60 disks. If both id and ids are specified in the request, id will be ignored. Range N/A Default Value N/A |
|
enterprise_project_id |
No |
String |
Definition The enterprise project ID, which is used for filtering. If all_granted_eps is transferred, disks in all enterprise projects that are within the permission scope will be queried. For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Management User Guide. Constraints N/A Range N/A Default Value N/A |
|
server_id |
No |
String |
Definition The server ID. You can call the ECS API Querying Details About ECSs to obtain the ECS ID. Constraints N/A Range N/A Default Value N/A |
|
bootable |
No |
Boolean |
Definition Whether the disk is a bootable disk or system disk. Constraints N/A Range Value true indicates a bootable disk or system disk, and value false indicates a data disk. Default Value N/A |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Definition The user token. You can obtain it by calling the IAM API. The value of X-Subject-Token in the response header is the user token. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
count |
Integer |
Definition The total number of disks queried. This value is not affected by the pagination. Range N/A |
|
volumes_links |
Array of Link objects |
Definition 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. Range N/A |
|
volumes |
Array of VolumeDetail objects |
Definition The list of returned disks. Range N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Definition The disk ID. Range N/A |
|
links |
Array of Link objects |
Definition The disk URI. Range N/A |
|
name |
String |
Definition The disk name. Range N/A |
|
status |
String |
Definition The disk status. Range For details, see EVS Disk Status. |
|
attachments |
Array of Attachment objects |
Definition The disk attachment information. Range N/A |
|
availability_zone |
String |
Definition The AZ to which the disk belongs. Range N/A |
|
os-vol-host-attr:host |
String |
Definition The reserved field. Range N/A |
|
source_volid |
String |
Definition The source disk ID. This parameter has a value if the disk is created from a source disk. This field is currently not supported. Range N/A |
|
snapshot_id |
String |
Definition The snapshot ID. This parameter has a value if the disk is created from a snapshot. Range N/A |
|
description |
String |
Definition The disk description. Range N/A |
|
created_at |
String |
Definition The time when the disk was created. Range Time format: UTC YYYY-MM-DDTHH:MM:SS.XXXXXX |
|
os-vol-tenant-attr:tenant_id |
String |
Definition The ID of the tenant to which the disk belongs. The tenant ID is the same as the project ID. Range N/A |
|
volume_image_metadata |
Map<String,Object> |
Definition The metadata of the disk image. For details about the volume_image_metadata field, see Querying Image Details (Native OpenStack API). Range N/A |
|
volume_type |
String |
Definition The disk type. Range The value can be SATA, SAS, GPSSD, SSD, ESSD, or GPSSD2.
|
|
size |
Integer |
Definition The disk capacity, in GiB. Range N/A |
|
consistencygroup_id |
String |
Definition The reserved field. Range N/A |
|
bootable |
String |
Definition Whether the disk is bootable. Range true: The disk is bootable. false: The disk is not bootable. |
|
metadata |
Map<String,Object> |
Definition The disk metadata information. Callers can add or remove the metadata information. Range The keys of this parameter used in EVS are described as follows:
|
|
updated_at |
String |
Definition The time when the disk was updated. Range Time format: UTC YYYY-MM-DDTHH:MM:SS.XXXXXX |
|
encrypted |
Boolean |
Definition This field is currently not supported. Range N/A |
|
replication_status |
String |
Definition The reserved field. Range N/A |
|
os-volume-replication:extended_status |
String |
Definition The reserved field. Range N/A |
|
os-vol-mig-status-attr:migstat |
String |
Definition The reserved field. Range N/A |
|
os-vol-mig-status-attr:name_id |
String |
Definition The reserved field. Range N/A |
|
shareable |
String |
Definition Whether the disk is shareable. The value can be true (shareable) or false (non-shareable). This field has been deprecated. Use multiattach. Range N/A |
|
user_id |
String |
Definition The reserved field. Range N/A |
|
service_type |
String |
Definition The service type. Constraints N/A Range
Default Value N/A |
|
multiattach |
Boolean |
Definition Whether the disk is shareable. Range N/A |
|
dedicated_storage_id |
String |
Definition The ID of the dedicated storage pool housing the disk. Range N/A |
|
dedicated_storage_name |
String |
Definition The name of the dedicated storage pool housing the disk. Range N/A |
|
tags |
Map<String,String> |
Definition The disk tags. This field has values if the disk has tags. Or, it is left empty. Range N/A |
|
wwn |
String |
Definition The unique identifier used when attaching the disk. Range N/A |
|
enterprise_project_id |
String |
Definition The ID of the enterprise project that the disk has been added to. For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Management User Guide. Range N/A |
|
serial_number |
String |
Definition The disk serial number. This field is only returned for non-HyperMetro SCSI disks and is used for disk mapping in the VM. Range N/A |
|
iops |
iops object |
Definition The IOPS information of the disk. This parameter is only available for general purpose SSD V2 disks. Range N/A |
|
throughput |
throughput object |
Definition The disk throughput information. This parameter only appears for general purpose SSD V2 disks. Range N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
href |
String |
Definition The corresponding shortcut link. Range N/A |
|
rel |
String |
Definition The shortcut link marker name. Range N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
attached_at |
String |
Definition The time when the disk was attached. Range Time format: UTC YYYY-MM-DDTHH:MM:SS.XXXXXX |
|
attachment_id |
String |
Definition The attachment ID. Range N/A |
|
device |
String |
Definition The device name. Range N/A |
|
host_name |
String |
Definition The name of the physical host housing the cloud server to which the disk is attached. Range N/A |
|
id |
String |
Definition The ID of the attached disk. Range N/A |
|
server_id |
String |
Definition The ID of the server to which the disk is attached. Range N/A |
|
volume_id |
String |
Definition The disk ID. Range N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
frozened |
Boolean |
Definition The frozen tag. Range N/A |
|
id |
String |
Definition The ID of the disk IOPS. Range N/A |
|
total_val |
Integer |
Definition The IOPS. Range N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
frozened |
Boolean |
Definition The frozen tag. Range N/A |
|
id |
String |
Definition The throughput ID. Range N/A |
|
total_val |
Integer |
Definition The throughput. Range N/A |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error |
Error object |
Definition The error code returned if an error occurs. For details about the error code, see Error Codes. Range N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Definition The error code returned if an error occurs. Range For details about the error code, see Error Codes. |
|
message |
String |
Definition The error message returned if an error occurs. Range N/A |
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.
Java
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 |
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"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); EvsClient client = EvsClient.newBuilder() .withCredential(auth) .withRegion(EvsRegion.valueOf("<YOUR REGION>")) .build(); ListVolumesRequest request = new ListVolumesRequest(); 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()); } } } |
Python
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 |
# coding: utf-8 import os 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.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = EvsClient.new_builder() \ .with_credentials(credentials) \ .with_region(EvsRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListVolumesRequest() 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) |
Go
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 |
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") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := evs.NewEvsClient( evs.EvsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListVolumesRequest{} response, err := client.ListVolumes(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
More
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