VM Related Interfaces
Change Virtual Machine NIC L3 Network
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {},
"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 POST -d '{"params":{}}' http://localhost:8080/zstack/v1/vm-instances/nics/1183a0462aa83243a659ff91326888fb/l3-networks/e46ab07103763f0dbd3e99af2e3be4b0Parameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| vmNicUuid | String | url | Virtual Machine NIC UUID | 4.1.0 | |
| destL3NetworkUuid | String | url | 4.1.0 | ||
| systemTags (Optional) | List | body | System Tag | 4.1.0 | |
| userTags (Optional) | List | body | User Tag | 4.1.0 | |
| staticIp (Optional) | String | body (contained in params structure) | 0.6 | ||
| vmNicParams (Optional) | String | body (contained in params structure) | NIC information | 4.2.0 |
API Response
Response Example
{
"inventory": {
"uuid": "9d4cdab9192b3de3b2495b1e326910c7",
"vmInstanceUuid": "0ae9a1992fb436a58e820bdcb4dd17c4",
"usedIpUuid": "c0c5860c05ce3e70b14b4f501fedff71",
"l3NetworkUuid": "9390346b3a8a3c829b05dbe30569390a",
"ip": "192.168.1.10",
"mac": "00:0c:29:bd:99:fc",
"netmask": "255.255.255.0",
"gateway": "192.168.1.1",
"deviceId": 0
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 0.6 | |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation is successful. For details, see error | 4.1.0 |
| inventory | VmNicInventory | For details, see inventory | 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 caused the current error. If there is no original error, this field is null | 4.1.0 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the resource, uniquely identifies 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 | Hypervisor 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 state | 4.7.13 |
| createDate | Timestamp | Create time | 4.1.0 |
| lastOpDate | Timestamp | Last modification time | 4.1.0 |
| usedIps | List | For details, see usedIps | 4.1.0 |
usedIps
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the resource, uniquely identifies 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 | Virtual Machine NIC UUID | 4.1.0 |
| createDate | Timestamp | Create time | 4.1.0 |
| lastOpDate | Timestamp | Last modification time | 4.1.0 |
SDK Examples
Java SDK
ChangeVmNicNetworkAction action = new ChangeVmNicNetworkAction();
action.vmNicUuid = "1183a0462aa83243a659ff91326888fb";
action.destL3NetworkUuid = "e46ab07103763f0dbd3e99af2e3be4b0";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeVmNicNetworkAction.Result res = action.call();Python SDK
action = ChangeVmNicNetworkAction()
action.vmNicUuid = "1183a0462aa83243a659ff91326888fb"
action.destL3NetworkUuid = "e46ab07103763f0dbd3e99af2e3be4b0"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()