CreateVmInstance
CreateVmInstance
Execution Availability
Try It Out
Submit a mock request using the current auth context and example-driven inputs.
Request Inputs
Body Fields
paramsObjectRequiredRequest body parameter object.
nameStringRequiredThe VM instance name.
instanceOfferingUuidStringRequiredThe instance offering UUID. Specifies the CPU, memory, and other parameters of the VM instance.
imageUuidStringRequiredThe image UUID. Specifies the image from which the root volume of the VM instance is created.
l3NetworkUuidsListRequiredThe L3 network UUID list. You can specify one or more L3 networks. Then the VM instance will create a NIC on each network.
typeStringOptional. The VM instance type. This parameter is a reserved field for internal use.
rootDiskOfferingUuidStringOptional. The disk offering UUID of the root volume. If the image type specified in imageUuid is ISO, you must specify rootDiskOfferingUuid to determine the size of the root volume to be created. If the image type is not ISO, this parameter is optional.
dataDiskSizesListOptional. List of custom volume sizes. You can specify one or more volume sizes (repeatable) to create one or more data volumes for the VM instances.
dataDiskOfferingUuidsListOptional. The disk offering UUID list. You can specify one or more disk offering UUIDs to create one or more data volumes for the VM instance. (The UUIDs can be repeated.)
zoneUuidStringOptional. The zone UUID. If specified, the VM instance will be created in the specified zone.
clusterUuidStringOptional. The cluster UUID. If specified, the VM instance will be created in the specified cluster. This parameter can override zoneUuid.
hostUuidStringOptional. The host UUID. If specified, the VM instance will be created on the specified host. This parameter can override zoneUuid and clusterUuid.
primaryStorageUuidForRootVolumeStringOptional. The primary storage UUID. If specified, the root volume of the VM instance will be created on the specified primary storage.
descriptionStringOptional. The detailed description of the VM instance.
defaultL3NetworkUuidStringOptional. The UUID of the default L3 network. If multiple L3 networks are specified in l3NetworkUuids, this parameter specifies the L3 network that provides default routing. If not specified, the first network specified in l3NetworkUuids will be used as the default network.
resourceUuidStringOptional. The resource UUID. If specified, the VM instance will use the specified value as UUID.
tagUuidsListOptional. The tag UUID list.
strategyStringOptional. The VM instance creation strategy. Start the VM instance immediately after creation. Do not start the VM instance after creation.
dataVolumeSystemTagsOnIndexMapOptional. The required system label mapping requited for data volume index.
systemTagsListOptional. The system tags of the VM instance.
userTagsListOptional. The user tags of the VM instance.
Responses
Endpoint
POST/zstack/v1/vm-instances
/zstack/v1/vm-instances
Request Example
curl -X POST 'http://{host}/zstack/v1/vm-instances' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"params":{"name":"<name>","instanceOfferingUuid":"<instanceOfferingUuid>","imageUuid":"<imageUuid>","l3NetworkUuids":["<l3NetworkUuids>"],"type":"<type>","rootDiskOfferingUuid":"<rootDiskOfferingUuid>","dataDiskSizes":["<dataDiskSizes>"],"dataDiskOfferingUuids":["<dataDiskOfferingUuids>"],"zoneUuid":"<zoneUuid>","clusterUuid":"<clusterUuid>","hostUuid":"<hostUuid>","primaryStorageUuidForRootVolume":"<primaryStorageUuidForRootVolume>","description":"<description>","defaultL3NetworkUuid":"<defaultL3NetworkUuid>","resourceUuid":"<resourceUuid>","tagUuids":["<tagUuids>"],"strategy":"<strategy>","dataVolumeSystemTagsOnIndex":{}},"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'
Response Example
200{ "inventory": { "uuid": "6efab7159c6932429c6b0e7e0b64b660", "name": "Test-VM", "description": "web server VM", "zoneUuid": "d10bd7a9565138efaf6171db8e18fa7d", "clusterUuid": "692c71639d873bf6a356cd8e285d0d9c", "imageUuid": "28061e65e48037eda71b53a0732bf087", "hostUuid": "f877177de7bd377e811bc6313878b2b1", "lastHostUuid": "a3ccdc90a600334f994c69aee4270ac5", "instanceOfferingUuid": "9a874241f867333ca0bf0ab2134f8515", "rootVolumeUuid": "f52d7c94d69d3bbb97d36a270fe910c3", "platform": "Linux", "defaultL3NetworkUuid": "2ac1b70fdb0f38769a29c6ebd0262cca", "type": "UserVm", "hypervisorType": "KVM", "memorySize": 8.589934592E9, "cpuNum": 1.0, "allocatorStrategy": "LastHostPreferredAllocatorStrategy", "createDate": "Nov 14, 2017 10:20:57 PM", "lastOpDate": "Nov 14, 2017 10:20:57 PM", "state": "Running", "vmNics": [ { "uuid": "0dfbb8a297e9349ea8799c4ce48c6d10", "vmInstanceUuid": "6efab7159c6932429c6b0e7e0b64b660", "usedIpUuid": "39b57596a8ba35289bd9f40efceeae03", "l3NetworkUuid": "2ac1b70fdb0f38769a29c6ebd0262cca", "ip": "192.168.1.10", "mac": "00:0c:29:bd:99:fc", "netmask": "255.255.255.0", "gateway": "192.168.1.1", "deviceId": 0.0, "createDate": "Nov 14, 2017 10:20:57 PM", "lastOpDate": "Nov 14, 2017 10:20:57 PM" } ], "allVolumes": [ { "uuid": "f52d7c94d69d3bbb97d36a270fe910c3", "name": "Root-Volume-For-VM-6efab7159c6932429c6b0e7e0b64b660", "primaryStorageUuid": "4ed5bbb150a034b5917e7e6c9c4b8170", "vmInstanceUuid": "6efab7159c6932429c6b0e7e0b64b660", "diskOfferingUuid": "0521187274d73f5b936c22b145384c74", "rootImageUuid": "28061e65e48037eda71b53a0732bf087", "installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-f52d7c94d69d3bbb97d36a270fe910c3/f52d7c94d69d3bbb97d36a270fe910c3.qcow2", "type": "Root", "format": "qcow2", "size": 1.073741824E11, "actualSize": 2.147483648E10, "deviceId": 0.0, "state": "Enabled", "status": "Ready", "createDate": "Nov 14, 2017 10:20:57 PM", "lastOpDate": "Nov 14, 2017 10:20:57 PM" } ] } }Change History
This API has no change history records yet.
