Creates a data volume for a block gateway.
Before you call this operation, make sure that the following requirements are met:
- A block gateway is created and deployed. If you enable the cache mode for your data volume, you must configure an unused cache disk for the block gateway. If you enable the pass-through mode for the data volume, you do not need a cache disk.
- An Object Storage Service (OSS) bucket is created.
Debugging
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. |
Recovery | Boolean | No | false | Specifies whether to enable the recovery mode for the data volume. If you enable the recovery mode and the OSS bucket is used 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. |
VolumeProtocol | String | Yes | iSCSI | The protocol of the data volume. Valid value: iSCSI. |
Size | Long | No | 100 | The capacity of the data volume. Unit: GB. Valid values: 1 to 262144. Default value: 100. Note The parameter does not take effect if the recovery mode is enabled for the data volume. |
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:
Default value: 32768. Note The parameter does not take effect if the recovery mode is enabled for the data volume. |
CacheMode | String | No | Cache | The cache mode of the data volume. Valid values:
Default value: Cache. Note 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, the cache mode provides better read and write performance. |
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. Note The parameter takes effect only when CHAP is enabled. |
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: ! @ # $ % ^ & * Note The parameter takes effect only when CHAP is enabled. |
OssBucketName | String | Yes | bucketName | The name of the OSS bucket. Note An OSS bucket for which you configure back-to-origin rules is not supported. |
OssEndpoint | String | Yes | oss-cn-shanghai-internal.aliyuncs.com | The endpoint of the region in which the OSS bucket is located. Note 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. |
OssBucketSsl | Boolean | No | true | Specifies whether to enable 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. Note The parameter takes effect only when the pass-through mode is not enabled. |
Response parameters
Parameter | Type | Example | Description |
TaskId | String | t-000c6hshwukkbtxrb*** | The ID of the task. |
Message | String | successful | The description of the request result. |
RequestId | String | 9083F167-95B1-4B40-B2CD-70DE068EC3** | The ID of the request. |
Code | String | 200 | The status code. A value of 200 indicates that the request was successful. |
Success | Boolean | true | Indicates whether the request was successful. |
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
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateGatewayBlockVolumeResponse>
<TaskId>t-000c6hshwukkbtxrb***</TaskId>
<Message>successful</Message>
<RequestId>9083F167-95B1-4B40-B2CD-70DE068EC3**</RequestId>
<Code>200</Code>
<Success>true</Success>
</CreateGatewayBlockVolumeResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"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, see Service error codes.