Allocating DeHs¶
Function¶
This API is used to allocate one or more DeHs and set required parameters, such as the flavor, AZ, and quantity.
Constraints¶
The number of allocatable DeHs depends on the DeH quota owned by the tenant.
URI¶
POST /v1.0/{project_id}/dedicated-hosts
Table 1 describes the parameters.
Parameter | Type | Mandatory | Description |
---|---|---|---|
project_id | String | Yes | Specifies the project ID. For details about how to obtain the project ID, see Obtaining Required Information. |
Request¶
Parameter | In | Type | Mandatory | Description |
---|---|---|---|---|
name | body | String | Yes | Specifies the DeH name. |
auto_placement | body | String | No | Specifies whether to allow an ECS to be placed on any available DeH if its DeH ID is not specified during its creation. The value can be on or off. The default value is on. |
availability_zone | body | String | Yes | Specifies the AZ to which the DeH belongs. |
host_type | body | String | Yes | Specifies the DeH type. |
quantity | body | Integer | Yes | Specifies the number of allocatable DeHs. |
tags | body | Array of objects | No | Specifies the DeH tags. For details, see Table 3. |
Parameter | Type | Mandatory | Description |
---|---|---|---|
key | String | Yes | Specifies the tag key.
|
value | String | Yes | Specifies the tag value.
|
Response¶
Parameter | In | Type | Description |
---|---|---|---|
dedicated_host_ids | body | Array of strings | Specifies a group of IDs of allocated DeHs. The tenant can create ECSs on these DeHs. |
Example Request¶
Two s3 DeHs are allocated in az1, and the DeH name is General Computing server1.
POST https://{Endpoint}/v1.0/9c53a566cb3443ab910cf0daebca90c4/dedicated-hosts
{
"availability_zone": "dc1.az1",
"name": "General-Purpose server1",
"auto_placement": "off",
"host_type":"s2",
"quantity": 2,
"tags": [
{
"key": "key1",
"value": "value1"
}
]
}
Example Response¶
{
"dedicated_host_ids": ["xxxxxxx1","xxxxxxx2"]
}
Status Code¶
Error Code | Description |
---|---|
403 Forbidden |
|
404 FlavorNotFound | Invalid flavor. |
For more status codes, see Status Codes.