VM Related Interfaces

Create Virtual Machine Custom Specification

POST/zstack/v1/vm-custom-specifications

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "custom-specification-for-vm-1",
    "description": "Test",
    "platform": "Windows",
    "hostname": "vm-1",
    "rootPassword": "password",
    "generateSID": true,
    "domainMode": "Domain",
    "domainName": "zsv.test",
    "domainUsername": "administrator",
    "domainPassword": "password",
    "organization": "OU=zsv,DC=zsv,DC=test"
  },
  "systemTags": [],
  "userTags": []
}

In the example above, 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":{"name":"custom-specification-for-vm-1","description":"Test","platform":"Windows","hostname":"vm-1","rootPassword":"password","generateSID":true,"domainMode":"Domain","domainName":"zsv.test","domainUsername":"administrator","domainPassword":"password","organization":"OU=zsv,DC=zsv,DC=test"}}' \
http://localhost:8080/zstack/v1/vm-custom-specifications

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

name

String

body(included in the params structure)

Resource name

 

4.10.18

description (Optional)

String

body(included in the params structure)

Detailed description of the resource

 

4.10.18

platform

String

body(included in the params structure)

Virtual Machine Operating System Platform Type

  • Linux
  • Windows
  • WindowsVirtio
  • Other
  • Paravirtualization

4.10.18

hostname (Optional)

String

body(included in the params structure)

Host Name

 

4.10.18

rootPassword (Optional)

String

body(included in the params structure)

Administrator Password

 

4.10.18

generateSID (Optional)

Boolean

body(included in the params structure)

Whether to Generate SID

 

4.10.18

domainMode (Optional)

String

body(included in the params structure)

Domain Join Mode

  • WorkGroup
  • Domain

4.10.18

domainName (Optional)

String

body(included in the params structure)

Domain Name or Workgroup Name

 

4.10.18

domainUsername (Optional)

String

body(included in the params structure)

Domain Username

 

4.10.18

domainPassword (Optional)

String

body(included in the params structure)

Domain User Password

 

4.10.18

organization (Optional)

String

body(included in the params structure)

Organization Unit

 

4.10.18

resourceUuid (Optional)

String

body(included in the params structure)

Resource UUID

 

4.10.18

tagUuids (Optional)

List

body(included in the params structure)

Tag UUID List

 

4.10.18

systemTags (Optional)

List

body

System Tag

 

4.10.18

userTags (Optional)

List

body

User Tag

 

4.10.18

API Response

Response Example

{
  "inventory": {
    "uuid": "ff0a9e874342368bb28daaf2c9b3cc00",
    "vmInstanceUuid": "ff01ec80fd11327cba7519b66119d900",
    "name": "custom-specification-for-vm-1",
    "description": "Test",
    "platform": "Windows",
    "hostname": "vm-1",
    "rootPassword": "password",
    "generateSID": true,
    "domainMode": "Domain",
    "domainName": "zsv.test",
    "domainUsername": "test",
    "domainPassword": "password",
    "organization": "OU=zsv,DC=zsv,DC=test"
  }
}
NameTypeDescriptionStarting Version
successbooleanWhether the request is successful4.10.18
inventoryVmCustomSpecificationInventoryFor details, see inventory4.10.18
errorErrorCodeFor details, see error4.10.18

inventory

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifying the resource4.10.18
vmInstanceUuidStringVirtual Machine UUID4.10.18
nameStringResource name4.10.18
descriptionStringDetailed description of the resource4.10.18
platformStringVirtual Machine Operating System Platform Type4.10.18
hostnameStringHost Name4.10.18
generateSIDBooleanWhether to Generate SID4.10.18
domainNameStringDomain Name or Workgroup Name4.10.18
domainUsernameStringDomain Username4.10.18
organizationStringOrganization Unit4.10.18
createDateTimestampCreate time4.10.18
lastOpDateTimestampLast modification time4.10.18
domainModeVmCustomSpecificationDomainModeFor details, see domainMode4.10.18

domainMode

NameTypeDescriptionStarting Version
WorkGroupVmCustomSpecificationDomainModeWorkgroup4.10.18
DomainVmCustomSpecificationDomainModeDomain4.10.18

error

NameTypeDescriptionStarting Version
codeStringError code number, globally unique identifier of the error, for example 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 source error that triggered the current error. If there is no original error, this field is null0.6

SDK Examples

Java SDK

CreateVmCustomSpecificationAction action = new CreateVmCustomSpecificationAction();
action.name = "custom-specification-for-vm-1";
action.description = "Test";
action.platform = "Windows";
action.hostname = "vm-1";
action.rootPassword = "password";
action.generateSID = true;
action.domainMode = "Domain";
action.domainName = "zsv.test";
action.domainUsername = "administrator";
action.domainPassword = "password";
action.organization = "OU=zsv,DC=zsv,DC=test";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmCustomSpecificationAction.Result res = action.call();

Python SDK

action = CreateVmCustomSpecificationAction()
action.name = "custom-specification-for-vm-1"
action.description = "Test"
action.platform = "Windows"
action.hostname = "vm-1"
action.rootPassword = "password"
action.generateSID = true
action.domainMode = "Domain"
action.domainName = "zsv.test"
action.domainUsername = "administrator"
action.domainPassword = "password"
action.organization = "OU=zsv,DC=zsv,DC=test"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()