14.7.2. 主机网络接口子检测
14.7.2.1. 主机网络接口子检测 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
nics 子集合代表主机的物理网络接口。可以使用 All-Content: true 标头检索 GET 请求的其他信息。表示法中的每个 host_nic 元素都充当网络接口,包含以下元素:
| 元素 | 类型 | Description | Properties |
|---|---|---|---|
name | 字符串 | 主机网络接口的名称,如 eth0。 |
[a]
|
link rel="statistics" | 关系 | 到主机网络接口 统计的统计信息 子集合的链接。 |
|
link rel="labels" | 关系 | 到主机网络接口 标签的标签 子集合的链接。 | |
link rel="networkattachments" | 关系 | 到主机网络接口配置的 networkattachments 子集合的链接。 | |
link rel="master" | 关系 | 如果这是从接口,则对主绑定接口的引用。 |
|
host id= | GUID | 对主机的引用。 |
|
network id= | GUID | 对网络的引用(如果有的话),该接口被附加。 |
[b] |
mac address= | 字符串 | 接口的 MAC 地址。 |
|
ip address= netmask= gateway= mtu= | complex | 接口的 IP 级别配置。 | |
mtu | complex | 接口的最大传输单元。 | |
boot_protocol | Enumerated | 主机引导时 IP 地址分配的协议。枚举的值列表包括在 能力 中。 | |
status | Enumerated | 网络接口的链接状态。这些状态列在 capabilities 下的 host_nic_states 中。 |
|
VLAN ID | 整数 | 此接口代表的 VLAN。 |
|
绑定 | complex | 绑定接口 的选项 和从属 NIC 列表。 |
[c]
|
bridged | 布尔值 | 定义网桥网络状态。对于网桥网络,设置为 true;对于无网桥网络,设置为 false。 | |
[a]
仅在添加绑定接口时需要。其他接口是只读的,无法添加。
[b]
仅在添加绑定接口时需要。其他接口是只读的,无法添加。
[c]
仅在添加绑定接口时需要。其他接口是只读的,无法添加。
| |||
例 14.13. 主机上网络接口的 XML 表示
<host_nic id="00000000-0000-0000-0000-000000000000"
href="/ovirt-engine/api/hosts/00000000-0000-0000-0000-000000000000/nics/
00000000-0000-0000-0000-000000000000">
<actions>
<link rel="attach"
href="/ovirt-engine/api/hosts/00000000-0000-0000-0000-000000000000/nics/
00000000-0000-0000-0000-000000000000/attach"/>
<link rel="detach"
href="/ovirt-engine/api/hosts/00000000-0000-0000-0000-000000000000/nics/
00000000-0000-0000-0000-000000000000/detach"/>
</actions>
<name>bond0</name>
<link href="/ovirt-engine/api/hosts/00000000-0000-0000-0000-000000000000/nics/00000000-0000-0000-0000-000000000000/statistics" rel="statistics"/>
<link href="/ovirt-engine/api/hosts/00000000-0000-0000-0000-000000000000/nics/00000000-0000-0000-0000-000000000000/labels" rel="labels"/>
<link href="/ovirt-engine/api/hosts/00000000-0000-0000-0000-000000000000/nics/00000000-0000-0000-0000-000000000000/networkattachments" rel="networkattachments"/>
<host href="/ovirt-engine/api/hosts/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/>
<network href="/ovirt-engine/api/networks/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/>
<mac address="00:00:00:00:00:00"/>
<ip address="XX.XX.XX.XX" netmask="255.255.255.0" gateway="XX.XX.XX.XX"/>
<boot_protocol>dhcp</boot_protocol>
<status>
<state>up</state>
</status>
<bonding>
<options>
<option name="mode" value="4" type="Dynamic link aggregation (802.3ad)"/>
<option name="miimon" value="100"/>
</options>
<slaves>
<host_nic id="00000000-0000-0000-0000-000000000000"/>
<host_nic id="00000000-0000-0000-0000-000000000000"/>
</slaves>
</bonding>
<mtu>1500</mtu>
<bridged>true</bridged>
<custom_configuration>false</custom_configuration>
</host_nic>
使用
PUT 请求修改网络接口。
PUT /ovirt-engine/api/hosts/00000000-0000-0000-0000-000000000000/nics/
00000000-0000-0000-0000-000000000000 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<host_nic>
<ip address="XX.XX.XX.XX" netmask="255.255.255.0" gateway="XX.XX.XX.XX"/>
<boot_protocol>static</boot_protocol>
</host_nic>
删除具有
DELETE 请求的网络接口。
DELETE /ovirt-engine/api/hosts/00000000-0000-0000-0000-000000000000/nics/
00000000-0000-0000-0000-000000000000 HTTP/1.1
HTTP/1.1 204 No Content


