Create VM from Backup

POST/zstack/v1/vm-instances/from/vm-backup/{backupUuid}

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "vm1",
    "instanceOfferingUuid": "31d2057b670d3c32a6970e519b514f12",
    "l3NetworkUuids": [
      "87b522f02ef83627bcab5e427ba2d5e6"
    ],
    "clusterUuid": "255b14070a533fb5ad9a845d4c50508a",
    "description": "this is a vm",
    "strategy": "InstantStart"
  },
  "systemTags": [],
  "userTags": []
}

The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"vm1","instanceOfferingUuid":"31d2057b670d3c32a6970e519b514f12","l3NetworkUuids":["87b522f02ef83627bcab5e427ba2d5e6"],"clusterUuid":"255b14070a533fb5ad9a845d4c50508a","description":"this is a vm","strategy":"InstantStart"}}' \
http://localhost:8080/zstack/v1/vm-instances/from/vm-backup/b3ecd20a4b523ff0b5a954a8579a1aeb

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

name

String

body (Contained in the params structure)

VM name

 

3.18.0

backupUuid

String

url

Backup UUID

 

3.18.0

backupStorageUuid (Optional)

String

body (Contained in the params structure)

Image Storage UUID

 

3.18.0

instanceOfferingUuid

String

body (Contained in the params structure)

Instance offering UUID

 

3.18.0

defaultL3NetworkUuid (Optional)

String

body (Contained in the params structure)

Default L3 network UUID

 

3.18.0

l3NetworkUuids

List

body (Contained in the params structure)

A list of Distributed Port Group UUIDs

 

3.18.0

type (Optional)

String

body (Contained in the params structure)

Virtual Machine type

  • UserVm
  • ApplianceVm

3.18.0

zoneUuid (Optional)

String

body (Contained in the params structure)

Data Center UUID

 

3.18.0

clusterUuid (Optional)

String

body (Contained in the params structure)

Cluster UUID

 

3.18.0

hostUuid (Optional)

String

body (Contained in the params structure)

Host UUID

 

3.18.0

primaryStorageUuidForRootVolume (Optional)

String

body (Contained in the params structure)

Data Storage UUID for root disk

 

3.18.0

description (Optional)

String

body (Contained in the params structure)

Detailed description of the resource

 

3.18.0

rootVolumeSystemTags (Optional)

List

body (Contained in the params structure)

System tags for root disk

 

3.18.0

resourceUuid (Optional)

String

body (Contained in the params structure)

Resource UUID

 

3.18.0

tagUuids (Optional)

List

body (Contained in the params structure)

Tag UUID list

 

3.18.0

systemTags (Optional)

List

body

System tags

 

3.18.0

userTags (Optional)

List

body

User tags

 

3.18.0

strategy (Optional)

String

body (Contained in the params structure)

VM creation strategy

  • InstantStart
  • JustCreate
  • CreateStopped

4.10.0

API Response

Response Example

