> 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. > > > Changes since v1: > > - Add missing docs > - Add missing schema change Yep, that was what I complained about in v1. > > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> > --- > docs/formatdomain.html.in | 55 ++++++++++- > docs/schemas/domaincommon.rng | 139 > +++++++++++++++++++--------- > src/conf/domain_audit.c | 92 ++++++++++++++----- > src/conf/domain_conf.c | 173 > ++++++++++++++++++++++++++++++++++- > src/conf/domain_conf.h | 31 +++++-- > src/libvirt_private.syms | 1 + > tests/lxcxml2xmldata/lxc-hostdev.xml | 34 +++++++ > tests/lxcxml2xmltest.c | 1 + > 8 files changed, 448 insertions(+), 78 deletions(-) > create mode 100644 tests/lxcxml2xmldata/lxc-hostdev.xml > > diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in > index 292e032..d8fe35d 100644 > --- a/docs/formatdomain.html.in > +++ b/docs/formatdomain.html.in > @@ -2123,13 +2123,15 @@ > </dd> > </dl> > > - <h4><a name="elementsUSB">USB and PCI devices</a></h4> You are deleting an anchor name; this will invalidate any URLs that were previously pointing to that name. Not necessarily the end of the world; such URLs will still be to the right page, just wrong area of the page. > + <h4><a name="elementsHostDev">Host device assignment</a></h4> > + > + <h5><a href="elementsHostDevSubsys">USB / PCI devices</a></h5> > @@ -2247,6 +2249,51 @@ > more details on the address element. > </dl> > > + > + <h5><a href="elementsHostDevSubsys">Block / character > devices</a></h5> Oops, you used the anchor name #elementsHostDevSubsys twice. How did that validate? I think you want this anchor to be #elementsHostDevCapabilities > + > + <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/characgter device passthrough s/characgter/character/ > <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> > diff --git a/docs/schemas/domaincommon.rng > b/docs/schemas/domaincommon.rng > index cdc5115..5e4f59b 100644 > --- a/docs/schemas/domaincommon.rng > +++ b/docs/schemas/domaincommon.rng > @@ -2834,63 +2834,120 @@ > </zeroOrMore> > </element> > </define> > + > <define name="hostdev"> > <element name="hostdev"> > + <choice> > + <group> > + <ref name="hostdevsubsys"/> > + </group> > + <group> > + <ref name="hostdevcaps"/> > + </group> > + </choice> > <optional> > + <define name="hostdevcaps"> > + <attribute name="mode"> > + <value>capabilities</value> > + </attribute> > + <choice> > + <group> > + <ref name="hostdevcapsstorage"/> > + </group> > + </choice> No choice for hostdevcapsmisc yet... > + > + <define name="hostdevcapsmisc"> > + <attribute name="type"> > + <value>misc</value> > + </attribute> > + <element name="source"> > + <element name="char"> > + <ref name="absFilePath"/> > + </element> > + </element> > + </define> ...which makes this <define> unused. I don't know if that was intentional, or just an accidental omission, but trust that you'll get it sorted out before the end of the series. > +++ b/tests/lxcxml2xmldata/lxc-hostdev.xml > @@ -0,0 +1,34 @@ > + <hostdev mode='capabilities' type='storage'> > + <source> > + <block>/dev/sdf1</block> > + </source> > + </hostdev> > + <hostdev mode='capabilities' type='char'> How did this validate? Shouldn't it be type='misc'? ACK with those issues fixed. -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list