Create Cluster

POST/zstack/v1/clusters

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "zoneUuid": "d5629a75f0a24280ac669d93d38a7dcd",
    "name": "cluster1",
    "description": "test",
    "hypervisorType": "KVM"
  },
  "systemTags": [],
  "userTags": []
}

In the above example, systemTags and userTags fields can be omitted. They are listed to indicate that these two fields can be included in the body.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"zoneUuid":"e1fb7d87073b397c857eaeeb16243103","name":"cluster1","description":"test","hypervisorType":"KVM"}}' \
http://localhost:8080/zstack/v1/clusters

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

zoneUuid

String

body (contained in params structure)

Data Center UUID

 

0.6

name

String

body (contained in params structure)

Resource name

 

0.6

description (optional)

String

body (contained in params structure)

Resource description

 

0.6

hypervisorType

String

body (contained in params structure)

Hypervisor type

  • KVM
  • Simulator

4.0.0

type (optional)

String

body (contained in params structure)

Reserved field. Do not use.

  • zstack

0.6

resourceUuid (optional)

String

body (contained in params structure)

  • When resourceUuid is not null, the virtualization platform uses this value as the UUID of the resource being created;
  • Otherwise, the virtualization platform automatically generates a UUID

 

0.6

architecture (optional)

String

body (contained in params structure)

 

  • x86_64
  • aarch64
  • mips64el

4.0.0

tagUuids (optional)

List

body (contained in params structure)

 

 

4.0.0

systemTags (optional)

List

body

System tag

 

0.6

userTags (optional)

List

body

User tag

 

0.6

API Response

Response Example

{
  "inventory": {
    "name": "cluster1",
    "uuid": "dc7442bb39674d779d688369329ba845",
    "description": "test",
    "state": "Enabled",
    "hypervisorType": "KVM",
    "createDate": "Jun 7, 2017 9:20:31 PM",
    "lastOpDate": "Jun 7, 2017 9:20:31 PM",
    "zoneUuid": "342b68c14869412984d6327a58b18f9b",
    "type": "zstack"
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeError code. If not null, the operation failed. If null, the operation succeeded. See details error0.6
inventoryClusterInventorySee details inventory0.6

error

NameTypeDescriptionStarting Version
codeStringError code number, globally unique identifier of the error, e.g. SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, default is null0.6
opaqueLinkedHashMapReserved field, default is null0.6
causeErrorCodeRoot cause, the error that caused the current error. If there is no original error, this field is null0.6

inventory

NameTypeDescriptionStarting Version
nameStringResource name0.6
uuidStringResource UUID, uniquely identifies the resource0.6
descriptionStringResource description0.6
stateStringCluster state0.6
hypervisorTypeStringHypervisor type0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6
zoneUuidStringData Center UUID0.6
typeStringReserved field0.6

SDK Examples

Java SDK

CreateClusterAction action = new CreateClusterAction();
action.zoneUuid = "70fd596da027478eb22ac9357aed23f4";
action.name = "cluster1";
action.description = "test";
action.hypervisorType = "KVM";
action.sessionId = "894477861bcc45488978b584908e4ee3";
CreateClusterAction.Result res = action.call();

Python SDK

CreateClusterAction action = CreateClusterAction()
action.zoneUuid = "cfe698802c87486986878daa2da7e02f"
action.name = "cluster1"
action.description = "test"
action.hypervisorType = "KVM"
action.sessionId = "0664130c5d36414bbb3a7a59ef87ea5a"
CreateClusterAction.Result res = action.call()