VM Related Interfaces
Set VM Clock Sync
Headers
Authorization: OAuth the-session-uuidBody
{
"setVmClockTrack": {
"track": "guest",
"syncAfterVMResume": true,
"intervalInSeconds": 60
},
"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 '{"setVmClockTrack":{"track":"guest","syncAfterVMResume":true,"intervalInSeconds":60.0}}' http://localhost:8080/zstack/v1/vm-instances/cc0a313462243900b6c843ff427b7f0e/actionsParameter List
Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
uuid | String | url | Resource UUID, a unique identifier for the resource |
| 4.1.0 |
track | String | body(contained in setVmClockTrack structure) |
|
| 4.1.0 |
syncAfterVMResume (optional) | Boolean | body(contained in setVmClockTrack structure) | Whether to sync after pause to resume |
| 4.4.24 |
intervalInSeconds (optional) | Integer | body(contained in setVmClockTrack structure) | Regular sync interval |
| 4.4.24 |
systemTags (optional) | List | body | System Tags |
| 4.1.0 |
userTags (optional) | List | body | User Tags |
| 4.1.0 |
API Response
Return Example
{
"inventory": {
"uuid": "19d64f55a9723e59849c0f9357a0dded",
"name": "Test-VM",
"description": "web server VM",
"zoneUuid": "553326a3b554380ca4e4b2976efa4df5",
"clusterUuid": "c9a8ba243c5a3d59b144e4e1ace143a2",
"imageUuid": "e4297acdd9b43e3f9b7a8ec74211a3f2",
"hostUuid": "f841ef12962037369ea4d8f3ba4c9c28",
"lastHostUuid": "3b6273ea6b1a384584178e11f05bf1f0",
"instanceOfferingUuid": "9ce1349c65ff3c80a423267837f5f34e",
"rootVolumeUuid": "5319e0ae2b483949bf25b059a674dbc8",
"platform": "Linux",
"defaultL3NetworkUuid": "c715b758cd843ac997ccdfbbcc9097cc",
"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": "8585080b6b5236a5875e8162c062e551",
"vmInstanceUuid": "19d64f55a9723e59849c0f9357a0dded",
"usedIpUuid": "c0bbe89468fa3b2aa6dc4e8aaa6df3f7",
"l3NetworkUuid": "c715b758cd843ac997ccdfbbcc9097cc",
"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": "5319e0ae2b483949bf25b059a674dbc8",
"name": "Root-Volume-For-VM-19d64f55a9723e59849c0f9357a0dded",
"primaryStorageUuid": "0e4e3cf961873074b8b3eca3bc693ece",
"vmInstanceUuid": "19d64f55a9723e59849c0f9357a0dded",
"diskOfferingUuid": "f1b95ad6d26e336e8809764ec2936fd2",
"rootImageUuid": "e4297acdd9b43e3f9b7a8ec74211a3f2",
"installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-5319e0ae2b483949bf25b059a674dbc8/5319e0ae2b483949bf25b059a674dbc8.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.1.0 | |
| inventory | VmInstanceInventory | For details, see inventory | 4.1.0 |
| error | ErrorCode | Error code. If not null, the operation failed. If null, the operation succeeded. For details, see error | 4.1.0 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, a globally unique identifier for the error, for example SYS.1000, HOST.1001 | 4.1.0 |
| description | String | Brief description of the error | 4.1.0 |
| details | String | Detailed error information | 4.1.0 |
| elaboration | String | Reserved field, defaults to null | 4.1.0 |
| opaque | LinkedHashMap | Reserved field, defaults to null | 4.1.0 |
| cause | ErrorCode | Root cause: the source error that triggered the current error. If there is no original error, this field is null | 4.1.0 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, a unique identifier for the resource | 4.1.0 |
| name | String | Resource Name | 4.1.0 |
| description | String | Resource description | 4.1.0 |
| zoneUuid | String | Data Center UUID | 4.1.0 |
| clusterUuid | String | Cluster UUID | 4.1.0 |
| imageUuid | String | Image UUID | 4.1.0 |
| hostUuid | String | Host UUID | 4.1.0 |
| lastHostUuid | String | 4.1.0 | |
| instanceOfferingUuid | String | Compute Offering UUID | 4.1.0 |
| rootVolumeUuid | String | Root Disk UUID | 4.1.0 |
| platform | String | 4.1.0 | |
| architecture | String | 0.6 | |
| 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 | Creation Time | 4.1.0 |
| lastOpDate | Timestamp | Last Operation Date | 4.1.0 |
| state | String | 4.1.0 | |
| guestOsType | String | 4.1.2 | |
| vmNics | List | For details, see vmNics | 4.1.0 |
| allVolumes | List | For details, see allVolumes | 4.1.0 |
| vmCdRoms | List | For details, see vmCdRoms | 0.6 |
vmNics
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, a unique identifier for the resource | 4.1.0 |
| vmInstanceUuid | String | Virtual Machine UUID | 4.1.0 |
| l3NetworkUuid | String | Distributed Port Group UUID | 4.1.0 |
| ip | String | IP Address | 4.1.0 |
| mac | String | MAC Address | 4.1.0 |
| hypervisorType | String | Virtualization Type | 4.1.0 |
| netmask | String | Subnet Mask | 4.1.0 |
| gateway | String | Gateway | 4.1.0 |
| metaData | String | 4.1.0 | |
| ipVersion | Integer | IP Address Version | 4.1.0 |
| driverType | String | 4.7.13 | |
| internalName | String | 4.7.13 | |
| deviceId | Integer | Device ID | 4.1.0 |
| type | String | NIC Type | 4.1.0 |
| state | String | NIC Status | 4.7.13 |
| createDate | Timestamp | Creation Time | 4.1.0 |
| lastOpDate | Timestamp | Last Operation Date | 4.1.0 |
| usedIps | List | For details, see usedIps | 4.1.0 |
usedIps
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, a unique identifier for the resource | 4.1.0 |
| ipRangeUuid | String | IP Range UUID | 4.1.0 |
| l3NetworkUuid | String | Distributed Port Group UUID | 4.1.0 |
| ipVersion | Integer | IP Protocol Number | 4.1.0 |
| ip | String | IP Address | 4.1.0 |
| netmask | String | Network Mask | 4.1.0 |
| gateway | String | Gateway Address | 4.1.0 |
| usedFor | String | 4.1.0 | |
| ipInLong | long | 4.1.0 | |
| vmNicUuid | String | VM NIC UUID | 4.1.0 |
| createDate | Timestamp | Creation Time | 4.1.0 |
| lastOpDate | Timestamp | Last Operation Date | 4.1.0 |
allVolumes
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, a unique identifier for the resource | 4.1.0 |
| name | String | Resource Name | 4.1.0 |
| description | String | Resource description | 4.1.0 |
| primaryStorageUuid | String | Data Storage UUID | 4.1.0 |
| vmInstanceUuid | String | Virtual Machine UUID | 4.1.0 |
| diskOfferingUuid | String | Disk Offering UUID | 4.1.0 |
| rootImageUuid | String | Root Image UUID | 4.1.0 |
| installPath | String | Disk path on Data Storage | 4.1.0 |
| type | String | Disk type, data disk/root disk | 4.1.0 |
| format | String | Disk Format | 4.1.0 |
| size | Long | Disk Size | 4.1.0 |
| actualSize | Long | Actual Disk Size | 4.1.0 |
| deviceId | Integer | 4.1.0 | |
| state | String | Whether the Disk is enabled | 4.1.0 |
| status | String | Disk Status | 4.1.0 |
| createDate | Timestamp | Creation Time | 4.1.0 |
| lastOpDate | Timestamp | Last Operation Date | 4.1.0 |
| isShareable | Boolean | Whether it is a shared Disk | 4.1.0 |
| volumeQos | String | Disk QoS, format such as total=1048576 | 4.1.0 |
| lastDetachDate | Timestamp | 4.7.13 | |
| lastVmInstanceUuid | String | 4.7.13 |
vmCdRoms
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, a unique identifier for 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 | Resource description | 4.7.13 |
| createDate | Timestamp | Creation Time | 4.7.13 |
| lastOpDate | Timestamp | Last Operation Date | 4.7.13 |
SDK Examples
Java SDK
SetVmClockTrackAction action = new SetVmClockTrackAction();
action.uuid = "cc0a313462243900b6c843ff427b7f0e";
action.track = "guest";
action.syncAfterVMResume = true;
action.intervalInSeconds = 60;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVmClockTrackAction.Result res = action.call();Python SDK
action = SetVmClockTrackAction()
action.uuid = "cc0a313462243900b6c843ff427b7f0e"
action.track = "guest"
action.syncAfterVMResume = true
action.intervalInSeconds = 60
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()