Create VM from VM Backup

POST/zstack/v1/vm-instances/from/vm-backups/{groupUuid}

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "vm1",
    "instanceOfferingUuid": "7d608371542b3ab5960823c1b57bfa0c",
    "l3NetworkUuids": [
      "6ab4d28582d232708ed2912c1c3eb1ef"
    ],
    "clusterUuid": "84a216b8b0323b87bf9d2b32abc635a3",
    "description": "this is a vm",
    "diskAOs": [
      {
        "boot": false,
        "primaryStorageUuid": "2b7a5bd210ed3b1ea9d746f714a79eaf",
        "size": 0,
        "sourceUuid": "b205ac85f069349eafe837afadd173df"
      }
    ],
    "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":"7d608371542b3ab5960823c1b57bfa0c","l3NetworkUuids":["6ab4d28582d232708ed2912c1c3eb1ef"],"clusterUuid":"84a216b8b0323b87bf9d2b32abc635a3","description":"this is a vm","diskAOs":[{"boot":false,"primaryStorageUuid":"2b7a5bd210ed3b1ea9d746f714a79eaf","size":0,"sourceUuid":"b205ac85f069349eafe837afadd173df"}],"strategy":"InstantStart"}}' \
http://localhost:8080/zstack/v1/vm-instances/from/vm-backups/04ac2beae2b03def881dea125299498c

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

name

String

body (Contained in the params structure)

Resource name

 

3.0.0

groupUuid

String

url

VM backup group UUID

 

3.0.0

backupStorageUuid (Optional)

String

body (Contained in the params structure)

Image Storage UUID

 

0.6

instanceOfferingUuid (Optional)

String

body (Contained in the params structure)

Instance offering UUID

 

3.0.0

l3NetworkUuids (Optional)

List

body (Contained in the params structure)

A set of Distributed Port Group UUIDs

 

3.0.0

vmNicParams (Optional)

String

body (Contained in the params structure)

NIC information

 

4.7.0

type (Optional)

String

body (Contained in the params structure)

VM type

  • UserVm
  • ApplianceVm

3.0.0

zoneUuid (Optional)

String

body (Contained in the params structure)

Data Center UUID

 

3.0.0

clusterUuid (Optional)

String

body (Contained in the params structure)

Cluster UUID

 

3.0.0

hostUuid (Optional)

String

body (Contained in the params structure)

Host UUID

 

3.0.0

primaryStorageUuidForRootVolume (Optional)

String

body (Contained in the params structure)

Data storage UUID for root disk

 

3.0.0

primaryStorageUuidForDataVolume (Optional)

String

body (Contained in the params structure)

Data storage UUID for data disk

 

3.0.0

description (Optional)

String

body (Contained in the params structure)

Detailed description of the resource

 

3.0.0

rootVolumeSystemTags (Optional)

List

body (Contained in the params structure)

Root disk system tags

 

3.0.0

dataVolumeSystemTags (Optional)

List

body (Contained in the params structure)

Data disk system tags

 

3.0.0

diskAOs (Optional)

List

body (Contained in the params structure)

Pass parameters by disk. DiskAO.sourceUuid is bound to the original disk UUID corresponding to the backup (VolumeBackupVO.volumeUuid). You can specify primaryStorageUuid, systemTags, etc. for each disk individually. Note: diskAOs is mutually exclusive with primaryStorageUuidForRootVolume/primaryStorageUuidForDataVolume and rootVolumeSystemTags/dataVolumeSystemTags; they cannot be specified at the same time

 

5.0.0

defaultL3NetworkUuid (Optional)

String

body (Contained in the params structure)

Default Distributed Port Group UUID

 

3.0.0

resourceUuid (Optional)

String

body (Contained in the params structure)

 

 

3.0.0

systemTags (Optional)

List

body

System tags

 

3.0.0

userTags (Optional)

List

body

User tags

 

3.0.0

tagUuids (Optional)

List

body (Contained in the params structure)

Tag UUID list

 

3.4.0

strategy (Optional)

String

body (Contained in the params structure)

VM creation strategy

  • InstantStart
  • JustCreate
  • CreateStopped

4.10.0

cpuNum (Optional)

Integer

body (Contained in the params structure)

 

 

4.3.0

memorySize (Optional)

Long

body (Contained in the params structure)

 

 

4.3.0

reservedMemorySize (Optional)

Long

body (Contained in the params structure)

 

 

