Batch Create Host Kernel Interface

POST/zstack/v1/l3-networks/{l3NetworkUuid}/kernel-interfaces

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "structs": [
      {
        "name": "host-kernel-interface-1",
        "description": "example",
        "hostUuid": "ff0192fa70113da886101145c084bd00",
        "ip": "192.168.0.1",
        "netmask": "255.255.255.0"
      },
      {
        "name": "host-kernel-interface-2",
        "description": "example",
        "hostUuid": "ff0956f0005a313e8e1178392c01cd00",
        "ip": "192.168.0.2",
        "netmask": "255.255.255.0"
      }
    ],
    "trafficTypes": [
      "Management"
    ]
  },
  "systemTags": [],
  "userTags": []
}

The systemTags and userTags fields can be omitted in the above example. 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":{"structs":[{"name":"host-kernel-interface-1","description":"example","hostUuid":"ff0192fa70113da886101145c084bd00","ip":"192.168.0.1","netmask":"255.255.255.0"},{"name":"host-kernel-interface-2","description":"example","hostUuid":"ff0956f0005a313e8e1178392c01cd00","ip":"192.168.0.2","netmask":"255.255.255.0"}],"trafficTypes":["Management"]}}' \
http://localhost:8080/zstack/v1/l3-networks/ff07d561c51c3ef996d682825dcff700/kernel-interfaces

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

structs

List

body(contained in params structure)

Kernel adapter structure list

 

4.10.20

l3NetworkUuid

String

url

Distributed Port Group UUID

 

4.10.20

trafficTypes (Optional)

List

body(contained in params structure)

Traffic type

  • Management
  • Storage

4.10.20

systemTags (Optional)

List

body

System tags

 

4.10.20

userTags (Optional)

List

body

User tags

 

4.10.20

API Response

Response Example

{
  "results": [
    {
      "inventory": {
        "uuid": "ff054502e59933a8a494cea5dc88d700",
        "name": "host-kernel-interface",
        "description": "example",
        "hostUuid": "ff0192fa70113da886101145c084bd00",
        "l2NetworkUuid": "ff0915ef0d3e32708d3150708a72c400",
        "l3NetworkUuid": "ff07d561c51c3ef996d682825dcff700",
        "usedIps": [
          {
            "hostKernelInterfaceUuid": "ff054502e59933a8a494cea5dc88d700",
            "uuid": "ff0d1627c13c3337a92767d011d03a00",
            "l3NetworkUuid": "ff07d561c51c3ef996d682825dcff700",
            "ipVersion": 4,
            "ip": "192.168.0.2",
            "netmask": "255.255.255.0",
            "ipInLong": 3232235522,
            "ipInBinary": [
              -64,
              -88,
              0,
              2
            ],
            "createDate": "Nov 14, 2017 2:20:57 PM",
            "lastOpDate": "Nov 14, 2017 2:20:57 PM"
          }
        ],
        "trafficTypes": [
          "Management"
        ],
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    }
  ]
}
NameTypeDescriptionStarting Version
successboolean 4.10.20
resultsListSee results4.10.20
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. See error4.10.20

results

NameTypeDescriptionStarting Version
errorErrorCodeSee error4.10.20
inventoryHostKernelInterfaceInventorySee inventory4.10.20

error

NameTypeDescriptionStarting Version
codeStringError code, a globally unique identifier of the error, e.g. SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, defaults to null0.6
opaqueLinkedHashMapReserved field, defaults to null0.6
causeErrorCodeRoot cause, the source error that caused the current error, null if no original error0.6

inventory

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifies the resource4.1.0
nameStringResource name4.1.0
descriptionStringResource description4.1.0
hostUuidStringHost UUID4.1.0
l2NetworkUuidStringDistributed Switch UUID4.1.0
l3NetworkUuidStringDistributed Port Group UUID4.1.0
trafficTypesListTraffic type4.1.0
createDateTimestampCreate date4.1.0
lastOpDateTimestampLast update date4.1.0
usedIpsListSee usedIps4.1.0

usedIps

NameTypeDescriptionStarting Version
hostKernelInterfaceUuidStringKernel adapter UUID4.1.0
uuidStringUUID of the resource, uniquely identifies the resource4.1.0
ipRangeUuidStringIP Range UUID4.1.0
l3NetworkUuidStringDistributed Port Group UUID4.1.0
ipVersionIntegerIP protocol number4.1.0
ipStringIP address4.1.0
netmaskStringNetmask4.1.0
gatewayStringGateway address4.1.0
usedForStringAllocation reason4.1.0
ipInLongLongIP address stored in long format, only valid for IPv44.1.0
vmNicUuidStringVirtual Machine NIC UUID4.1.0
createDateTimestampCreate date4.1.0
lastOpDateTimestampLast update date4.1.0

error

NameTypeDescriptionStarting Version
codeStringError code, a globally unique identifier of the error, e.g. SYS.1000, HOST.10014.1.0
descriptionStringBrief description of the error4.1.0
detailsStringDetailed error information4.1.0
elaborationStringReserved field, defaults to null4.1.0
opaqueLinkedHashMapReserved field, defaults to null4.1.0
causeErrorCodeRoot cause, the source error that caused the current error, null if no original error4.1.0

SDK Examples

Java SDK

BatchCreateHostKernelInterfaceAction action = new BatchCreateHostKernelInterfaceAction();
action.structs = asList([name:host-kernel-interface-1, description:example, hostUuid:ff0192fa70113da886101145c084bd00, ip:192.168.0.1, netmask:255.255.255.0],[name:host-kernel-interface-2, description:example, hostUuid:ff0956f0005a313e8e1178392c01cd00, ip:192.168.0.2, netmask:255.255.255.0]);
action.l3NetworkUuid = "ff07d561c51c3ef996d682825dcff700";
action.trafficTypes = asList("Management");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
BatchCreateHostKernelInterfaceAction.Result res = action.call();

Python SDK

action = BatchCreateHostKernelInterfaceAction()
action.structs = [[name:host-kernel-interface-1, description:example, hostUuid:ff0192fa70113da886101145c084bd00, ip:192.168.0.1, netmask:255.255.255.0], [name:host-kernel-interface-2, description:example, hostUuid:ff0956f0005a313e8e1178392c01cd00, ip:192.168.0.2, netmask:255.255.255.0]]
action.l3NetworkUuid = "ff07d561c51c3ef996d682825dcff700"
action.trafficTypes = [Management]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()