Document navigation

CreateVmInstanceFromOvf

API Request

URLs
POST zstack/v1/ovf/create-vm-instance
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "xmlBase64": "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4KPEVudmVsb3BlIHhtbG5zPSJodHRwOi8vc2NoZW1hcy5kbXR",
    "jsonImageInfos": "[{\"ovfId\":\"vm-1-system.vmdk\",\"type\":\"Download\",\"installPath\":\"http://xxx/vm-1-system.vmdk\"}]",
    "backupStorageUuid": "3302f082e39d3ba8a246de74179e5512",
    "jsonCreateVmParam": "{\"name\":\"a\",\"clusterUuid\":\"e79b1a7be3183216a99874e942a7dd4a\",\"l3NetworkUuids\":[\"4f4b50d7cb6d3a9a944172b73653a593\"]}",
    "deleteImageAfterSuccess": true,
    "deleteImageOnFail": false
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, the userTags field is optional. This field can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"xmlBase64":"PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4KPEVudmVsb3BlIHhtbG5zPSJodHRwOi8vc2NoZW1hcy5kbXR","jsonImageInfos":"[{\"ovfId\":\"vm-1-system.vmdk\",\"type\":\"Download\",\"installPath\":\"http://xxx/vm-1-system.vmdk\"}]","backupStorageUuid":"3302f082e39d3ba8a246de74179e5512","jsonCreateVmParam":"{\"name\":\"a\",\"clusterUuid\":\"e79b1a7be3183216a99874e942a7dd4a\",\"l3NetworkUuids\":[\"4f4b50d7cb6d3a9a944172b73653a593\"]}","deleteImageAfterSuccess":true,"deleteImageOnFail":false}}' http://localhost:8080/zstack/v1/ovf/create-vm-instance
Parameters
Name Type Location Description Optional Value Starting Version
xmlBase64 String body(contained in the paramsstructure) The resource name. 4.4.6
jsonImageInfos String body(contained in the paramsstructure) The JSON string that describes the relationship between disk ID and the image file. 4.4.6
backupStorageUuid String body(contained in the paramsstructure) The UUID of the backup storage that stores the uploaded image file. 4.4.6
jsonCreateVmParam String body(contained in the paramsstructure) The JSON string that contains the parameters used to create a VM instance. 4.4.6
deleteImageAfterSuccess boolean body(contained in the paramsstructure) Optional. Specifies whether to delete the image file after the deployment is completed. 4.4.6
deleteImageOnFail boolean body(contained in the paramsstructure) Optional. Specifies whether to delete the image file after the deployment fails. 4.4.6
resourceUuid String body(contained in the paramsstructure) Optional. The resource UUID. 4.4.6
tagUuids List body(contained in the paramsstructure) Optional. The tag UUIDs. 4.4.6
systemTags List body Optional. The system tags. 4.4.6
userTags List body Optional. The user tags. 4.4.6

API Response

