CreateBonding
API Request
URLs
POST zstack/v1/hosts/bondingsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"hostUuids": [
"83e1a4a2ca0d3b0e836b032118196455"
],
"type": "LinuxBonding",
"mode": "802.3ad",
"xmitHashPolicy": "layer2+3"
},
"systemTags": [],
"userTags": []
}
Note: 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 POST -d '{"params":{"hostUuids":["83e1a4a2ca0d3b0e836b032118196455"],"type":"LinuxBonding","mode":"802.3ad","xmitHashPolicy":"layer2+3"}}' http://localhost:8080/zstack/v1/hosts/bondingsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| hostUuids | List | body (contained in the params structure) | The host UUID list. | 5.0.0 | |
| bondingName | String | body (contained in the params structure) | The bond name. | 4.7.0 | |
| slaveUuids | List | body (contained in the params structure) | Optional. The slave interface UUIDs list. | 5.0.0 | |
| slaveNames | List | body (contained in the params structure) | Optional. The slave interface name lise. | 5.0.0 | |
| type | String | body (contained in the params structure) | The bond type. |
|
4.7.0 |
| mode | String | body (contained in the params structure) | The bond mode. |
|
4.7.0 |
| xmitHashPolicy | String | body (contained in the params structure) | Optional. The hash policy. |
|
4.7.0 |
| description | String | body (contained in the params structure) | Optional. The resource description. | 4.7.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 4.7.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUID list. | 4.7.0 | |
| systemTags | List | body | Optional. The system tags. | 4.7.0 | |
| userTags | List | body | Optional. The user tags. | 4.7.0 |
API Response
Sample
Response
{
"inventory": [
{
"hostUuid": "ad58bd08605338648dce127f256f332e",
"bondingName": "test",
"mode": "802.3ad",
"xmitHashPolicy": "layer2+3",
"ipAddresses": [
"192.168.1.1"
],
"type": "LinuxBonding",
"slaves": [
{
"uuid": "97e1e9fb0cd73af8bd3e84376e59fa26",
"hostUuid": "ad58bd08605338648dce127f256f332e",
"interfaceName": "eno1",
"interfaceType": "bondingSlave",
"speed": 1000,
"slaveActive": true,
"carrierActive": true,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.7.0 | |
| inventory | List | See inventory. | 4.7.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.7.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.7.0 |
| hostUuid | String | The host UUID. | 4.7.0 |
| bondingName | String | The bond name. | 4.7.0 |
| bondingType | String | The bond application type. Options: noBridge and bridgeSlave. | 4.7.0 |
| speed | Long | The bond speed. | 4.7.0 |
| mode | String | The bond mode. | 4.7.0 |
| xmitHashPolicy | String | The hash policy. | 4.7.0 |
| miiStatus | String | The MII status. | 4.7.0 |
| mac | String | The MAC address. | 4.7.0 |
| ipAddresses | List | The IP address. | 4.7.0 |
| gateway | String | The gateway address. | 4.7.0 |
| callBackIp | String | The callback IP address. | 4.7.0 |
| miimon | Long | The MII monitoring interval. | 4.7.0 |
| type | String | The bond type. | 4.7.0 |
| allSlavesActive | Boolean | 4.7.0 | |
| description | String | The resource description. | 4.7.0 |
| createDate | Timestamp | The creation time. | 4.7.0 |
| lastOpDate | Timestamp | The last operation time. | 4.7.0 |
| slaves | List | See slaves. | 4.7.0 |
#slaves
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.7.0 |
| hostUuid | String | The host UUID. | 4.7.0 |
| bondingUuid | String | The bond UUID. | 4.7.0 |
| interfaceModel | String | The interface model. | 5.0.0 |
| vendorId | String | The vendor Id. | 5.0.0 |
| deviceId | String | The device Id. | 5.0.0 |
| subvendorId | String | The subset vendor Id. | 5.0.0 |
| subdeviceId | String | The subset device Id. | 5.0.0 |
| interfaceName | String | The interface name. | 4.7.0 |
| interfaceType | String | The interface type. Options: nomaster,bridgeSlave, and bondSlave. | 4.7.0 |
| speed | Long | The interface speed. | 4.7.0 |
| slaveActive | Boolean | The bond link status. | 4.7.0 |
| carrierActive | Boolean | The physical link status. | 4.7.0 |
| ipAddresses | List | The IP address. | 4.7.0 |
| gateway | String | The gateway address. | 4.7.0 |
| mac | String | The MAC address. | 4.7.0 |
| callBackIp | String | The callback IP address. | 4.7.0 |
| pciDeviceAddress | String | The PCI address of the interface. | 4.7.0 |
| offloadStatus | String | 4.7.0 | |
| description | String | The resource description. | 4.7.0 |
| createDate | Timestamp | The creation time. | 4.7.0 |
| lastOpDate | Timestamp | The last operation time. | 4.7.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 4.7.0 |
| description | String | The brief description of the error. | 4.7.0 |
| details | String | The details about the error. | 4.7.0 |
| elaboration | String | The reserved field. Default value: null. | 4.7.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.7.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 4.7.0 |
SDK Sample
Java
SDK
CreateBondingAction action = new CreateBondingAction();
action.hostUuids = asList("83e1a4a2ca0d3b0e836b032118196455");
action.type = "LinuxBonding";
action.mode = "802.3ad";
action.xmitHashPolicy = "layer2+3";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateBondingAction.Result res = action.call();Python
SDK
CreateBondingAction action = CreateBondingAction()
action.hostUuids = [83e1a4a2ca0d3b0e836b032118196455]
action.type = "LinuxBonding"
action.mode = "802.3ad"
action.xmitHashPolicy = "layer2+3"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateBondingAction.Result res = action.call()