获取主机物理网络信息

GET/zstack/v1/hosts/network-facts/{hostUuid}

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/hosts/network-facts/9397de8c860231c08b87031e226c691b

参数列表

名字类型位置描述可选值起始版本
hostUuidStringurl主机UUID 3.5.0
systemTags (可选)Listquery  3.5.0
userTags (可选)Listquery  3.5.0

API返回

返回示例

{
  "bondings": [
    {
      "uuid": "c1ff34db684e3b8785572902ef99efea",
      "hostUuid": "e336fa8ef9283fe4a4d746957284379a",
      "bondingName": "bond0",
      "mode": "active-backup 1",
      "xmitHashPolicy": "layer2 0",
      "miiStatus": "up",
      "mac": "ac:1f:6b:93:6c:8c",
      "ipAddresses": [
        "172.20.0.116/16"
      ],
      "miimon": 100.0,
      "allSlavesActive": true,
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM",
      "slaves": [
        {
          "uuid": "08643629c29d34a0a4a2d858b49a41a4",
          "hostUuid": "e336fa8ef9283fe4a4d746957284379a",
          "bondingUuid": "c1ff34db684e3b8785572902ef99efea",
          "interfaceName": "eno1",
          "interfaceType": "bondingSlave",
          "speed": 1000.0,
          "slaveActive": true,
          "carrierActive": true,
          "mac": "ac:1f:6b:93:6c:8c",
          "createDate": "Nov 14, 2017 10:20:57 PM",
          "lastOpDate": "Nov 14, 2017 10:20:57 PM"
        },
        {
          "uuid": "14ca7ad13e573cfdb6f929b12b750553",
          "hostUuid": "e336fa8ef9283fe4a4d746957284379a",
          "bondingUuid": "c1ff34db684e3b8785572902ef99efea",
          "interfaceName": "eno2",
          "interfaceType": "bondingSlave",
          "speed": 1000.0,
          "slaveActive": false,
          "carrierActive": false,
          "mac": "ac:1f:6b:93:6c:8c",
          "createDate": "Nov 14, 2017 10:20:57 PM",
          "lastOpDate": "Nov 14, 2017 10:20:57 PM"
        }
      ]
    }
  ],
  "nics": [
    {
      "uuid": "08643629c29d34a0a4a2d858b49a41a4",
      "hostUuid": "e336fa8ef9283fe4a4d746957284379a",
      "bondingUuid": "c1ff34db684e3b8785572902ef99efea",
      "interfaceName": "eno1",
      "interfaceType": "bondingSlave",
      "speed": 1000.0,
      "slaveActive": true,
      "carrierActive": true,
      "mac": "ac:1f:6b:93:6c:8c",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    },
    {
      "uuid": "14ca7ad13e573cfdb6f929b12b750553",
      "hostUuid": "e336fa8ef9283fe4a4d746957284379a",
      "bondingUuid": "c1ff34db684e3b8785572902ef99efea",
      "interfaceName": "eno2",
      "interfaceType": "bondingSlave",
      "speed": 1000.0,
      "slaveActive": false,
      "carrierActive": false,
      "mac": "ac:1f:6b:93:6c:8c",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    },
    {
      "uuid": "8d871eb89020363ebc764ed41be4c213",
      "hostUuid": "e336fa8ef9283fe4a4d746957284379a",
      "interfaceName": "ens2f0",
      "interfaceType": "noMaster",
      "speed": 1000.0,
      "slaveActive": true,
      "carrierActive": true,
      "ipAddresses": [
        "169.254.0.115/24"
      ],
      "mac": "98:03:9b:00:ea:f2",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    },
    {
      "uuid": "d39d0eead2d53e47a8f7b3aca375c1d3",
      "hostUuid": "e336fa8ef9283fe4a4d746957284379a",
      "interfaceName": "ens2f1",
      "interfaceType": "bridgeSlave",
      "speed": 1000.0,
      "slaveActive": false,
      "carrierActive": false,
      "mac": "98:03:9b:00:ea:f3",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
名字类型描述起始版本
successboolean 3.5.0
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error3.5.0
bondingsList详情参考bondings3.5.0
nicsList详情参考nics3.5.0
errorErrorCode详情参考error3.5.0

error

名字类型描述起始版本
codeString错误码号,错误的全局唯一标识,例如SYS.1000, HOST.10013.5.0
descriptionString错误的概要描述3.5.0
detailsString错误的详细信息3.5.0
elaborationString保留字段,默认为null3.5.0
opaqueLinkedHashMap保留字段,默认为null3.5.0
causeErrorCode根错误,引发当前错误的源错误,若无原错误,该字段为null3.5.0

bondings

名字类型描述起始版本
uuidString资源的UUID,唯一标示该资源3.5.0
hostUuidString主机UUID3.5.0
bondingNameStringBond名称3.5.0
modeStringBond模式3.5.0
xmitHashPolicyString哈希策略3.5.0
miiStatusStringmii状态3.5.0
macStringMAC地址3.5.0
ipAddressesListIP地址3.5.0
miimonLongmii监控间隔3.5.0
allSlavesActiveBoolean 3.5.0
createDateTimestamp创建时间3.5.0
lastOpDateTimestamp最后一次修改时间3.5.0
slavesList详情参考slaves3.5.0

slaves

名字类型描述起始版本
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
macStringMAC地址3.5.0
pciDeviceAddressString网卡PCI地址3.5.0
createDateTimestamp创建时间3.5.0
lastOpDateTimestamp最后一次修改时间3.5.0

nics

名字类型描述起始版本
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
macStringMAC地址3.5.0
pciDeviceAddressString网卡PCI地址3.5.0
createDateTimestamp创建时间3.5.0
lastOpDateTimestamp最后一次修改时间3.5.0

error

名字类型描述起始版本
codeString错误码号,错误的全局唯一标识,例如SYS.1000, HOST.10013.5.0
descriptionString错误的概要描述3.5.0
detailsString错误的详细信息3.5.0
elaborationString保留字段,默认为null3.5.0
opaqueLinkedHashMap保留字段,默认为null3.5.0
causeErrorCode根错误,引发当前错误的源错误,若无原错误,该字段为null3.5.0

SDK示例

Java SDK

GetHostNetworkFactsAction action = new GetHostNetworkFactsAction();
action.hostUuid = "9397de8c860231c08b87031e226c691b";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetHostNetworkFactsAction.Result res = action.call();

Python SDK

GetHostNetworkFactsAction action = GetHostNetworkFactsAction()
action.hostUuid = "9397de8c860231c08b87031e226c691b"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetHostNetworkFactsAction.Result res = action.call()