VM Related Interfaces

Set Virtual Machine DNS

PUT/zstack/v1/vm-instances/{vmInstanceUuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "setVmDns": {
    "vmNicUuid": "ff06b3f6ce3939d78731832c5ac97000",
    "dnsList": [
      "223.5.5.5"
    ],
    "ipVersion": 4
  },
  "systemTags": [],
  "userTags": []
}

In the example above, systemTags and userTags fields can be omitted. They are listed to indicate that these two fields can be included in the body.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setVmDns":{"vmNicUuid":"ff06b3f6ce3939d78731832c5ac97000","dnsList":["223.5.5.5"],"ipVersion":4}}' \
http://localhost:8080/zstack/v1/vm-instances/ff01ec80fd11327cba7519b66119d900/actions

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

vmInstanceUuid

String

url

Virtual Machine UUID

 

4.10.10

vmNicUuid (Optional)

String

body(included in the setVmDns structure)

Virtual Machine NIC UUID

 

4.10.10

dnsList

List

body(included in the setVmDns structure)

DNS List

 

4.10.10

ipVersion (Optional)

Integer

body(included in the setVmDns structure)

IP Protocol Number

  • 4
  • 6

4.10.10

systemTags (Optional)

List

body

System Tag

 

4.10.10

userTags (Optional)

List

body

User Tag

 

4.10.10

API Response

Response Example

{
  "inventories": [
    {
      "vmInstanceUuid": "ff01ec80fd11327cba7519b66119d900",
      "dns": "223.5.5.5",
      "ipVersion": 4,
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    }
  ]
}
NameTypeDescriptionStarting Version
successboolean 4.10.10
inventoriesListFor details, see inventories4.10.10
errorErrorCodeError code. If not null, the operation failed. When the operation is successful, this field is null. For details, see error4.10.10

inventories

NameTypeDescriptionStarting Version
vmInstanceUuidStringVirtual Machine UUID4.10.10
vmNicUuidStringVirtual Machine NIC UUID4.10.10
dnsStringDNS Address4.10.10
ipVersionIntegerIP Protocol Number4.10.10
createDateTimestampCreate time4.10.10
lastOpDateTimestampLast modification time4.10.10

error

NameTypeDescriptionStarting Version
codeStringError code number, globally unique identifier of the error, for example SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, default is null0.6
opaqueLinkedHashMapReserved field, default is null0.6
causeErrorCodeRoot cause: the source error that triggered the current error. If there is no original error, this field is null0.6

SDK Examples

Java SDK

SetVmDnsAction action = new SetVmDnsAction();
action.vmInstanceUuid = "ff01ec80fd11327cba7519b66119d900";
action.vmNicUuid = "ff06b3f6ce3939d78731832c5ac97000";
action.dnsList = asList("223.5.5.5");
action.ipVersion = 4;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVmDnsAction.Result res = action.call();

Python SDK

SetVmDnsAction action = SetVmDnsAction()
action.vmInstanceUuid = "ff01ec80fd11327cba7519b66119d900"
action.vmNicUuid = "ff06b3f6ce3939d78731832c5ac97000"
action.dnsList = [223.5.5.5]
action.ipVersion = 4
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetVmDnsAction.Result res = action.call()