Create Host Kernel Interface
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "zs-kernel",
"description": "test-description",
"hostUuid": "ac64f7d9591b34b5a9286d7124e9787c",
"l2NetworkUuid": "c68967a38bf132bf96f7ca42cdc5c47b",
"l3NetworkUuid": "1c9547c6bd89392e8c0f50efa83ac990",
"requiredIp": "172.16.1.1",
"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":{"name":"zs-kernel","description":"test-description","hostUuid":"ac64f7d9591b34b5a9286d7124e9787c","l2NetworkUuid":"c68967a38bf132bf96f7ca42cdc5c47b","l3NetworkUuid":"1c9547c6bd89392e8c0f50efa83ac990","requiredIp":"172.16.1.1","netmask":"255.255.255.0","trafficTypes":["Management"]}}' http://localhost:8080/zstack/v1/l2-networks/kernel-interfacesParameter List
Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
name | String | body(contained in params structure) | Resource name |
| 4.1.0 |
description (Optional) | String | body(contained in params structure) | Resource description |
| 4.1.0 |
hostUuid | String | body(contained in params structure) | Host UUID |
| 4.1.0 |
l2NetworkUuid | String | body(contained in params structure) | Port group Distributed Switch UUID |
| 4.1.0 |
l3NetworkUuid | String | body(contained in params structure) | Distributed Port Group UUID |
| 4.1.0 |
requiredIp (Optional) | String | body(contained in params structure) | Required IP |
| 4.1.0 |
netmask (Optional) | String | body(contained in params structure) | Netmask |
| 4.1.0 |
trafficTypes (Optional) | List | body(contained in params structure) | Traffic type |
| 4.1.0 |
resourceUuid (Optional) | String | body(contained in params structure) | Resource UUID |
| 4.1.0 |
tagUuids (Optional) | List | body(contained in params structure) | Tag UUID list |
| 4.1.0 |
systemTags (Optional) | List | body | System tags |
| 4.1.0 |
userTags (Optional) | List | body | User tags |
| 4.1.0 |
API Response
Response Example
{
"inventory": {
"uuid": "748beaeb70273060a8b599d871a195e6",
"name": "test-kernel",
"description": "test-kernel",
"hostUuid": "3a620091153d3027af5df7c27a0f8fd8",
"l2NetworkUuid": "f66b2fcb35ae3779a69447cf56a153e3",
"l3NetworkUuid": "c2372a1dd7ce338d80ce1de8c658e9a6",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.1.0 | |
| inventory | HostKernelInterfaceInventory | See inventory | 4.1.0 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. See error | 4.1.0 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | UUID of the resource, uniquely identifies the resource | 4.1.0 |
| name | String | Resource name | 4.1.0 |
| description | String | Resource description | 4.1.0 |
| hostUuid | String | Host UUID | 4.1.0 |
| l2PortGroupUuid | String | Port group UUID | 4.1.0 |
| l3NetworkUuid | String | Distributed Port Group UUID | 4.1.0 |
| usedIps | List | IP configuration | 4.1.0 |
| trafficTypes | List | Traffic type | 4.1.0 |
| createDate | Timestamp | Create date | 4.1.0 |
| lastOpDate | Timestamp | Last update date | 4.1.0 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code, a globally unique identifier of the error, e.g. 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, null if no original error | 4.1.0 |
SDK Examples
Java SDK
CreateHostKernelInterfaceAction action = new CreateHostKernelInterfaceAction();
action.name = "zs-kernel";
action.description = "test-description";
action.hostUuid = "ac64f7d9591b34b5a9286d7124e9787c";
action.l2NetworkUuid = "c68967a38bf132bf96f7ca42cdc5c47b";
action.l3NetworkUuid = "1c9547c6bd89392e8c0f50efa83ac990";
action.requiredIp = "172.16.1.1";
action.netmask = "255.255.255.0";
action.trafficTypes = asList("Management");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateHostKernelInterfaceAction.Result res = action.call();Python SDK
CreateHostKernelInterfaceAction action = CreateHostKernelInterfaceAction()
action.name = "zs-kernel"
action.description = "test-description"
action.hostUuid = "ac64f7d9591b34b5a9286d7124e9787c"
action.l2NetworkUuid = "c68967a38bf132bf96f7ca42cdc5c47b"
action.l3NetworkUuid = "1c9547c6bd89392e8c0f50efa83ac990"
action.requiredIp = "172.16.1.1"
action.netmask = "255.255.255.0"
action.trafficTypes = [Management]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateHostKernelInterfaceAction.Result res = action.call()