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

CreateVmInstanceFromVolume

CreateVmInstanceFromVolume

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 resource name.

    • descriptionString

      Optional. The detailed description of the resource.

    • instanceOfferingUuidString

      Optional. The instance offering UUID. Note: This parameter is optional if you choose the CPU number and memory size.

    • cpuNumInteger

      Optional. The CPU number or memory size. Note: This parameter is optional if you choose instanceOfferingUuid.

    • memorySizeLong

      内存大小,单位为Byte,该参数与instanceOfferingUuid二选一

    • l3NetworkUuidsListRequired

      The L3 network UUID. Specifies one or more L3 networks. The VM instance will create one NIC on each L3 network.

    • typeString

      Optional. The VM type. The reserved field, which is no need to specify.

    • volumeUuidStringRequired

      The volume UUID.

    • platformString

      Optional. The volume system platform.

    • zoneUuidString

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

    • clusterUuidString

      Optional. The cluster UUID. If specified, the VM instance will be created in the specified cluster. The resource priority of this parameter is higher than zoneUuid.

    • hostUuidString

      Optional. The host UUID. If specified, the VM instance will be created in the specified host. The resource priority of this parameter is higher than zoneUuid and clusterUuid.

    • primaryStorageUuidString

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

    • defaultL3NetworkUuidString

      Optional. The default L3 network UUID. When l3NetworkUuids specifies multiple L3 networks, this parameter specifies to provide the default L3 network. If not specified, the first network of l3NetworkUuids will be selected as the default network.

    • strategyString

      Optional. The VM creation strategy. After the VM instance is created, the VM instance is started immediately. After the VM instance is created, the VM instance will not be started.

    • resourceUuidString

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

    • tagUuidsList

      Optional. The tag UUID list.

  • systemTagsList

    Optional. The system tags.

  • userTagsList

    Optional. The user tags.

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

      最近一次主机UUID。

    • instanceOfferingUuidStringRequired

      The instance offering UUID.

    • rootVolumeUuidStringRequired

      The root volume UUID.

    • platformStringRequired

      平台。

    • defaultL3NetworkUuidStringRequired

      No description provided.

    • typeStringRequired

      类型。

    • hypervisorTypeStringRequired

      No description provided.

    • memorySizeLongRequired

      内存大小。

    • cpuNumIntegerRequired

      No description provided.

    • cpuSpeedLongRequired

      No description provided.

    • allocatorStrategyStringRequired

      No description provided.

    • createDateTimestampRequired

      The creation date.

    • lastOpDateTimestampRequired

      The last operation date.

    • stateStringRequired

      当前状态。

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

      • hypervisorTypeStringRequired

        The hypervisor type.

      • netmaskStringRequired

        The netmask.

      • gatewayStringRequired

        The gateway.

      • metaDataStringRequired

        The reserved field for internal use.

      • ipVersionIntegerRequired

        The IP version.

      • deviceIdIntegerRequired

        The device ID.

      • createDateTimestampRequired

        The creation date.

      • lastOpDateTimestampRequired

        The last operation date.

      • usedIpsListRequired

        See usedIps .

        • uuidStringRequired

          The resource UUID.

        • ipRangeUuidStringRequired

          The IP range UUID.

        • l3NetworkUuidStringRequired

          The L3 network UUID.

        • ipVersionIntegerRequired

          The IP version.

        • ipStringRequired

          The IP address.

        • netmaskStringRequired

          The netmask.

        • gatewayStringRequired

          The gateway.

        • usedForStringRequired

          已使用用于。

        • ipInLonglongRequired

          No description provided.

        • vmNicUuidStringRequired

          The VM NIC UUID .

        • 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 root image UUID.

      • installPathStringRequired

        The installation path of volume in the primary storage.

      • typeStringRequired

        The volume type, including data volume and root volume.

      • formatStringRequired

        The volume format.

      • sizeLongRequired

        The volume size.

      • actualSizeLongRequired

        The actual volume size.

      • deviceIdIntegerRequired

        设备ID。

      • stateStringRequired

        Whether the volume is enabled.

      • statusStringRequired

        The volume status.

      • createDateTimestampRequired

        The creation date.

      • lastOpDateTimestampRequired

        The last operation date.

      • isShareableBooleanRequired

        Whether the volume is shared.

      • volumeQosStringRequired

        The volume QoS. Format: total=1048576.

Endpoint

POST/zstack/v1/vm-instances/from/volume

/zstack/v1/vm-instances/from/volume

Operation ID

CreateVmInstanceFromVolume

Permalink

Request Example

curl -X POST 'http://{host}/zstack/v1/vm-instances/from/volume' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"params":{"name":"<name>","description":"<description>","instanceOfferingUuid":"<instanceOfferingUuid>","cpuNum":1,"memorySize":1,"l3NetworkUuids":["<l3NetworkUuids>"],"type":"<type>","volumeUuid":"<volumeUuid>","platform":"<platform>","zoneUuid":"<zoneUuid>","clusterUuid":"<clusterUuid>","hostUuid":"<hostUuid>","primaryStorageUuid":"<primaryStorageUuid>","defaultL3NetworkUuid":"<defaultL3NetworkUuid>","strategy":"<strategy>","resourceUuid":"<resourceUuid>","tagUuids":["<tagUuids>"]},"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

Response Example

200
{ "inventory": { "uuid": "33614668ae7d386c91d662928f60b23f", "name": "Test-VM", "description": "web server VM", "zoneUuid": "62f048b02e353ba4bdb9184ad7f54170", "clusterUuid": "ff753adc06c83d5ab2b0291f57b4745a", "imageUuid": "9291412f184f37a284b484b0788b24ca", "hostUuid": "0f9f5c6561d733d18a94577c4cd0976f", "lastHostUuid": "dc452dde2f7832b29bf91a0ddb6a004c", "instanceOfferingUuid": "b35adab33ba139b98ee20c1e2be702d3", "rootVolumeUuid": "f54fc6d488133688a6a7635f5c44a288", "platform": "Linux", "defaultL3NetworkUuid": "d82e3c622f933054a1939fb66e07681e", "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": "16198ebdef9c3f8084acd1a919eff4f2", "vmInstanceUuid": "33614668ae7d386c91d662928f60b23f", "usedIpUuid": "8eb3618f949a3e588acf9d8b0ee8293f", "l3NetworkUuid": "d82e3c622f933054a1939fb66e07681e", "ip": "192.168.1.10", "mac": "00:0c:29:bd:99:fc", "hypervisorType": "KVM", "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": "f54fc6d488133688a6a7635f5c44a288", "name": "Root-Volume-For-VM-33614668ae7d386c91d662928f60b23f", "primaryStorageUuid": "769061e63aec3278b1e6c3619d6da766", "vmInstanceUuid": "33614668ae7d386c91d662928f60b23f", "rootImageUuid": "9291412f184f37a284b484b0788b24ca", "installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-f54fc6d488133688a6a7635f5c44a288/f54fc6d488133688a6a7635f5c44a288.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