4.3.0

API Response

Response Example

{
  "inventory": {
    "uuid": "a1c07d683f693f6e9f2d7f9a499c7840",
    "name": "Test-VM",
    "description": "web server VM",
    "zoneUuid": "1e48b41ec4b63660b38a72d271c0164b",
    "clusterUuid": "f29498f04b1e3c319bdaeb6b3f8259f3",
    "imageUuid": "5c07704333c532e8b402b6b3ddb89315",
    "hostUuid": "e18cf66eedb3306686a1d4685bbb63af",
    "lastHostUuid": "4834161c409a34b6a84e40d71d85f714",
    "instanceOfferingUuid": "f53ad9f147203b499dfbd93ce41b7a8e",
    "rootVolumeUuid": "24b9fcb69f123ad6b3ddfffed96d2882",
    "platform": "Linux",
    "defaultL3NetworkUuid": "d50554f493153be78f6740e18e598046",
    "type": "UserVm",
    "hypervisorType": "KVM",
    "memorySize": 8589934592,
    "cpuNum": 1,
    "allocatorStrategy": "LastHostPreferredAllocatorStrategy",
    "createDate": "Nov 14, 2017 9:20:57 AM",
    "lastOpDate": "Nov 14, 2017 9:20:57 AM",
    "state": "Running",
    "vmNics": [
      {
        "uuid": "9856d36e40783d669b9e4f1de41d1a17",
        "vmInstanceUuid": "a1c07d683f693f6e9f2d7f9a499c7840",
        "usedIpUuid": "be02105c2a223492a91fb09ba664ecb1",
        "l3NetworkUuid": "d50554f493153be78f6740e18e598046",
        "ip": "192.168.1.10",
        "mac": "00:0c:29:bd:99:fc",
        "netmask": "255.255.255.0",
        "gateway": "192.168.1.1",
        "deviceId": 0,
        "state": "enable",
        "createDate": "Nov 14, 2017 9:20:57 AM",
        "lastOpDate": "Nov 14, 2017 9:20:57 AM"
      }
    ],
    "allVolumes": [
      {
        "uuid": "24b9fcb69f123ad6b3ddfffed96d2882",
        "name": "Root-Volume-For-VM-a1c07d683f693f6e9f2d7f9a499c7840",
        "primaryStorageUuid": "ae47a25fd7cf3a349035d01060a8a224",
        "vmInstanceUuid": "a1c07d683f693f6e9f2d7f9a499c7840",
        "rootImageUuid": "5c07704333c532e8b402b6b3ddb89315",
        "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-24b9fcb69f123ad6b3ddfffed96d2882/24b9fcb69f123ad6b3ddfffed96d2882.qcow2",
        "type": "Root",
        "format": "qcow2",
        "size": 107374182400,
        "actualSize": 21474836480,
        "deviceId": 0,
        "state": "Enabled",
        "status": "Ready",
        "createDate": "Nov 14, 2017 9:20:57 AM",
        "lastOpDate": "Nov 14, 2017 9:20:57 AM"
      }
    ]
  }
}
NameTypeDescriptionStarting Version
successboolean 3.0.0
errorErrorCodeThe error code. If not null, the operation failed. This field is null on success. For details, seeerror3.0.0
inventoryVmInstanceInventoryFor details, seeinventory3.0.0

error

NameTypeDescriptionStarting Version
codeStringThe error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.10013.0.0
descriptionStringA brief description of the error3.0.0
detailsStringThe detailed error information3.0.0
elaborationStringReserved field. Default is null3.0.0
opaqueLinkedHashMapReserved field. Default is null3.0.0
causeErrorCodeThe root error. The source error that caused the current error. This field is null if there is no root error3.0.0

inventory

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource3.0.0
nameStringResource name3.0.0
descriptionStringDetailed description of the resource3.0.0
zoneUuidStringData Center UUID3.0.0
clusterUuidStringCluster UUID3.0.0
imageUuidStringImage UUID3.0.0
hostUuidStringHost UUID3.0.0
lastHostUuidString 3.0.0
instanceOfferingUuidStringInstance offering UUID3.0.0
rootVolumeUuidStringRoot disk UUID3.0.0
platformString 3.0.0
architectureString 5.1.0
defaultL3NetworkUuidString 3.0.0
typeString 3.0.0
hypervisorTypeString 3.0.0
memorySizeLong 3.0.0
cpuNumInteger 3.0.0
cpuSpeedLong 3.0.0
allocatorStrategyString 3.0.0
createDateTimestampCreation time3.0.0
lastOpDateTimestampLast modification time3.0.0
stateString 3.0.0
guestOsTypeString 4.1.2
vmNicsListFor details, seevmNics3.0.0
allVolumesListFor details, seeallVolumes3.0.0
vmCdRomsListFor details, seevmCdRoms0.6

