mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Add support for <hostdev mode="capabilities">
The <hostdev> device type has long had a redundant "mode"
attribute, which has always been "subsys". This finally
introduces a new mode "capabilities", which will be used
by the LXC driver for device assignment. Since container
based virtualization uses a single kernel, the idea of
assigning physical PCI devices doesn't make sense. It is
still reasonable to assign USB devices, but for assigning
arbitrary nodes in /dev, the new 'capabilities' mode is
to be used.
The first capability support is 'storage', which is for
assignment of block devices. Functionally this is really
pretty similar to the <disk> support. The only difference
is the device node name is identical in both host and
container namespaces.
<hostdev mode='capabilities' type='storage'>
<source>
<block>/dev/sdf1</block>
</source>
</hostdev>
The second capability support is 'misc', which is for
assignment of character devices. There is no existing
parallel to this. Again the device node is the same
inside & outside the container.
<hostdev mode='capabilities' type='misc'>
<source>
<char>/dev/input/event3</char>
</source>
</hostdev>
The reason for keeping the char & storage devices
separate in the domain XML, is to mirror the split
in the node device XML. NB the node device XML does
not yet report character devices, but that's another
new patch to come
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
@@ -2123,13 +2123,15 @@
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4><a name="elementsUSB">USB and PCI devices</a></h4>
|
||||
<h4><a name="elementsHostDev">Host device assignment</a></h4>
|
||||
|
||||
<h5><a href="elementsHostDevSubsys">USB / PCI devices</a></h5>
|
||||
|
||||
<p>
|
||||
USB and PCI devices attached to the host can be passed through
|
||||
to the guest using
|
||||
the <code>hostdev</code> element. <span class="since">since after
|
||||
0.4.4 for USB and 0.6.0 for PCI (KVM only)</span>:
|
||||
to the guest using the <code>hostdev</code> element.
|
||||
<span class="since">since after 0.4.4 for USB and 0.6.0 for PCI
|
||||
(KVM only)</span>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
@@ -2247,6 +2249,51 @@
|
||||
more details on the address element.
|
||||
</dl>
|
||||
|
||||
|
||||
<h5><a href="elementsHostDevCaps">Block / character devices</a></h5>
|
||||
|
||||
<p>
|
||||
Block / character devices from the host can be passed through
|
||||
to the guest using the <code>hostdev</code> element. This is
|
||||
only possible with container based virtualization.
|
||||
<span class="since">since after 1.0.1 for LXC</span>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<hostdev mode='capabilities' type='storage'>
|
||||
<source>
|
||||
<block>/dev/sdf1</block>
|
||||
</source>
|
||||
</hostdev>
|
||||
...
|
||||
</pre>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<hostdev mode='capabilities' type='misc'>
|
||||
<source>
|
||||
<char>/dev/input/event3</char>
|
||||
</source>
|
||||
</hostdev>
|
||||
...
|
||||
</pre>
|
||||
|
||||
<dl>
|
||||
<dt><code>hostdev</code></dt>
|
||||
<dd>The <code>hostdev</code> element is the main container for describing
|
||||
host devices. For block/character device passthrough <code>mode</code> is
|
||||
always "capabilities" and <code>type</code> is "block" for a block
|
||||
device and "char" for a character device.
|
||||
</dd>
|
||||
<dt><code>source</code></dt>
|
||||
<dd>The source element describes the device as seen from the host.
|
||||
For block devices, the path to the block device in the host
|
||||
OS is provided in the nested "block" element, while for character
|
||||
devices the "char" element is used
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4><a name="elementsRedir">Redirected devices</a></h4>
|
||||
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user