6.148. NetworkAttachment struct
描述主机如何连接到网络。
主机上网络附加的 XML 表示:
<network_attachment href="/ovirt-engine/api/hosts/123/nics/456/networkattachments/789" id="789">
<network href="/ovirt-engine/api/networks/234" id="234"/>
<host_nic href="/ovirt-engine/api/hosts/123/nics/123" id="123"/>
<in_sync>true</in_sync>
<ip_address_assignments>
<ip_address_assignment>
<assignment_method>static</assignment_method>
<ip>
<address>192.168.122.39</address>
<gateway>192.168.122.1</gateway>
<netmask>255.255.255.0</netmask>
<version>v4</version>
</ip>
</ip_address_assignment>
</ip_address_assignments>
<reported_configurations>
<reported_configuration>
<name>mtu</name>
<expected_value>1500</expected_value>
<actual_value>1500</actual_value>
<in_sync>true</in_sync>
</reported_configuration>
<reported_configuration>
<name>bridged</name>
<expected_value>true</expected_value>
<actual_value>true</actual_value>
<in_sync>true</in_sync>
</reported_configuration>
...
</reported_configurations>
</network_attachment>
将网络附加到网卡时,需要使用 id 或 name 的 network 元素。
例如,要将网络附加到主机网络接口卡,请发送如下请求:
POST /ovirt-engine/api/hosts/123/nics/456/networkattachments
使用请求正文,如下所示:
<networkattachment>
<network id="234"/>
</networkattachment>
要将 newtwork 附加到主机,请发送如下请求:
POST /ovirt-engine/api/hosts/123/networkattachments
使用请求正文,如下所示:
<network_attachment>
<network id="234"/>
<host_nic id="456"/>
</network_attachment>
ip_address_assignments 和 properties 元素是创建后的 updatable。
例如,要更新新tork 附加,请发送如下请求:
PUT /ovirt-engine/api/hosts/123/nics/456/networkattachments/789
使用请求正文,如下所示:
<network_attachment>
<ip_address_assignments>
<ip_address_assignment>
<assignment_method>static</assignment_method>
<ip>
<address>7.1.1.1</address>
<gateway>7.1.1.2</gateway>
<netmask>255.255.255.0</netmask>
<version>v4</version>
</ip>
</ip_address_assignment>
</ip_address_assignments>
</network_attachment>
要从网卡分离网络,请发送如下请求:
DELETE /ovirt-engine/api/hosts/123/nics/456/networkattachments/789
必须明确提交对网络附加配置的更改。
网络附加的 properties 子集合的 XML 表示:
<network_attachment>
<properties>
<property>
<name>bridge_opts</name>
<value>
forward_delay=1500 group_fwd_mask=0x0 multicast_snooping=1
</value>
</property>
</properties>
...
</network_attachment>
| 名称 | 类型 | 概述 |
|---|---|---|
|
| 自由包含此对象的注释的文本。 | |
|
| 以纯文本形式的人类可读描述。 | |
|
| 唯一标识符。 | |
|
| ||
|
| 网络的 IP 配置。 | |
|
| 以纯文本形式的人类可读名称。 | |
|
| 定义网络配置的自定义属性。 | |
|
| 配置属性的只读列表。 |
6.148.1. 属性 复制链接链接已复制到粘贴板!
定义网络配置的自定义属性。
网桥选项设置 bridge_opts 的名称。使用空格字符分隔多个条目。以下键对 bridge_opts 有效:
| 名称 | 默认值 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|