Help Center/ Elastic Volume Service/ API Reference/ API/ Disk Management/ Querying Details About an EVS Disk
Updated on 2024-02-27 GMT+08:00

Querying Details About an EVS Disk

Function

This API is used to query details about a single EVS disk. Enterprise project authorization is supported.

Calling Method

For details, see Calling APIs.

URI

GET /v2/{project_id}/cloudvolumes/{volume_id}

Table 1 Path Parameters

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.

volume_id

Yes

String

The disk ID.

Request Parameters

Table 2 Request header 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

Table 3 Response body parameters

Parameter

Type

Description

volume

VolumeDetail object

The disk details.

Table 4 VolumeDetail

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.

  • SATA: the common I/O type (sold out)

  • SAS: the high I/O type

  • GPSSD: the general purpose SSD type

  • SSD: the ultra-high I/O type

  • ESSD: the extreme SSD type

  • GPSSD2: the general purpose SSD V2 type

  • ESSD2: the extreme SSD V2 type

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.

  • 0: linked clone

  • 1: full clone

hw:passthrough

  • If this parameter value is true, the disk device type is SCSI, which allows ECS OSs to directly access the underlying storage media and supports SCSI reservation commands.

  • If this parameter is set to false, the disk device type is VBD, which is also the default type. VBD supports only simple SCSI read/write commands.

  • If this parameter is not specified, the disk device type is VBD.

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.

Table 6 Attachment

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.

Table 7 iops

Parameter

Type

Description

frozened

Boolean

The frozen tag.

Default: false

id

String

The ID of the disk IOPS.

total_val

Integer

The IOPS.

Table 8 throughput

Parameter

Type

Description

frozened

Boolean

The frozen tag.

Default: false

id

String

The throughput ID.

total_val

Integer

The throughput.

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error

Error object

The error message returned if an error occurs. For details, seeParameters in the error field.

Table 10 Error

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

GET https://{endpoint}/v2/{project_id}/cloudvolumes/{volume_id}

Example Responses

Status code: 200

The disk information is returned.

{
  "volume" : {
    "attachments" : [ ],
    "links" : [ {
      "href" : "https://volume.az0.dc1.domainname.com/v2/40acc331ac784f34842ba4f08ff2be48/volumes/591ac654-26d8-41be-bb77-4f90699d2d41",
      "rel" : "self"
    }, {
      "href" : "https://volume.az0.dc1.domainname.com/40acc331ac784f34842ba4f08ff2be48/volumes/591ac654-26d8-41be-bb77-4f90699d2d41",
      "rel" : "bookmark"
    } ],
    "availability_zone" : "az-dc-1",
    "os-vol-host-attr:host" : "az-dc-1#SSD",
    "multiattach" : true,
    "updated_at" : "2016-02-03T02:19:29.895237",
    "replication_status" : "disabled",
    "id" : "591ac654-26d8-41be-bb77-4f90699d2d41",
    "size" : 40,
    "user_id" : "fd03ee73295e45478d88e15263d2ee4e",
    "os-vol-tenant-attr:tenant_id" : "40acc331ac784f34842ba4f08ff2be48",
    "metadata" : { },
    "tags" : {
      "key1" : "value1",
      "key2" : "value2"
    },
    "status" : "available",
    "description" : "auto-created_from_restore_from_backup",
    "name" : "restore_backup_0115efb3-678c-4a9e-bff6-d3cd278238b9",
    "bootable" : "false",
    "created_at" : "2016-02-03T02:19:11.723797",
    "service_type" : "EVS",
    "wwn" : " 688860300000d136fa16f48f05992360"
  }
}

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
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 ShowVolumeSolution {

    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();
        ShowVolumeRequest request = new ShowVolumeRequest();
        try {
            ShowVolumeResponse response = client.showVolume(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
# 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 = ShowVolumeRequest()
        response = client.show_volume(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
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.ShowVolumeRequest{}
	response, err := client.ShowVolume(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

The disk information is returned.

400

Bad Request

Error Codes

See Error Codes.