获取主机交集网卡信息

GET/zstack/v1/cluster/hosts-network-interfaces

Headers

Authorization: OAuth the-session-uuid

Curl示例

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

网卡类型

  • interface
  • bonding
  • all

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"
  ]
}
名字类型描述起始版本
slaveNamesList网卡名称4.7.0
successboolean 4.7.0
candidateNicsList详情参考candidateNics4.7.0
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error4.7.0

candidateNics

名字类型描述起始版本
uuidString资源的UUID,唯一标示该资源3.5.0
hostUuidString主机UUID3.5.0
bondingUuidStringBond UUID3.5.0
interfaceNameString网卡名称3.5.0
interfaceTypeString网卡应用状态,有nomaster、bridgeSlave、bondSlave3.5.0
speedLong网卡速率3.5.0
slaveActiveBooleanBond链路状态3.5.0
carrierActiveBoolean物理链路状态3.5.0
ipAddressesListIP地址3.5.0
gatewayString网关地址4.7.0
macStringMAC地址3.5.0
callBackIpString回调地址4.7.0
pciDeviceAddressString网卡PCI地址3.5.0
offloadStatusString 4.7.0
descriptionString资源的详细描述4.7.0
createDateTimestamp创建时间3.5.0
lastOpDateTimestamp最后一次修改时间3.5.0

error

名字类型描述起始版本
codeString错误码号,错误的全局唯一标识,例如SYS.1000, HOST.10010.6
descriptionString错误的概要描述0.6
detailsString错误的详细信息0.6
elaborationString保留字段,默认为null0.6
opaqueLinkedHashMap保留字段,默认为null0.6
causeErrorCode根错误,引发当前错误的源错误,若无原错误,该字段为null0.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()