UpdateVmInstance
API Request
URLs
PUT zstack/v1/vm-instances/{uuid}/actionsHeaders
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.
{
"updateVmInstance": {
"name": "new vm name"
},
"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 PUT -d '{"updateVmInstance":{"name":"new vm name"}}' http://localhost:8080/zstack/v1/vm-instances/dfa2feae60f431ac8d5f071f5594cfc1/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The VM instance UUID. | 0.6 | |
| name | String | body (contained in the updateVmInstance structure) | Optional. The VM instance name. | 0.6 | |
| description | String | body (contained in the updateVmInstance structure) | Optional. The detailed description of the VM instance. | 0.6 | |
| state | String | body (contained in the updateVmInstance structure) | Optional. The state of the VM instance.
|
|
0.6 |
| defaultL3NetworkUuid | String | body (contained in the updateVmInstance structure) | Optional. The UUID of the default L3 network. | 0.6 | |
| platform | String | body (contained in the updateVmInstance structure) | Optional. The platform type of the VM instance. |
|
0.6 |
| cpuNum | Integer | body (contained in the updateVmInstance structure) | Optional.
|
0.6 | |
| memorySize | Long | body (contained in the updateVmInstance structure) | Optional.
|
0.6 | |
| guestOsType | String | body (contained in the updateVmInstance structure) | Optional. | 4.1.0 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"uuid": "6710cdffb0653455809b6511a6b3aaa4",
"name": "new vm name",
"description": "web server VM",
"zoneUuid": "aa63c5a3b3c436fa94e5e851f057fe23",
"clusterUuid": "48b424d94ed239f1b18e1ce37db24cf8",
"imageUuid": "4e1ac550da8d30c7b07162acc39773c1",
"hostUuid": "1f3ffea4673e3e4197681ee030d1794b",
"lastHostUuid": "d334dadb7cfc34da8f6f7d74dfd04692",
"instanceOfferingUuid": "33b38aff5cbe3e24a9266300f7163d20",
"rootVolumeUuid": "761df8e1eef933ee8d7f3b7f8551b754",
"platform": "Linux",
"defaultL3NetworkUuid": "3a3c91f4a28a31beb410d6d1c3dc862c",
"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": "ae19167e24713aeea9c45e6f2d27249d",
"vmInstanceUuid": "6710cdffb0653455809b6511a6b3aaa4",
"usedIpUuid": "010f4817011b32d3b476faa3f393d765",
"l3NetworkUuid": "3a3c91f4a28a31beb410d6d1c3dc862c",
"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": "761df8e1eef933ee8d7f3b7f8551b754",
"name": "Root-Volume-For-VM-6710cdffb0653455809b6511a6b3aaa4",
"primaryStorageUuid": "da81ed018a9738ff97a16d7b7a43327d",
"vmInstanceUuid": "6710cdffb0653455809b6511a6b3aaa4",
"diskOfferingUuid": "bd9b406d36c13fc7ad3f995535415898",
"rootImageUuid": "4e1ac550da8d30c7b07162acc39773c1",
"installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-761df8e1eef933ee8d7f3b7f8551b754/761df8e1eef933ee8d7f3b7f8551b754.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. | 0.6 |
| inventory | VmInstanceInventory | See inventory. | 0.6 |
#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. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| zoneUuid | String | The zone UUID. | 0.6 |
| clusterUuid | String | The cluster UUID. | 0.6 |
| imageUuid | String | The image UUID. | 0.6 |
| hostUuid | String | The host UUID. | 0.6 |
| lastHostUuid | String | 0.6 | |
| instanceOfferingUuid | String | The instance offering UUID. | 0.6 |
| rootVolumeUuid | String | The root volume UUID. | 0.6 |
| platform | 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 | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| state | String | 0.6 | |
| vmNics | List | See vmNics. | 0.6 |
| allVolumes | List | See allVolumes. | 0.6 |
#vmNics
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| vmInstanceUuid | String | The VM instance UUID. | 0.6 |
| l3NetworkUuid | String | The L3 network UUID. | 0.6 |
| ip | String | 4.1.0 | |
| mac | String | 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 | 0.6 | |
| ipVersion | Integer | The IP version. | 3.1.0 |
| deviceId | Integer | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| usedIps | List | See usedIps. | 0.6 |
#usedIps
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| ipRangeUuid | String | The IP range UUID. | 0.6 |
| l3NetworkUuid | String | The L3 network UUID. | 0.6 |
| ipVersion | Integer | The IP version. | 3.1.0 |
| ip | String | The IP address. | 0.6 |
| netmask | String | The netmask. | 0.6 |
| gateway | String | The gateway. | 0.6 |
| usedFor | String | 0.6 | |
| ipInLong | long | 0.6 | |
| vmNicUuid | String | The VM NIC UUID. | 3.1.0 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
#allVolumes
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| primaryStorageUuid | String | The primary storage UUID. | 0.6 |
| vmInstanceUuid | String | The VM instance UUID. | 0.6 |
| diskOfferingUuid | String | The disk offering UUID. | 0.6 |
| 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 format. | 4.1.0 |
| size | Long | The volume size. | 4.1.0 |
| actualSize | Long | The actual size of the volume. | 4.1.0 |
| deviceId | Integer | 0.6 | |
| state | String | Indicates whether the volume is enabled. | 4.1.0 |
| status | String | Th status of the volume. | 4.1.0 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| isShareable | Boolean | 0.6 |
SDK Sample
Java
SDK
UpdateVmInstanceAction action = new UpdateVmInstanceAction();
action.uuid = "c424899cef6f4723baf0aae3acbe6020";
action.name = "new vm name";
action.sessionId = "4320eeda74fa41788522c75ed42ec889";
UpdateVmInstanceAction.Result res = action.call();Python
SDK
UpdateVmInstanceAction action = UpdateVmInstanceAction()
action.uuid = "fb287c6cb9134d208d1ed054577ad249"
action.name = "new vm name"
action.sessionId = "2f01595d029449dbbf6c052ad1914271"
UpdateVmInstanceAction.Result res = action.call()