vmNics

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource4.7.13
vmInstanceUuidStringVM instance UUID4.7.13
l3NetworkUuidStringDistributed Port Group UUID4.7.13
ipString 4.7.13
macString 4.7.13
hypervisorTypeString 4.7.13
netmaskString 4.7.13
gatewayString 4.7.13
metaDataString 4.7.13
ipVersionInteger 4.7.13
driverTypeString 4.7.13
internalNameString 4.7.13
deviceIdInteger 4.7.13
typeString  
stateStringNIC status4.7.13
createDateTimestampCreation time4.7.13
lastOpDateTimestampLast modification time4.7.13
usedIpsListFor details, seeusedIps4.7.13

usedIps

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource5.0.0
ipRangeUuidStringIP range UUID5.0.0
l3NetworkUuidStringDistributed Port Group UUID5.0.0
ipVersionInteger 5.0.0
ipString 5.0.0
netmaskString 5.0.0
gatewayString 5.0.0
usedForString 5.0.0
ipInLonglong 5.0.0
vmNicUuidStringVM NIC UUID5.0.0
createDateTimestampCreation time5.0.0
lastOpDateTimestampLast modification time5.0.0

allVolumes

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource3.0.0
nameStringResource name3.0.0
descriptionStringDetailed description of the resource3.0.0
primaryStorageUuidStringData storage UUID3.0.0
vmInstanceUuidStringVM instance UUID3.0.0
diskOfferingUuidStringDisk offering UUID3.0.0
rootImageUuidString 3.0.0
installPathString 3.0.0
typeString 3.0.0
formatString 3.0.0
sizeLong 3.0.0
actualSizeLong 3.0.0
deviceIdInteger 3.0.0
stateString 3.0.0
statusString 3.0.0
createDateTimestampCreation time3.0.0
lastOpDateTimestampLast modification time3.0.0
isShareableBoolean 3.0.0
volumeQosString 4.7.13
lastDetachDateTimestamp 4.7.13
lastVmInstanceUuidString 4.7.13

vmCdRoms

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource4.7.13
vmInstanceUuidStringVM instance UUID4.7.13
deviceIdInteger 4.7.13
isoUuidString 4.7.13
isoInstallPathString 4.7.13
nameStringResource name4.7.13
descriptionStringDetailed description of the resource4.7.13
createDateTimestampCreation time4.7.13
lastOpDateTimestampLast modification time4.7.13

SDK Examples

Java SDK

CreateVmFromVmBackupAction action = new CreateVmFromVmBackupAction();
action.name = "vm1";
action.groupUuid = "04ac2beae2b03def881dea125299498c";
action.instanceOfferingUuid = "7d608371542b3ab5960823c1b57bfa0c";
action.l3NetworkUuids = asList("6ab4d28582d232708ed2912c1c3eb1ef");
action.clusterUuid = "84a216b8b0323b87bf9d2b32abc635a3";
action.description = "this is a vm";
action.diskAOs = asList([boot:false, primaryStorageUuid:2b7a5bd210ed3b1ea9d746f714a79eaf, size:0, sourceUuid:b205ac85f069349eafe837afadd173df]);
action.strategy = "InstantStart";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmFromVmBackupAction.Result res = action.call();

Python SDK

action = CreateVmFromVmBackupAction()
action.name = "vm1"
action.groupUuid = "04ac2beae2b03def881dea125299498c"
action.instanceOfferingUuid = "7d608371542b3ab5960823c1b57bfa0c"
action.l3NetworkUuids = [6ab4d28582d232708ed2912c1c3eb1ef]
action.clusterUuid = "84a216b8b0323b87bf9d2b32abc635a3"
action.description = "this is a vm"
action.diskAOs = [[boot:false, primaryStorageUuid:2b7a5bd210ed3b1ea9d746f714a79eaf, size:0, sourceUuid:b205ac85f069349eafe837afadd173df]]
action.strategy = "InstantStart"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()