VM Related Interfaces
Set VM Boot Volume
Headers
Authorization: OAuth the-session-uuidBody
{
"setVmBootVolume": {
"volumeUuid": "5f9b86be026636008999dd6b971a6f18"
},
"systemTags": [],
"userTags": []
}In the example above, systemTags and userTags fields can be omitted. 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 PUT -d '{"setVmBootVolume":{"volumeUuid":"5f9b86be026636008999dd6b971a6f18"}}' http://localhost:8080/zstack/v1/vm-instances/0352b51de6353d2ea89f2b4ca1c2178c/actionsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| vmInstanceUuid | String | url | Virtual Machine UUID | 4.2.0 | |
| volumeUuid | String | body (contained in setVmBootVolume structure) | Volume UUID | 4.2.0 | |
| systemTags (Optional) | List | body | System Tag | 4.2.0 | |
| userTags (Optional) | List | body | User Tag | 4.2.0 |
API Response
Response Example
{
"inventory": {
"uuid": "bfd333f1eb8f31d687970d256394d979",
"name": "Test-VM",
"description": "web server VM",
"zoneUuid": "40347b5f09f83f918c1952285c1d8a63",
"clusterUuid": "31b9eccc4dda33c6886655921be64fe2",
"imageUuid": "7846fccd62da381da73698f1df7a9b9f",
"hostUuid": "4f64d011dce63c00b9bdf4196830e24a",
"lastHostUuid": "b7388961594e38dd920042599e384b99",
"instanceOfferingUuid": "a9f18b722ff53f5598941b56bdd013c7",
"rootVolumeUuid": "ecafc5a76ff83d64af698dee9401d548",
"platform": "Linux",
"defaultL3NetworkUuid": "14fcf6baf571378eb0eac9bbbd59d92c",
"type": "UserVm",
"hypervisorType": "KVM",
"memorySize": 8589934592,
"cpuNum": 1,
"allocatorStrategy": "LastHostPreferredAllocatorStrategy",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM",
"state": "Stopped",
"vmNics": [
{
"uuid": "c810740f3eae39cc8547ec29e994f46e",
"vmInstanceUuid": "bfd333f1eb8f31d687970d256394d979",
"usedIpUuid": "f6a911e405243835876e440f3c029c4f",
"l3NetworkUuid": "14fcf6baf571378eb0eac9bbbd59d92c",
"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,
"state": "enable",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
],
"allVolumes": [
{
"uuid": "ecafc5a76ff83d64af698dee9401d548",
"name": "Root-Volume-For-VM-bfd333f1eb8f31d687970d256394d979",
"primaryStorageUuid": "fc819dfbacbf36de8773f64f290c3528",
"vmInstanceUuid": "bfd333f1eb8f31d687970d256394d979",
"diskOfferingUuid": "51d4f148cf043ebc9a3af0f444572be6",
"rootImageUuid": "7846fccd62da381da73698f1df7a9b9f",
"installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-ecafc5a76ff83d64af698dee9401d548/ecafc5a76ff83d64af698dee9401d548.qcow2",
"type": "Root",
"format": "qcow2",
"size": 107374182400,
"actualSize": 21474836480,
"deviceId": 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 |
|---|---|---|---|
| success | boolean | 4.2.0 | |
| inventory | VmInstanceInventory | For details, see inventory | 4.2.0 |
| error | ErrorCode | Error code. If not null, the operation failed. When the operation succeeds, this field is null. For details, see error | 4.2.0 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 0.6 |
| name | String | Resource name | 0.6 |
| description | String | Detailed description of the resource | 0.6 |
| zoneUuid | String | Data Center UUID | 0.6 |
| clusterUuid | String | Cluster UUID | 0.6 |
| imageUuid | String | Image UUID | 0.6 |
| hostUuid | String | Host UUID | 0.6 |
| lastHostUuid | String | 0.6 | |
| instanceOfferingUuid | String | Compute Offering UUID | 0.6 |
| rootVolumeUuid | String | Root Volume UUID | 0.6 |
| platform | String | 0.6 | |
| architecture | String | 0.6 | |
| defaultL3NetworkUuid | String | 0.6 | |
| type | String | 0.6 | |
| hypervisorType | String | 0.6 | |
| memorySize | Long | 0.6 | |
| cpuNum | Integer | 0.6 | |
| cpuSpeed | Long | 0.6 | |
| allocatorStrategy | String | 0.6 | |
| createDate | Timestamp | Create time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
| state | String | 0.6 | |
| guestOsType | String | 4.1.2 | |
| vmNics | List | For details, see vmNics | 0.6 |
| allVolumes | List | For details, see allVolumes | 0.6 |
| vmCdRoms | List | For details, see vmCdRoms | 0.6 |
vmNics
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 4.7.13 |
| vmInstanceUuid | String | Virtual Machine 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 | 4.7.13 | |
| state | String | NIC status | 4.7.13 |
| createDate | Timestamp | Create time | 4.7.13 |
| lastOpDate | Timestamp | Last modification time | 4.7.13 |
| usedIps | List | For details, see usedIps | 4.7.13 |
usedIps
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 4.7.13 |
| ipRangeUuid | String | IP Range UUID | 4.7.13 |
| l3NetworkUuid | String | Distributed Port Group UUID | 4.7.13 |
| ipVersion | Integer | 4.7.13 | |
| ip | String | 4.7.13 | |
| netmask | String | 4.7.13 | |
| gateway | String | 4.7.13 | |
| usedFor | String | 4.7.13 | |
| ipInLong | long | 4.7.13 | |
| vmNicUuid | String | Virtual Machine NIC UUID | 4.7.13 |
| createDate | Timestamp | Create time | 4.7.13 |
| lastOpDate | Timestamp | Last modification time | 4.7.13 |
allVolumes
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 4.7.13 |
| name | String | Resource name | 4.7.13 |
| description | String | Detailed description of the resource | 4.7.13 |
| primaryStorageUuid | String | Primary Storage UUID | 4.7.13 |
| vmInstanceUuid | String | Virtual Machine UUID | 4.7.13 |
| diskOfferingUuid | String | Disk Offering UUID | 4.7.13 |
| rootImageUuid | String | 4.7.13 | |
| installPath | String | 4.7.13 | |
| type | String | 4.7.13 | |
| format | String | 4.7.13 | |
| size | Long | 4.7.13 | |
| actualSize | Long | 4.7.13 | |
| deviceId | Integer | 4.7.13 | |
| state | String | 4.7.13 | |
| status | String | 4.7.13 | |
| createDate | Timestamp | Create time | 4.7.13 |
| lastOpDate | Timestamp | Last modification time | 4.7.13 |
| isShareable | Boolean | 4.7.13 | |
| volumeQos | String | 4.7.13 | |
| lastDetachDate | Timestamp | 4.7.13 | |
| lastVmInstanceUuid | String | 4.7.13 |
vmCdRoms
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 4.7.13 |
| vmInstanceUuid | String | Virtual Machine 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 | Create time | 4.7.13 |
| lastOpDate | Timestamp | Last modification time | 4.7.13 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, a globally unique identifier of the error, for example SYS.1000, HOST.1001 | 0.6 |
| description | String | Brief description of the error | 0.6 |
| details | String | Detailed error information | 0.6 |
| elaboration | String | Reserved field, defaults to null | 0.6 |
| opaque | LinkedHashMap | Reserved field, defaults to null | 0.6 |
| cause | ErrorCode | Root cause. The error that triggered the current error. If there is no original error, this field is null | 0.6 |
SDK Examples
Java SDK
SetVmBootVolumeAction action = new SetVmBootVolumeAction();
action.vmInstanceUuid = "0352b51de6353d2ea89f2b4ca1c2178c";
action.volumeUuid = "5f9b86be026636008999dd6b971a6f18";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVmBootVolumeAction.Result res = action.call();Python SDK
action = SetVmBootVolumeAction()
action.vmInstanceUuid = "0352b51de6353d2ea89f2b4ca1c2178c"
action.volumeUuid = "5f9b86be026636008999dd6b971a6f18"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()