20.16.16. Channel
这代表了主机物理计算机与客户机虚拟机之间的专用通信通道,并通过使用管理工具更改 guest 虚拟机来操作,从而对域 xml 的以下部分所做的更改
图 20.63. Channel
...
<devices>
<channel type='unix'>
<source mode='bind' path='/tmp/guestfwd'/>
<target type='guestfwd' address='10.0.2.1' port='4600'/>
</channel>
<!-- KVM virtio channel -->
<channel type='pty'>
<target type='virtio' name='arbitrary.virtio.serial.port.name'/>
</channel>
<channel type='unix'>
<source mode='bind' path='/var/lib/libvirt/qemu/f16x86_64.agent'/>
<target type='virtio' name='org.qemu.guest_agent.0'/>
</channel>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
</channel>
</devices>
...
这可以以各种方式实施。
<目标> 元素的 type 属性中提供了特定类型的 <频道>。不同的频道类型有不同的目标属性,如下所示:
guestfwd- 诊断客户机虚拟机发送到给定 IP 地址和端口的 TCP 流量,将转发到主机物理机器上的通道设备。target元素必须具有地址和端口属性。virtio- 半虚拟化 virtio 频道。<频道>在/dev/vport*下的虚拟客户机中公开,如果指定了可选元素名称,/dev/virtio-ports/$name(如需更多信息,请参阅 http://fedoraproject.org/wiki/Features/VirtioSerial)。可选的元素地址可将频道绑定到特定的type='virtio-serial'控制器,如上面所述。使用 QEMU 时,如果名称为 "org.qemu.guest_agent.0",libvirt 可以与 guest 虚拟机安装的虚拟机代理交互,以获得 guest 虚拟机关闭或文件系统等操作。spicevmc- 半虚拟化 SPICE 频道.域还必须将 SPICE 服务器作为图形设备,在该设备指向主机物理机器 piggy-backs 信息。必须存在target元素,其中属性type='virtio';可选属性名称控制客户机虚拟机有权访问该通道的方式,默认为。可选的name='com.redhat.spice.0'<address>元素可将频道绑定到特定type='virtio-serial'控制器。