Creates a data volume for a block gateway.

When you call the operation, take note of the following information:

  • Make sure that you have created and deployed a block gateway. If you enable cache mode for your data volume, you must configure a cache disk for the block gateway. If you enable pass-through mode for the data volume, you do not need a cache disk.
  • An Object Storage Service (OSS) bucket is created.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateGatewayBlockVolume

The operation that you want to perform. Set the value to CreateGatewayBlockVolume.

GatewayId String Yes gw-000dt67z4ijngqvh1***

The ID of the gateway.

Name String Yes name

The name of the data volume. The name must be 1 to 32 characters in length and can contain lowercase letters and digits. It must start with a lowercase letter.

OssBucketName String Yes bucketName

The name of the OSS bucket.

An OSS bucket for which you configure back-to-origin rules is not supported. </note>

OssEndpoint String Yes oss-cn-shanghai-internal.aliyuncs.com

The endpoint of the OSS bucket.

If the OSS bucket and the gateway reside in the same region, we recommend that you specify the internal endpoint of the OSS bucket. Example: oss-cn-shanghai-internal.aliyuncs.com. </note>

VolumeProtocol String Yes iSCSI

The protocol of the data volume. Valid value:

  • iSCSI
Recovery Boolean No false

Specifies whether to enable recovery mode for the data volume. If you enable recovery mode and you used the OSS bucket to store data for the data volume, the metadata set of the OSS bucket is used to recover the data volume.

Default value: false. A new data volume is created based on the OSS bucket.

Size Long No 100

The capacity of the data volume. Unit: GB. Valid values:

1 to 262144.

Default value: 100

The parameter does not take effect if recovery mode is enabled for the data volume. </note>

ChunkSize Integer No 32768

The capacity of the storage allocation unit. A storage allocation unit is the minimum allocation unit of a data volume. To ensure the storage efficiency, we recommend that you use the storage allocation unit of your application. Unit: bytes. Valid values:

  • 8192
  • 16384
  • 32768
  • 65536
  • 131072

Default value: 32768

The parameter does not take effect if recovery mode is enabled for the data volume. </note>

CacheMode String No Cache

The cache mode of the data volume. Valid values:

  • Cache: cache mode
  • WriteThrough: pass-through mode

Default value: Cache

In cache mode, read and write operations are first performed between the local cache disks and the gateway. In pass-through mode, read and write operations are performed between the OSS bucket and the gateway. Generally, cache mode provides better read and write performance. </note>

ChapEnabled Boolean No false

Specifies whether to enable Challenge-Handshake Authentication Protocol (CHAP) for the data volume. Inbound CHAP settings are supported.

Default value: false

ChapInUser String No chapInUser

The inbound CHAP username. The name must be 1 to 32 characters in length and can contain letters and digits.

The parameter takes effect only when CHAP is enabled. </note>

ChapInPassword String No chapInPassword

The password of the inbound CHAP user. The name must be 12 to 16 characters in length and can contain letters, digits, and the following characters: !, @, #, $, %, ^, &, and *.

The parameter takes effect only when CHAP is enabled. </note>

OssBucketSsl Boolean No true

Specifies whether to enable Secure Sockets Layer (SSL) for the OSS bucket.

Default value: true

LocalFilePath String No /dev/vdb

The path of the cache disk. You can query the path of the cache disk by calling the DescribeGatewayCaches operation.

The parameter takes effect only when pass-through mode is not enabled. </note>

Response parameters

Parameter Type Example Description
Code String 200

The HTTP status code. If the request is successful, 200 is returned.

Message String successful

The description of the status code.

RequestId String 9083F167-95B1-4B40-B2CD-70DE068EC3**

The ID of the request.

Success Boolean true

Indicates whether the request is successful.

TaskId String t-000c6hshwukkbtxrb***

The ID of the task.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateGatewayBlockVolume
&GatewayId=gw-000dt67z4ijngqvh1***
&Name=name
&OssBucketName=bucketName
&OssEndpoint=oss-cn-shanghai-internal.aliyuncs.com
&VolumeProtocol=iSCSI
&<Common request parameters>

Sample success responses

XML format

<CreateGatewayBlockVolumeResponse>
      <TaskId>t-000c6hshwukkbtxrb***</TaskId>
      <Message>successful</Message>
      <RequestId>9083F167-95B1-4B40-B2CD-70DE068EC3**</RequestId>
      <Code>200</Code>
      <Success>true</Success>
</CreateGatewayBlockVolumeResponse>

JSON format

{
    "TaskId": "t-000c6hshwukkbtxrb***",
    "Message": "successful",
    "RequestId": "9083F167-95B1-4B40-B2CD-70DE068EC3**",
    "Code": 200,
    "Success": true
}

Error codes

HttpCode Error code Error message Description
400 InvalidParameter.BlockVolume.%s The specified field %s for block volume is invalid. Please check it again. The error message returned because invalid parameters exist. Check the parameters and try again.
400 VersionNotSupported.BlockVolume.%s The specified field %s for block volume is not supported by current gateway version. Please check it again. The error message returned because some parameters are not supported by the current gateway version. Check the parameters and try again.

For a list of error codes, visit the API Error Center.