Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

20.16.6.2. 块/字符设备

主机物理机器的块设备可使用管理工具传递给 guest 虚拟机,以修改域 xml hostdev 元素。请注意,这只适用于基于容器的虚拟化。

图 20.30. 设备 - 主机物理机器设备分配块设备


...
<hostdev mode='capabilities' type='storage'>
  <source>
    <block>/dev/sdf1</block>
  </source>
</hostdev>
...

另一种方法是:

图 20.31. 设备 - 主机物理机器设备分配块设备替代 1


...
<hostdev mode='capabilities' type='misc'>
  <source>
    <char>/dev/input/event3</char>
  </source>
</hostdev>
...

另一种替代方法是:

图 20.32. 设备 - 主机物理机器设备分配块设备替代 2


...
<hostdev mode='capabilities' type='net'>
  <source>
    <interface>eth0</interface>
  </source>
</hostdev>
...


域 XML 中本节的组件如下:

表 20.14. 块/字符设备元素

参数描述
hostdev这是描述主机物理机器设备的主要容器。对于块/字符设备透传 模式,其类型始终为块设备和 字符设备 的收费。
source这描述了在主机物理机器中看到的设备。对于块设备,主机物理机器 OS 中的块设备路径在嵌套 元素中提供,而对于使用 char 元素的字符设备