Sample Response
{
  "inventory": {
    "uuid": "ef8b74d3a7f931c3aacf258c20d25411",
    "name": "test-ovf",
    "description": "web server VM",
    "zoneUuid": "5f3cdedd4a823bfcadd45385f034b763",
    "clusterUuid": "2bb23d2c0a013338add7cedf2615ac39",
    "imageUuid": "f47e5dbf886e3d16b8097294efd63b37",
    "hostUuid": "82bad7cada82377684459e59292937b4",
    "lastHostUuid": "00e742c03afe3cd68234aa9c9352d5a7",
    "instanceOfferingUuid": "a9a166f625e23886a7227bdb472da645",
    "rootVolumeUuid": "3e92e577418835a3bfeb0d770e898052",
    "platform": "Linux",
    "defaultL3NetworkUuid": "e4f37ede6e563fe5943ae8b8c7c008d6",
    "type": "UserVm",
    "hypervisorType": "KVM",
    "memorySize": 4.294967296E9,
    "cpuNum": 4.0,
    "allocatorStrategy": "LastHostPreferredAllocatorStrategy",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM",
    "state": "Running",
    "vmNics": [
      {
        "uuid": "d5a26fdfdcff30748b22b85f4d7fadbe",
        "vmInstanceUuid": "ef8b74d3a7f931c3aacf258c20d25411",
        "usedIpUuid": "4423412a12653cb3af73231e16e526cf",
        "l3NetworkUuid": "e4f37ede6e563fe5943ae8b8c7c008d6",
        "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 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ],
    "allVolumes": [
      {
        "uuid": "3e92e577418835a3bfeb0d770e898052",
        "name": "Root-Volume-For-VM-ef8b74d3a7f931c3aacf258c20d25411",
        "primaryStorageUuid": "353a440b83283acca73e3d3fd2cca0c5",
        "vmInstanceUuid": "ef8b74d3a7f931c3aacf258c20d25411",
        "diskOfferingUuid": "323969fdd2273f1a8e42aef10a9e8c6b",
        "rootImageUuid": "f47e5dbf886e3d16b8097294efd63b37",
        "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-3e92e577418835a3bfeb0d770e898052/3e92e577418835a3bfeb0d770e898052.qcow2",
        "type": "Root",
        "format": "qcow2",
        "size": 1.073741824E11,
        "actualSize": 2.147483648E10,
        "deviceId": 0.0,
        "state": "Enabled",
        "status": "Ready",
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ]
  }
}
Name Type Description Starting Version
success boolean 4.4.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.4.6
inventory VmInstanceInventory See inventory. 4.4.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.4.6
description String The brief description of the error. 4.4.6
details String The details about the error. 4.4.6
elaboration String The reserved field. Default value: null. 4.4.6
opaque LinkedHashMap The reserved field. Default value: null. 4.4.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.4.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 4.4.6
name String The resource name. 4.4.6
description String The resource description. 4.4.6
zoneUuid String The zone UUID. 4.4.6
clusterUuid String The cluster UUID. 4.4.6
imageUuid String The image UUID. 4.4.6
hostUuid String The host UUID. 4.4.6
lastHostUuid String 4.4.6
instanceOfferingUuid String The instance offering UUID. 4.4.6
rootVolumeUuid String The root volume UUID. 4.4.6
platform String 4.4.6
architecture String 4.4.6
defaultL3NetworkUuid String 4.4.6
type String 4.4.6
hypervisorType String 4.4.6
memorySize Long 4.4.6
cpuNum Integer 4.4.6
cpuSpeed Long 4.4.6
allocatorStrategy String 4.4.6
createDate Timestamp The creation time. 4.4.6
lastOpDate Timestamp The last operation time. 4.4.6
state String 4.4.6
guestOsType String 4.4.6
vmNics List See vmNics. 4.4.6
allVolumes List See allVolumes. 4.4.6
vmCdRoms List See vmCdRoms. 4.4.6
#vmNics
Name Type Description Starting Version
uuid String The resource UUID. 4.4.6
vmInstanceUuid String The VM UUID. 4.4.6
l3NetworkUuid String The L3 network UUID. 4.4.6
ip String The IP address. 4.4.6
mac String The MAC address. 4.4.6
hypervisorType String The hypervisor type. 4.4.6
netmask String The netmask. 4.4.6
gateway String The gateway. 4.4.6
metaData String 4.4.6
ipVersion Integer The IP version. 4.4.6
driverType String 4.4.6
internalName String 4.4.6
deviceId Integer The device ID. 4.4.6
type String The NIC type. 4.4.6
createDate Timestamp The creation time. 4.4.6
lastOpDate Timestamp The last operation time. 4.4.6
usedIps List See usedIps. 4.4.6
#usedIps
Name Type Description Starting Version
uuid String The resource UUID. 4.4.6
ipRangeUuid String The IP range UUID. 4.4.6
l3NetworkUuid String The L3 network UUID. 4.4.6
ipVersion Integer The IP version. 4.4.6
ip String The IP address. 4.4.6
netmask String The netmask. 4.4.6
gateway String The gateway. 4.4.6
usedFor String 4.4.6
ipInLong long 4.4.6
vmNicUuid String The NIC UUID. 4.4.6
createDate Timestamp The creation time. 4.4.6
lastOpDate Timestamp The last operation time. 4.4.6
#allVolumes
Name Type Description Starting Version
uuid String The resource UUID. 4.4.6
name String The resource name. 4.4.6
description String The resource description. 4.4.6
primaryStorageUuid String The primary storage UUID. 4.4.6
vmInstanceUuid String The VM UUID. 4.4.6
diskOfferingUuid String The disk offering UUID. 4.4.6
rootImageUuid String The root volume image UUID. 4.4.6
installPath String The installation path. 4.4.6
type String The volume type. 4.4.6
format String The volume format. 4.4.6
size Long The virtual size of the volume. 4.4.6
actualSize Long The actual size of the volume. 4.4.6
deviceId Integer The device ID. 4.4.6
state String The state of the volume. 4.4.6
status String The status of the volume. 4.4.6
createDate Timestamp The creation time. 4.4.6
lastOpDate Timestamp The last operation time. 4.4.6
isShareable Boolean Whether the volume can be shared. 4.4.6
volumeQos String The volume QoS. 4.4.6
#vmCdRoms
Name Type Description Starting Version
uuid String The resource UUID. 4.4.6
vmInstanceUuid String The VM UUID. 4.4.6
deviceId Integer 4.4.6
isoUuid String 4.4.6
isoInstallPath String 4.4.6
name String The resource name. 4.4.6
description String The resource description. 4.4.6
createDate Timestamp The creation time. 4.4.6
lastOpDate Timestamp The last operation time. 4.4.6

SDK Sample

Java SDK
CreateVmInstanceFromOvfAction action = new CreateVmInstanceFromOvfAction();
action.xmlBase64 = "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4KPEVudmVsb3BlIHhtbG5zPSJodHRwOi8vc2NoZW1hcy5kbXR";
action.jsonImageInfos = "[{"ovfId":"vm-1-system.vmdk","type":"Download","installPath":"http://xxx/vm-1-system.vmdk"}]";
action.backupStorageUuid = "3302f082e39d3ba8a246de74179e5512";
action.jsonCreateVmParam = "{"name":"a","clusterUuid":"e79b1a7be3183216a99874e942a7dd4a","l3NetworkUuids":["4f4b50d7cb6d3a9a944172b73653a593"]}";
action.deleteImageAfterSuccess = true;
action.deleteImageOnFail = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmInstanceFromOvfAction.Result res = action.call();
Python SDK
CreateVmInstanceFromOvfAction action = CreateVmInstanceFromOvfAction()
action.xmlBase64 = "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4KPEVudmVsb3BlIHhtbG5zPSJodHRwOi8vc2NoZW1hcy5kbXR"
action.jsonImageInfos = "[{"ovfId":"vm-1-system.vmdk","type":"Download","installPath":"http://xxx/vm-1-system.vmdk"}]"
action.backupStorageUuid = "3302f082e39d3ba8a246de74179e5512"
action.jsonCreateVmParam = "{"name":"a","clusterUuid":"e79b1a7be3183216a99874e942a7dd4a","l3NetworkUuids":["4f4b50d7cb6d3a9a944172b73653a593"]}"
action.deleteImageAfterSuccess = true
action.deleteImageOnFail = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVmInstanceFromOvfAction.Result res = action.call()
API Reference | 5.5.30 | ZStack Cloud · ZCF | ZStack Resource Center