Document navigation

UpdateVmNetworkConfig

API Request

URLs

PUT zstack/v1/vm-instances/{vmInstanceUuid}/update-nic-config

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateVmNetworkConfig": {
    "vmNicUuids": [
      "afb48d4bfd193c6b9d46b866cb29a767"
    ]
  },
  "systemTags": [],
  "userTags": []
}

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 '{"updateVmNetworkConfig":{"vmNicUuids":["afb48d4bfd193c6b9d46b866cb29a767"]}}' \
http://localhost:8080/zstack/v1/vm-instances/1c8470e916873fe6ae0251c3f592a6c4/update-nic-config

Required Parameters

Name Type Location Description Valid Values Starting Version
vmInstanceUuid String url The VM instance UUID. 4.6.21
vmNicUuids List body (contained in the updateVmNetworkConfig srtucture). The VM instance nic UUIDs. 4.6.21
systemTags List body Optional. The system tags. 4.6.21
userTags List body Optional. The user tags. 4.6.21

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
    "error": {
        "code": "SYS.1001",
        "description": "A message or a operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK

UpdateVmNetworkConfigAction action = new UpdateVmNetworkConfigAction();
action.vmInstanceUuid = "1c8470e916873fe6ae0251c3f592a6c4";
action.vmNicUuids = asList("afb48d4bfd193c6b9d46b866cb29a767");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVmNetworkConfigAction.Result res = action.call();

Python SDK

action = UpdateVmNetworkConfigAction()
action.vmInstanceUuid = "1c8470e916873fe6ae0251c3f592a6c4"
action.vmNicUuids = [afb48d4bfd193c6b9d46b866cb29a767]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()