GetCandidateZonesClustersHostsForCreatingVm
API Request
URLs
GET zstack/v1/vm-instances/candidate-destinationsHeaders
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm-instances/candidate-destinations?\
instanceOfferingUuid=0a3d761b0e3031a9b3c62f418fdade09&imageUuid=f6885d39912b347880517a58a9f5ad5b\
&l3NetworkUuids=51f30f4fcd3b3a0da2998b37f1a8d8a3\
&dataDiskOfferingUuids=cf8aa933d58230ee80a4181a66772d0b\
&dataDiskOfferingUuids=6a5ea214bc88372285ff3c301d64428c&clusterUuid=1f6b12b24aa03d4bb57f84a2df4a03f4Request Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| instanceOfferingUuid | String | query | Optional. The instance offering UUID. | 3.10.0 | |
| imageUuid | String | query | The image UUID. | 0.6 | |
| l3NetworkUuids | List | query | The L3 network list. | 0.6 | |
| rootDiskOfferingUuid | String | query | Optional. The disk offering of the root volume. This parameter is required only when the image type specified in imageUuid is ISO. | 0.6 | |
| dataDiskOfferingUuids | List | query | Optional. The disk offering list. | 0.6 | |
| zoneUuid | String | query | Optional. The zone UUID. | 0.6 | |
| clusterUuid | String | query | Optional. The cluster UUID. | 0.6 | |
| defaultL3NetworkUuid | String | query | Optional. The UUID of the default L3 network. | 0.6 | |
| cpuNum | int | body | Optional. The CPU count. | 3.10.0 | |
| memorySize | long | body | Optional. The memory size. Unit: Byte. | 3.10.0 | |
| systemTags | List | query | Optional. The system tags. | 0.6 | |
| userTags | List | query | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"zones": [
{
"uuid": "b145bc2ad8f14810a6eec0f28508ca14",
"name": "zone"
}
],
"clusters": [
{
"name": "cluster1",
"uuid": "49adbf0f48a14b899b0e6f7928556313",
"hypervisorType": "KVM",
"createDate": "May 11, 2017 1:23:06 PM",
"lastOpDate": "May 11, 2017 1:23:06 PM",
"zoneUuid": "b68fec24ba0f492c94c2e046072c16f0"
}
],
"hosts": [
{
"zoneUuid": "b145bc2ad8f14810a6eec0f28508ca14",
"name": "example",
"uuid": "e1a5cb10bcbc48b4ab6dd4e648ef5960",
"clusterUuid": "d5b32ea0ae1444d3b8b5a6b9d759af54",
"description": "example",
"managementIp": "192.168.0.1",
"hypervisorType": "KVM",
"state": "Enabled",
"status": "Connected",
"totalCpuCapacity": 4.0,
"availableCpuCapacity": 2.0,
"totalMemoryCapacity": 4.0,
"availableMemoryCapacity": 4.0,
"createDate": "May 11, 2017 1:23:06 PM",
"lastOpDate": "May 11, 2017 1:23:06 PM"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeds. | 0.6 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| zones | List | See zones. | 0.6 |
| clusters | List | See clusters. | 0.6 |
| hosts | List | See hosts. | 0.6 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#zones
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| state | String | 0.6 | |
| type | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
#clusters
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The resource name. | 0.6 |
| uuid | String | The resource UUID. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| state | String | The cluster state. | 0.6 |
| hypervisorType | String | The hypervisor type. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| zoneUuid | String | The zone UUID. | 0.6 |
| type | String | The reserved field. | 0.6 |
#hosts
| Name | Type | Description | Starting Version |
|---|---|---|---|
| zoneUuid | String | The zone UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| uuid | String | The resource UUID. | 0.6 |
| clusterUuid | String | The cluster UUID. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| managementIp | String | 0.6 | |
| hypervisorType | String | 0.6 | |
| state | String | 0.6 | |
| status | String | 0.6 | |
| totalCpuCapacity | Long | 0.6 | |
| availableCpuCapacity | Long | 0.6 | |
| totalMemoryCapacity | Long | 0.6 | |
| availableMemoryCapacity | Long | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
GetCandidateZonesClustersHostsForCreatingVmAction action = new GetCandidateZonesClustersHostsForCreatingVmAction();
action.instanceOfferingUuid = "f1569e619ba44cfeb264759df0720b19";
action.imageUuid = "57374e8324c34999ba81bd363a576653";
action.l3NetworkUuids = asList("dfac2b50c85a498780cf6d1828075e51");
action.dataDiskOfferingUuids = asList("bbe0af9d301e44d6b4605c6ed61f33d5","49f0cbfd2b694e5f9a5cf631f7dc219b");
action.clusterUuid = "0efc966199184f99982e9874186aab38";
action.sessionId = "5d04a0ac859746dea2f9cd81329e91ea";
GetCandidateZonesClustersHostsForCreatingVmAction.Result res = action.call();Python
SDK
GetCandidateZonesClustersHostsForCreatingVmAction action = GetCandidateZonesClustersHostsForCreatingVmAction()
action.instanceOfferingUuid = "6aef4e5bcf944af293096558effda40d"
action.imageUuid = "8a93ad62da8c436e8b79f37aae134bc6"
action.l3NetworkUuids = [3f1df9b106a04503bb1c7a68c7bddf75]
action.dataDiskOfferingUuids = [71817f0e5fa04e4e8ef5c035a0f84e67, ddb83b57bfc14aadb3df1ca6d40bfe04]
action.clusterUuid = "c910b625c0f94958a6a7e4ad3df15d34"
action.sessionId = "ae4cc6df99b14fb091a9b3779228709c"
GetCandidateZonesClustersHostsForCreatingVmAction.Result res = action.call()