获取主机交集网卡信息
Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/cluster/hosts-network-interfaces?hostUuids=5712f3960ae23d24988f4e091bf5704f&interfaceType=all&intersecting=true&limit=1000&start=0参数列表
名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
hostUuids | List | query | 主机UUIDs |
| 4.7.0 |
interfaceType (可选) | String | query | 网卡类型 |
| 4.1.0 |
limit (可选) | Integer | query |
|
| 4.7.0 |
start (可选) | Integer | query |
|
| 4.7.0 |
systemTags (可选) | List | body | 系统标签 |
| 4.7.0 |
userTags (可选) | List | body | 用户标签 |
| 4.7.0 |
intersecting (可选) | boolean | query |
|
| 4.1.0 |
API返回
返回示例
{
"slaveNames": [
"eth0",
"eth1"
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| slaveNames | List | 网卡名称 | 4.7.0 |
| success | boolean | 4.7.0 | |
| candidateNics | List | 详情参考candidateNics | 4.7.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.7.0 |
candidateNics
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 3.5.0 |
| hostUuid | String | 主机UUID | 3.5.0 |
| bondingUuid | String | Bond UUID | 3.5.0 |
| interfaceName | String | 网卡名称 | 3.5.0 |
| interfaceType | String | 网卡应用状态,有nomaster、bridgeSlave、bondSlave | 3.5.0 |
| speed | Long | 网卡速率 | 3.5.0 |
| slaveActive | Boolean | Bond链路状态 | 3.5.0 |
| carrierActive | Boolean | 物理链路状态 | 3.5.0 |
| ipAddresses | List | IP地址 | 3.5.0 |
| gateway | String | 网关地址 | 4.7.0 |
| mac | String | MAC地址 | 3.5.0 |
| callBackIp | String | 回调地址 | 4.7.0 |
| pciDeviceAddress | String | 网卡PCI地址 | 3.5.0 |
| offloadStatus | String | 4.7.0 | |
| description | String | 资源的详细描述 | 4.7.0 |
| createDate | Timestamp | 创建时间 | 3.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 3.5.0 |
error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
SDK示例
Java SDK
GetCandidateNetworkInterfacesAction action = new GetCandidateNetworkInterfacesAction();
action.hostUuids = asList("5712f3960ae23d24988f4e091bf5704f");
action.interfaceType = "all";
action.intersecting = true;
action.limit = 1000;
action.start = 0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetCandidateNetworkInterfacesAction.Result res = action.call();Python SDK
GetCandidateNetworkInterfacesAction action = GetCandidateNetworkInterfacesAction()
action.hostUuids = [5712f3960ae23d24988f4e091bf5704f]
action.interfaceType = "all"
action.intersecting = true
action.limit = 1000
action.start = 0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetCandidateNetworkInterfacesAction.Result res = action.call()