20.16.6.2. Block / character devices


The host physical machine's block / character devices can be passed through to the guest virtual machine by using management tools to modify the domain xml hostdev element. Note that this is only possible with container based virtualization.

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

Figure 20.30. Devices - host physical machine device assignment block character devices

An alternative approach is this:

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

Figure 20.31. Devices - host physical machine device assignment block character devices alternative 1

Another alternative approach is this:

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

Figure 20.32. Devices - host physical machine device assignment block character devices alternative 2

The components of this section of the domain XML are as follows:
Table 20.14. Block / character device elements
ParameterDescription
hostdevThis is the main container for describing host physical machine devices. For block/character devices passthrough mode is always capabilities and type is block for a block device and char for a character device.
sourceThis describes the device as seen from the host physical machine. For block devices, the path to the block device in the host physical machine OS is provided in the nested block element, while for character devices the char element is used
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.