Create VM from VM Backup
Headers
Authorization: OAuth the-session-uuidBody
{
"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/04ac2beae2b03def881dea125299498cParameter 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 |
| 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 |
| 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"
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 3.0.0 | |
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. For details, seeerror | 3.0.0 |
| inventory | VmInstanceInventory | For details, seeinventory | 3.0.0 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 3.0.0 |
| description | String | A brief description of the error | 3.0.0 |
| details | String | The detailed error information | 3.0.0 |
| elaboration | String | Reserved field. Default is null | 3.0.0 |
| opaque | LinkedHashMap | Reserved field. Default is null | 3.0.0 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root error | 3.0.0 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource | 3.0.0 |
| name | String | Resource name | 3.0.0 |
| description | String | Detailed description of the resource | 3.0.0 |
| zoneUuid | String | Data Center UUID | 3.0.0 |
| clusterUuid | String | Cluster UUID | 3.0.0 |
| imageUuid | String | Image UUID | 3.0.0 |
| hostUuid | String | Host UUID | 3.0.0 |
| lastHostUuid | String | 3.0.0 | |
| instanceOfferingUuid | String | Instance offering UUID | 3.0.0 |
| rootVolumeUuid | String | Root disk UUID | 3.0.0 |
| platform | String | 3.0.0 | |
| architecture | String | 5.1.0 | |
| defaultL3NetworkUuid | String | 3.0.0 | |
| type | String | 3.0.0 | |
| hypervisorType | String | 3.0.0 | |
| memorySize | Long | 3.0.0 | |
| cpuNum | Integer | 3.0.0 | |
| cpuSpeed | Long | 3.0.0 | |
| allocatorStrategy | String | 3.0.0 | |
| createDate | Timestamp | Creation time | 3.0.0 |
| lastOpDate | Timestamp | Last modification time | 3.0.0 |
| state | String | 3.0.0 | |
| guestOsType | String | 4.1.2 | |
| vmNics | List | For details, seevmNics | 3.0.0 |
| allVolumes | List | For details, seeallVolumes | 3.0.0 |
| vmCdRoms | List | For details, seevmCdRoms | 0.6 |
vmNics
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource | 4.7.13 |
| vmInstanceUuid | String | VM instance UUID | 4.7.13 |
| l3NetworkUuid | String | Distributed Port Group UUID | 4.7.13 |
| ip | String | 4.7.13 | |
| mac | String | 4.7.13 | |
| hypervisorType | String | 4.7.13 | |
| netmask | String | 4.7.13 | |
| gateway | String | 4.7.13 | |
| metaData | String | 4.7.13 | |
| ipVersion | Integer | 4.7.13 | |
| driverType | String | 4.7.13 | |
| internalName | String | 4.7.13 | |
| deviceId | Integer | 4.7.13 | |
| type | String | ||
| state | String | NIC status | 4.7.13 |
| createDate | Timestamp | Creation time | 4.7.13 |
| lastOpDate | Timestamp | Last modification time | 4.7.13 |
| usedIps | List | For details, seeusedIps | 4.7.13 |
usedIps
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource | 5.0.0 |
| ipRangeUuid | String | IP range UUID | 5.0.0 |
| l3NetworkUuid | String | Distributed Port Group UUID | 5.0.0 |
| ipVersion | Integer | 5.0.0 | |
| ip | String | 5.0.0 | |
| netmask | String | 5.0.0 | |
| gateway | String | 5.0.0 | |
| usedFor | String | 5.0.0 | |
| ipInLong | long | 5.0.0 | |
| vmNicUuid | String | VM NIC UUID | 5.0.0 |
| createDate | Timestamp | Creation time | 5.0.0 |
| lastOpDate | Timestamp | Last modification time | 5.0.0 |
allVolumes
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource | 3.0.0 |
| name | String | Resource name | 3.0.0 |
| description | String | Detailed description of the resource | 3.0.0 |
| primaryStorageUuid | String | Data storage UUID | 3.0.0 |
| vmInstanceUuid | String | VM instance UUID | 3.0.0 |
| diskOfferingUuid | String | Disk offering UUID | 3.0.0 |
| rootImageUuid | String | 3.0.0 | |
| installPath | String | 3.0.0 | |
| type | String | 3.0.0 | |
| format | String | 3.0.0 | |
| size | Long | 3.0.0 | |
| actualSize | Long | 3.0.0 | |
| deviceId | Integer | 3.0.0 | |
| state | String | 3.0.0 | |
| status | String | 3.0.0 | |
| createDate | Timestamp | Creation time | 3.0.0 |
| lastOpDate | Timestamp | Last modification time | 3.0.0 |
| isShareable | Boolean | 3.0.0 | |
| volumeQos | String | 4.7.13 | |
| lastDetachDate | Timestamp | 4.7.13 | |
| lastVmInstanceUuid | String | 4.7.13 |
vmCdRoms
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource | 4.7.13 |
| vmInstanceUuid | String | VM instance UUID | 4.7.13 |
| deviceId | Integer | 4.7.13 | |
| isoUuid | String | 4.7.13 | |
| isoInstallPath | String | 4.7.13 | |
| name | String | Resource name | 4.7.13 |
| description | String | Detailed description of the resource | 4.7.13 |
| createDate | Timestamp | Creation time | 4.7.13 |
| lastOpDate | Timestamp | Last modification time | 4.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()