Skip to main content
Resource Center/Resource Pool/VM Instance Operations
POSTVM Instance OperationsSince 0.6SynchronousAuth Required

CreateVmInstance

CreateVmInstance

Execution Availability

Try It Out

Submit a mock request using the current auth context and example-driven inputs.

Request Inputs

Body Fields

  • paramsObjectRequired

    Request body parameter object.

    • nameStringRequired

      The VM instance name.

    • instanceOfferingUuidStringRequired

      The instance offering UUID. Specifies the CPU, memory, and other parameters of the VM instance.

    • imageUuidStringRequired

      The image UUID. Specifies the image from which the root volume of the VM instance is created.

    • l3NetworkUuidsListRequired

      The L3 network UUID list. You can specify one or more L3 networks. Then the VM instance will create a NIC on each network.

    • typeString

      Optional. The VM instance type. This parameter is a reserved field for internal use.

    • rootDiskOfferingUuidString

      Optional. 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.

    • dataDiskSizesList

      Optional. 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.

    • dataDiskOfferingUuidsList

      Optional. 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.)

    • zoneUuidString

      Optional. The zone UUID. If specified, the VM instance will be created in the specified zone.

    • clusterUuidString

      Optional. The cluster UUID. If specified, the VM instance will be created in the specified cluster. This parameter can override zoneUuid.

    • hostUuidString

      Optional. The host UUID. If specified, the VM instance will be created on the specified host. This parameter can override zoneUuid and clusterUuid.

    • primaryStorageUuidForRootVolumeString

      Optional. The primary storage UUID. If specified, the root volume of the VM instance will be created on the specified primary storage.

    • descriptionString

      Optional. The detailed description of the VM instance.

    • defaultL3NetworkUuidString

      Optional. 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.

    • resourceUuidString

      Optional. The resource UUID. If specified, the VM instance will use the specified value as UUID.

    • tagUuidsList

      Optional. The tag UUID list.

    • strategyString

      Optional. The VM instance creation strategy. Start the VM instance immediately after creation. Do not start the VM instance after creation.

    • dataVolumeSystemTagsOnIndexMap

      Optional. The required system label mapping requited for data volume index.

  • systemTagsList

    Optional. The system tags of the VM instance.

  • userTagsList

    Optional. The user tags of the VM instance.

Responses

200 OK

On success, this API returns the following response structure.

  • errorErrorCodeRequired

    The error code. If not null, the operation fails, or vice versa. For more information, see error.

    • codeStringRequired

      The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001.

    • descriptionStringRequired

      The brief description of the error.

    • detailsStringRequired

      The details about the error.

    • elaborationStringRequired

      The reserved field. Default value: null.

    • opaqueLinkedHashMapRequired

      The reserved field. Default value: null.

    • causeErrorCodeRequired

      The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null.

  • inventoryVmInstanceInventoryRequired

    See inventory.

    • uuidStringRequired

      The resource UUID.

    • nameStringRequired

      The resource name.

    • descriptionStringRequired

      The detailed description of the resource.

    • zoneUuidStringRequired

      The zone UUID.

    • clusterUuidStringRequired

      The cluster UUID.

    • imageUuidStringRequired

      The image UUID.

    • hostUuidStringRequired

      The host UUID.

    • lastHostUuidStringRequired

      The UUID of the host on which the VM instance was running last time.

    • instanceOfferingUuidStringRequired

      The instance offering UUID.

    • rootVolumeUuidStringRequired

      The root volume UUID.

    • platformStringRequired

      The platform on which the VM instance is running.

    • defaultL3NetworkUuidStringRequired

      The UUID of the default L3 network.

    • typeStringRequired

      The VM instance type.

    • hypervisorTypeStringRequired

      The hypervisor type of the VM instance.

    • memorySizeLongRequired

      The memory size.

    • cpuNumIntegerRequired

      The CPU count.

    • cpuSpeedLongRequired

      The CPU speed.

    • allocatorStrategyStringRequired

      The allocator strategy.

    • createDateTimestampRequired

      The creation date.

    • lastOpDateTimestampRequired

      The last operation date.

    • stateStringRequired

      The state of the VM instance.

    • vmNicsListRequired

      See vmNics.

      • uuidStringRequired

        The resource UUID.

      • vmInstanceUuidStringRequired

        The VM instance UUID.

      • l3NetworkUuidStringRequired

        The L3 network UUID.

      • ipStringRequired

        The IP address.

      • macStringRequired

        The MAC address.

      • netmaskStringRequired

        The netmask.

      • gatewayStringRequired

        The gateway.

      • metaDataStringRequired

        The reserved field for internal use.

      • deviceIdIntegerRequired

        The device ID. An integer that indicates the order of NICs in the Ethernet device of the guest operating system. For example, 0 usually means eth0, and 1 usually means eth1.

      • createDateTimestampRequired

        The creation date.

      • lastOpDateTimestampRequired

        The last operation date.

    • allVolumesListRequired

      See allVolumes.

      • uuidStringRequired

        The resource UUID.

      • nameStringRequired

        The resource name.

      • descriptionStringRequired

        The detailed description of the resource.

      • primaryStorageUuidStringRequired

        The primary storage UUID.

      • vmInstanceUuidStringRequired

        The VM instance UUID.

      • diskOfferingUuidStringRequired

        The disk offering UUID.

      • rootImageUuidStringRequired

        The UUID of the root volume image.

      • installPathStringRequired

        The installation path.

      • typeStringRequired

        The volume type.

      • formatStringRequired

        The volume format.

      • sizeLongRequired

        The virtual size of the volume.

      • actualSizeLongRequired

        The actual size of the volume.

      • deviceIdIntegerRequired

        The device ID.

      • stateStringRequired

        The state of the volume.

      • statusStringRequired

        The status of the volume.

      • createDateTimestampRequired

        The creation date.

      • lastOpDateTimestampRequired

        The last operation date.

      • isShareableBooleanRequired

        Whether the volume can be shared.

Endpoint

POST/zstack/v1/vm-instances

/zstack/v1/vm-instances

Operation ID

CreateVmInstance

Permalink

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.

View all change history