{
  "inventory": {
    "uuid": "0a2cbf2edacc399cb9a7e6b2fa14602d",
    "name": "Test-VM",
    "description": "web server VM",
    "zoneUuid": "1086a7491b8c3fb9ab12192dc0fab906",
    "clusterUuid": "3e368e7f98913ec6bb20d6cc969cf50a",
    "imageUuid": "2ceb7086482d3b42ab56b9daa6fb4d44",
    "hostUuid": "d81f8599fd033183ab2d4bcafce233cc",
    "lastHostUuid": "2d9fd9b480be3fdd9df46548d9d178d5",
    "instanceOfferingUuid": "feba03817e0e326d827ebdb436786bad",
    "rootVolumeUuid": "2f368d0d8b4734b7b58e1c5cb2ec27c6",
    "platform": "Linux",
    "defaultL3NetworkUuid": "ecebe1b81b18351dbdf304622e9ada80",
    "type": "UserVm",
    "hypervisorType": "KVM",
    "memorySize": 8589934592,
    "cpuNum": 1,
    "allocatorStrategy": "LastHostPreferredAllocatorStrategy",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM",
    "state": "Running",
    "vmNics": [
      {
        "uuid": "da1e1002fa2b387bbe389ce3bf10ba92",
        "vmInstanceUuid": "0a2cbf2edacc399cb9a7e6b2fa14602d",
        "usedIpUuid": "e8c56c6711e83896acb7413183726c1c",
        "l3NetworkUuid": "ecebe1b81b18351dbdf304622e9ada80",
        "ip": "192.168.1.10",
        "mac": "00:0c:29:bd:99:fc",
        "netmask": "255.255.255.0",
        "gateway": "192.168.1.1",
        "deviceId": 0,
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ],
    "allVolumes": [
      {
        "uuid": "2f368d0d8b4734b7b58e1c5cb2ec27c6",
        "name": "Root-Volume-For-VM-0a2cbf2edacc399cb9a7e6b2fa14602d",
        "primaryStorageUuid": "890196bf1b5a308da1c75eb61ff441a3",
        "vmInstanceUuid": "0a2cbf2edacc399cb9a7e6b2fa14602d",
        "rootImageUuid": "2ceb7086482d3b42ab56b9daa6fb4d44",
        "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-2f368d0d8b4734b7b58e1c5cb2ec27c6/2f368d0d8b4734b7b58e1c5cb2ec27c6.qcow2",
        "type": "Root",
        "format": "qcow2",
        "size": 107374182400,
        "actualSize": 21474836480,
        "deviceId": 0,
        "state": "Enabled",
        "status": "Ready",
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ]
  }
}
NameTypeDescriptionStarting Version
successbooleanWhether the request succeeded3.18.0
inventoryVmInstanceInventoryFor details, seeinventory3.18.0
errorErrorCodeFor details, seeerror3.18.0

inventory

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource0.6
nameStringResource name0.6
descriptionStringDetailed description of the resource0.6
zoneUuidStringData Center UUID0.6
clusterUuidStringCluster UUID0.6
imageUuidStringImage UUID0.6
hostUuidStringHost UUID0.6
lastHostUuidStringUUID of the last Host where the VM was started0.6
instanceOfferingUuidStringInstance offering UUID (deprecated)0.6
rootVolumeUuidStringRoot disk UUID0.6
platformStringVM platform: Windows, Linux, or other0.6
architectureStringVM architecture: x86_64, aarch64, or other0.6
defaultL3NetworkUuidStringDefault Distributed Port Group UUID0.6
typeStringVM type: user VM or platform-specific VM0.6
hypervisorTypeStringVM hypervisor type, typically KVM0.6
memorySizeLongMemory size0.6
cpuNumIntegerCPU count0.6
cpuSpeedLongCPU speed0.6
allocatorStrategyStringVM allocation strategy0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6
stateStringThe enabled/disabled state of the VM0.6
guestOsTypeStringGuest OS type of the VM3.11.2
vmNicsListFor details, seevmNics0.6
allVolumesListFor details, seeallVolumes0.6
vmCdRomsListFor details, seevmCdRoms0.6

vmNics

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource3.17.13
vmInstanceUuidStringVirtual Machine UUID3.17.13
l3NetworkUuidStringDistributed Port Group UUID3.17.13
ipString 3.17.13
macString 3.17.13
hypervisorTypeString 3.17.13
netmaskString 3.17.13
gatewayString 3.17.13
metaDataString 3.17.13
ipVersionInteger 3.17.13
driverTypeString 3.17.13
internalNameString 3.17.13
deviceIdInteger 3.17.13
typeString 3.17.13
stateStringNIC state3.17.13
createDateTimestampCreation time3.17.13
lastOpDateTimestampLast modification time3.17.13
usedIpsListFor details, seeusedIps3.17.13

usedIps

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource4.10.0
ipRangeUuidStringIP range UUID4.10.0
l3NetworkUuidStringDistributed Port Group UUID4.10.0
ipVersionIntegerIP version4.10.0
ipStringIP address4.10.0
netmaskStringSubnet mask4.10.0
gatewayStringGateway address4.10.0
usedForStringAllocation purpose4.10.0
ipInLonglongIP address stored as Long, valid for IPv4 only4.10.0
vmNicUuidStringVM NIC UUID4.10.0
createDateTimestampCreation time4.10.0
lastOpDateTimestampLast modification time4.10.0

allVolumes

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource3.17.13
nameStringResource name3.17.13
descriptionStringDetailed description of the resource3.17.13
primaryStorageUuidStringData Storage UUID3.17.13
vmInstanceUuidStringVirtual Machine UUID3.17.13
diskOfferingUuidStringDisk offering UUID3.17.13
rootImageUuidString 3.17.13
installPathString 3.17.13
typeString 3.17.13
formatString 3.17.13
sizeLong 3.17.13
actualSizeLong 3.17.13
deviceIdInteger 3.17.13
stateString 3.17.13
statusString 3.17.13
createDateTimestampCreation time3.17.13
lastOpDateTimestampLast modification time3.17.13
isShareableBoolean 3.17.13
volumeQosString 3.17.13
lastDetachDateTimestamp 3.17.13
lastVmInstanceUuidString 3.17.13

vmCdRoms

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource3.17.13
vmInstanceUuidStringVirtual Machine UUID3.17.13
deviceIdInteger 3.17.13
isoUuidString 3.17.13
isoInstallPathString 3.17.13
nameStringResource name3.17.13
descriptionStringDetailed description of the resource3.17.13
createDateTimestampCreation time3.17.13
lastOpDateTimestampLast modification time3.17.13

error

NameTypeDescriptionStarting Version
codeStringThe error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.10010.6
descriptionStringA brief description of the error0.6
detailsStringThe detailed error information0.6
elaborationStringA reserved field. The default value is null0.6
opaqueLinkedHashMapA reserved field. The default value is null0.6
causeErrorCodeThe root error. The source error that caused the current error. If no root error exists, this field is null0.6

SDK Examples

Java SDK

CreateVmFromVolumeBackupAction action = new CreateVmFromVolumeBackupAction();
action.name = "vm1";
action.backupUuid = "b3ecd20a4b523ff0b5a954a8579a1aeb";
action.instanceOfferingUuid = "31d2057b670d3c32a6970e519b514f12";
action.l3NetworkUuids = asList("87b522f02ef83627bcab5e427ba2d5e6");
action.clusterUuid = "255b14070a533fb5ad9a845d4c50508a";
action.description = "this is a vm";
action.strategy = "InstantStart";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmFromVolumeBackupAction.Result res = action.call();

Python SDK

action = CreateVmFromVolumeBackupAction()
action.name = "vm1"
action.backupUuid = "b3ecd20a4b523ff0b5a954a8579a1aeb"
action.instanceOfferingUuid = "31d2057b670d3c32a6970e519b514f12"
action.l3NetworkUuids = [87b522f02ef83627bcab5e427ba2d5e6]
action.clusterUuid = "255b14070a533fb5ad9a845d4c50508a"
action.description = "this is a vm"
action.strategy = "InstantStart"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()