Red Hat Training

A Red Hat training course is available for Red Hat Virtualization

14.8.3. 主机网络设置操作

在主机上配置多个网络设置。setupnetworks 操作可用于复杂的网络配置,如将网络从一个网络接口移动到另一个网络接口。

例 14.30. 编辑主机网络配置的操作

POST /ovirt-engine/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/setupnetworks HTTP/1.1
Accept: application/xml
Content-type: application/xml

<action>
    <modified_network_attachments>
        <network_attachment id="41561e1c-c653-4b45-b9c9-126630e8e3b9">
            <host_nic id="857a46d3-5f64-68bd-f456-c70de5b2d569"/>
        </network_attachment<
        <network_attachment id="3c3f442f-948b-4cdc-9a48-89bb0593cfbd">
            <network id="00000000-0000-0000-0000-000000000010"/>
            <ip address="10.35.1.247" netmask="255.255.254.0" gateway="10.35.1.254"/>
	    <properties>
		<property>
		    <name>bridge_opts</name>
		    <value>
			forward_delay=1500 group_fwd_mask=0x0 multicast_snooping=1
		    </value>
		</property>
	    </properties>
        </network_attachment>
    </modified_network_attachments>
    <synchronized_network_attachments>
        <network_attachment id="3c3f442f-948b-4cdc-9a48-89bb0593cfbd">
    </synchronized_network_attachments> 
    <removed_network_attachments>
        <network_attachment id="7f456dae-c57f-35d5-55a4-20b74dc53af9">
    </removed_network_attachments>
    <modified_bonds>
        <host_nic id="a56b212d-2bc4-4120-9136-53be6cacb39a">
	    <bonding>
		<slaves>
		    <host_nic id="75ac21f7-4aa3-405a-a022-341e5f525b85">
		    <host_nic id="f3dda04c-1233-41af-a111-74327b876487">
		</slaves>
	    </bonding>
        </host_nic>
    </modified_bonds>
    <removed_bonds>
        <host_nic id="36ab5c7f-647a-bc64-f5e7-ba5d74f8e4ba">
    </removed_bonds>
    <modified_labels>
        <label id="Label002">
	    <host_nic id="857a46d3-5f64-68bd-f456-c70de5b2d569"/>
        </label>
        <label>
	    <host_nic id="a56b212d-2bc4-4120-9136-53be6cacb39a"/>
	    <label id="Label003/>
        </label>
    </modified_labels>  
    <removed_labels>
        <label id="Label001">
    </removed_labels>
    <checkConnectivity>true</checkConnectivity>
    <connectivityTimeout>60</connectivityTimeout>
</action>
此操作使用标准 NIC 元素更新所有指定的主机网络资源。请求包括下表中指定的其他元素。

表 14.14. 多个主机网络接口设置的元素

元素 类型 Description
modified_bonds complex 创建或更新绑定。每个 host_nic 元素都包含标准 绑定 元素。请参阅 第 14.7.2.2 节 “绑定接口”
removed_bonds complex 要删除的绑定的 ID 列表。
modified_network_attachments complex 在主机上添加或更新网络附加。每个 network_attachment 元素都包含标准主机 network_attachment 元素。请参阅 第 14.7.1 节 “Host Network Attachments Sub-Collection”。更改 host_nic ID 将网络移动到不同的网络接口卡。
synchronized_network_attachments complex 与数据中心的逻辑网络定义同步的非同步网络附加定义的 ID 列表。
removed_network_attachments complex 要删除的网络附加的 ID 列表。
modified_labels complex 创建或修改标签。每个 标签 元素包含一个 标签 id (创建标签时),以及通过名称或 ID 标识的 host_nic。更改 host_nic ID 将标签移到不同的网卡中。
removed_labels complex 要删除的标签的 ID 列表。
checkConnectivity 布尔值 设置为 true 以验证主机和 Red Hat Virtualization Manager 之间的连接。如果连接丢失,Red Hat Virtualization Manager 会恢复设置。
connectivityTimeout 整数 定义连接丢失的超时。