CreateVmInstanceFromVolumeSnapshotGroup
API Request
URLs
POST zstack/vm-instances/from/volume-snapshots/group/{volumeSnapshotGroupUuid}Headers
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"name": "vm1",
"description": "this is a vm",
"instanceOfferingUuid": "5dda0d1013a433e9959967199f819c60",
"l3NetworkUuids": [
"5fc19e24bedc32f58116ce6d63247f1a"
],
"clusterUuid": "984aef8dfbb33c069c62fac5249ab044",
"strategy": "InstantStart"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields 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":{"name":"vm1","description":"this is a vm","instanceOfferingUuid":"5dda0d1013a433e9959967199f819c60","l3NetworkUuids":["5fc19e24bedc32f58116ce6d63247f1a"],"clusterUuid":"984aef8dfbb33c069c62fac5249ab044","strategy":"InstantStart"}}' http://localhost:8080/zstack/v1/vm-instances/from/volume-snapshots/group/da7e81e1d1793fdab7d5d05268d680a2Request Parameters
| Name | Type | Location | Description | Valid Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The resource name. | 4.1.0 | |
| description | String | body (contained in the params structure) | The detailed description of the resource. | 4.1.0 | |
| instanceOfferingUuid | String | body (contained in the params structure) | The instance offering UUID. | 4.1.0 | |
| cpuNum | Integer | body (contained in the params structure) | Optional. The number of CPU cores. | 4.1.0 | |
| memorySize | Long | body (contained in the params structure) | Optional. The memory size. | 4.1.0 | |
| l3NetworkUuids | List | body (contained in the params structure) | The L3 network UUID. | 4.1.0 | |
| type | String | body (contained in the params structure) | Optional. The VM type. |
|
4.1.0 |
| volumeSnapshotGroupUuid | String | url | The snapshot group UUID. | 4.1.0 | |
| zoneUuid | String | body (contained in the params structure) | Optiona. The zone UUID. | 4.1.0 | |
| clusterUuid | String | body (contained in the params structure) | Optional. The cluster UUID | 4.1.0 | |
| hostUuid | String | body (contained in the params structure) | Optional. The host UUID. | 4.1.0 | |
| primaryStorageUuidForRootVolume | String | body (contained in the params structure) | The UUID of the primary storage where the root volume resides. | 4.1.0 | |
| defaultL3NetworkUuid | String | body (contained in the params structure) | Optional. The default L3 network UUID. | 4.1.0 | |
| strategy | String | body (contained in the params structure) | Optional. The policy that specifies whether to start a VM instance when the instance is created. |
|
4.1.0 |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 4.1.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUIDs. | 4.1.0 | |
| systemTags | List | body | Optional. The system tags. | 4.1.0 | |
| userTags | List | body | Optional. The user tags. | 4.1.0 |
API Response
Sample Response
{
"inventory": {
"uuid": "109d10001c5c3553a7f2333e6a48610a",
"name": "Test-VM",
"description": "web server VM",
"zoneUuid": "f31cb809cf0b3c668953e2507d5467b2",
"clusterUuid": "fdfdf92e7bbe3212ab6530b11d8e0af5",
"imageUuid": "96acc892dd793fb98c1924d54eb27a88",
"hostUuid": "8eb85f51f10c30c0a6305b73d2002899",
"lastHostUuid": "59ae08c1f6ed3638b6e4aa35b5a30d2e",
"instanceOfferingUuid": "8b6d6aabad773972a0549539099e3e68",
"rootVolumeUuid": "70eda0fe06163e67accf01a266fd5274",
"platform": "Linux",
"defaultL3NetworkUuid": "5ec42284ceaa3ad18f2b498e98ab6acc",
"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": "b6d840187f1932209c21888923f5f35e",
"vmInstanceUuid": "109d10001c5c3553a7f2333e6a48610a",
"usedIpUuid": "54e8db987a4a333c80a87e4a84ab7675",
"l3NetworkUuid": "5ec42284ceaa3ad18f2b498e98ab6acc",
"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": "70eda0fe06163e67accf01a266fd5274",
"name": "Root-Volume-For-VM-109d10001c5c3553a7f2333e6a48610a",
"primaryStorageUuid": "0739abbe904639649da74cdcf0abd25f",
"vmInstanceUuid": "109d10001c5c3553a7f2333e6a48610a",
"rootImageUuid": "96acc892dd793fb98c1924d54eb27a88",
"installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-70eda0fe06163e67accf01a266fd5274/70eda0fe06163e67accf01a266fd5274.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"
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.1.0 |
| inventory | VmInstanceInventory | See inventory. | 4.1.0 |
#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.1.0 |
| description | String | The brief description of the error. | 4.1.0 |
| details | String | The details about the error. | 4.1.0 |
| elaboration | String | The reserved field. Default value: null. | 4.1.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.1.0 |
| 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.1.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.1.0 |
| name | String | The resource name. | 4.1.0 |
| description | String | The detailed description of the resource. | 4.1.0 |
| zoneUuid | String | The zone UUID. | 4.1.0 |
| clusterUuid | String | The cluster UUID. | 4.1.0 |
| imageUuid | String | The image UUID. | 4.1.0 |
| hostUuid | String | The host UUID. | 4.1.0 |
| lastHostUuid | String | 4.1.0 | |
| instanceOfferingUuid | String | The instance offering UUID. | 4.1.0 |
| rootVolumeUuid | String | The root volume UUID. | 4.1.0 |
| platform | String | 4.1.0 | |
| defaultL3NetworkUuid | String | 4.1.0 | |
| type | String | 4.1.0 | |
| hypervisorType | String | 4.1.0 | |
| memorySize | Long | 4.1.0 | |
| cpuNum | Integer | 4.1.0 | |
| cpuSpeed | Long | 4.1.0 | |
| allocatorStrategy | String | 4.1.0 | |
| createDate | Timestamp | The creation time. | 4.1.0 |
| lastOpDate | Timestamp | The last update time. | 4.1.0 |
| state | String | 4.1.0 | |
| vmNics | List | See vmNics. | 4.1.0 |
| allVolumes | List | See allVolumes. | 4.1.0 |
#vmNics
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.1.0 |
| vmInstanceUuid | String | The VM UUID. | 4.1.0 |
| l3NetworkUuid | String | The L3 network UUID. | 4.1.0 |
| ip | String | The IP address. | 4.1.0 |
| mac | String | The MAC address. | 4.1.0 |
| hypervisorType | String | The hypervisor type. | 4.1.0 |
| netmask | String | The netmask. | 4.1.0 |
| gateway | String | The gateway. | 4.1.0 |
| metaData | String | 4.1.0 | |
| ipVersion | Integer | The IP address version. | 4.1.0 |
| deviceId | Integer | The device ID. | 4.1.0 |
| type | String | The NIC type. | 4.1.0 |
| createDate | Timestamp | The creation time. | 4.1.0 |
| lastOpDate | Timestamp | The last update time. | 4.1.0 |
| usedIps | List | See usedIps. | 4.1.0 |
#usedIps
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.1.0 |
| ipRangeUuid | String | The IP range UUID. | 4.1.0 |
| l3NetworkUuid | String | The L3 network UUID. | 4.1.0 |
| ipVersion | Integer | The IP version. | 4.1.0 |
| ip | String | The IP address. | 4.1.0 |
| netmask | String | The netmask. | 4.1.0 |
| gateway | String | The gateway. | 4.1.0 |
| usedFor | String | 4.1.0 | |
| ipInLong | long | 4.1.0 | |
| vmNicUuid | String | The VM NIC UUID. | 4.1.0 |
| createDate | Timestamp | The creation time. | 4.1.0 |
| lastOpDate | Timestamp | The last update time. | 4.1.0 |
#allVolumes
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.1.0 |
| name | String | The resource name. | 4.1.0 |
| description | String | The detailed description of the resource. | 4.1.0 |
| primaryStorageUuid | String | The primary storage UUID. | 4.1.0 |
| vmInstanceUuid | String | The VM UUID. | 4.1.0 |
| diskOfferingUuid | String | The disk offering UUID. | 4.1.0 |
| rootImageUuid | String | The root volume image UUID. | 4.1.0 |
| installPath | String | The installation path of the volume on the primary storage. | 4.1.0 |
| type | String | The volume type. | 4.1.0 |
| format | String | The volume type. | 4.1.0 |
| size | Long | The volume size. | 4.1.0 |
| actualSize | Long | The actual size of the volume. | 4.1.0 |
| deviceId | Integer | 4.1.0 | |
| state | String | Indicates whether the disk is enabled. | 4.1.0 |
| status | String | The volume status. | 4.1.0 |
| createDate | Timestamp | The creation time. | 4.1.0 |
| lastOpDate | Timestamp | The last update time. | 4.1.0 |
| isShareable | Boolean | Indicates whether the volume is a shared volume. | 4.1.0 |
| volumeQos | String | The volume QoS, for example, total=1048576 | 4.1.0 |
SDK Sample
Java
SDK
CreateVmInstanceFromVolumeSnapshotGroupAction action = new CreateVmInstanceFromVolumeSnapshotGroupAction();
action.name = "vm1";
action.description = "this is a vm";
action.instanceOfferingUuid = "5dda0d1013a433e9959967199f819c60";
action.l3NetworkUuids = asList("5fc19e24bedc32f58116ce6d63247f1a");
action.volumeSnapshotGroupUuid = "da7e81e1d1793fdab7d5d05268d680a2";
action.clusterUuid = "984aef8dfbb33c069c62fac5249ab044";
action.strategy = "InstantStart";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmInstanceFromVolumeSnapshotGroupAction.Result res = action.call();Python
SDK
CreateVmInstanceFromVolumeSnapshotGroupAction action = CreateVmInstanceFromVolumeSnapshotGroupAction()
action.name = "vm1"
action.description = "this is a vm"
action.instanceOfferingUuid = "5dda0d1013a433e9959967199f819c60"
action.l3NetworkUuids = [5fc19e24bedc32f58116ce6d63247f1a]
action.volumeSnapshotGroupUuid = "da7e81e1d1793fdab7d5d05268d680a2"
action.clusterUuid = "984aef8dfbb33c069c62fac5249ab044"
action.strategy = "InstantStart"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVmInstanceFromVolumeSnapshotGroupAction.Result res = action.call()