分布式交换机相关接口

更新交换机上行链路组

PUT/zstack/v1/l2-networks/virtual-switch/{uuid}/uplink-group

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateVirtualSwitchUplinkGroup": {
    "hostUuid": "922a7e4c781638ddb37d2098540530d8",
    "slaveNames": [
      "eth0"
    ],
    "type": "LinuxBonding"
  },
  "systemTags": [],
  "userTags": []
}

上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。

Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateVirtualSwitchUplinkGroup":{"hostUuid":"922a7e4c781638ddb37d2098540530d8","slaveNames":["eth0"],"type":"LinuxBonding"}}' \
http://localhost:8080/zstack/v1/l2-networks/virtual-switch/6614ce3ef02330cf8fcc734edd07da58/uplink-group

参数列表

名字

类型

位置

描述

可选值

起始版本

uuid

String

url

资源的UUID,唯一标示该资源

 

4.3.0

hostUuid

String

body(包含在updateVirtualSwitchUplinkGroup结构中)

主机UUID

 

4.3.0

slaveUuids (可选)

List

body(包含在updateVirtualSwitchUplinkGroup结构中)

slave网卡UUID列表

 

4.3.0

slaveNames (可选)

List

body(包含在updateVirtualSwitchUplinkGroup结构中)

slave网卡名称列表

 

4.3.0

type (可选)

String

body(包含在updateVirtualSwitchUplinkGroup结构中)

绑定类型

  • LinuxBonding
  • OvsBonding

4.3.0

systemTags (可选)

List

body

系统标签

 

4.3.0

userTags (可选)

List

body

用户标签

 

4.3.0

API返回

返回示例

{
  "inventory": {
    "interfaceName": "eth0",
    "type": "PhysicalInterface",
    "interfaceUuid": "5d98a3ee3da1373e87b5f559c43da1e7",
    "hostUuid": "ec5f7039252633748d29cb55ebcca73c",
    "l2NetworkUuid": "d3357c017b793f21b6ec9e36f6f163e5"
  }
}
名字类型描述起始版本
successboolean 4.3.0
inventoryUplinkGroupInventory详情参考inventory4.3.0
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error4.3.0

inventory

名字类型描述起始版本
interfaceNameString接口名称4.3.0
bondingUuidString绑定UUID4.3.0
interfaceUuidString接口UUID4.3.0
hostUuidString主机UUID4.3.0
l2NetworkUuidString分布式交换机UUID4.3.0
l2ProviderTypeString分布式交换机实现类型4.3.0
bridgeNameString网桥名称4.3.0
createDateTimestamp创建时间4.3.0
lastOpDateTimestamp最后一次修改时间4.3.0
typeUplinkGroupType详情参考type4.3.0

type

名字类型描述起始版本
PhysicalInterfaceUplinkGroupType物理网卡4.3.0
BondingUplinkGroupType绑定4.3.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

UpdateVirtualSwitchUplinkGroupAction action = new UpdateVirtualSwitchUplinkGroupAction();
action.uuid = "6614ce3ef02330cf8fcc734edd07da58";
action.hostUuid = "922a7e4c781638ddb37d2098540530d8";
action.slaveNames = asList("eth0");
action.type = "LinuxBonding";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVirtualSwitchUplinkGroupAction.Result res = action.call();

Python SDK

UpdateVirtualSwitchUplinkGroupAction action = UpdateVirtualSwitchUplinkGroupAction()
action.uuid = "6614ce3ef02330cf8fcc734edd07da58"
action.hostUuid = "922a7e4c781638ddb37d2098540530d8"
action.slaveNames = [eth0]
action.type = "LinuxBonding"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateVirtualSwitchUplinkGroupAction.Result res = action.call()