[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 03/23 v2] Add support for <hostdev mode="capabilities">



On Mon, Dec 17, 2012 at 11:58:05AM -0500, Eric Blake wrote:
> > 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 redhat com>
> > ---
> >  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>
> > +...
> > +&lt;hostdev mode='capabilities' type='storage'&gt;
> > +  &lt;source&gt;
> > +    &lt;block&gt;/dev/sdf1&lt;/block&gt;
> > +  &lt;/source&gt;
> > +&lt;/hostdev&gt;
> > +...
> > +    </pre>
> > +
> > +    <pre>
> > +...
> > +&lt;hostdev mode='capabilities' type='misc'&gt;
> > +  &lt;source&gt;
> > +    &lt;char&gt;/dev/input/event3&lt;/char&gt;
> > +  &lt;/source&gt;
> > +&lt;/hostdev&gt;
> > +...
> > +    </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.

Indeed you are correct. Applying the following fixes

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index d8fe35d..8d9ab9e 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2250,7 +2250,7 @@
     </dl>
 
 
-    <h5><a href="elementsHostDevSubsys">Block / character devices</a></h5>
+    <h5><a href="elementsHostDevCaps">Block / character devices</a></h5>
 
     <p>
       Block / character devices from the host can be passed through
@@ -2282,7 +2282,7 @@
     <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 <code>mode</code> is
+        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>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 5e4f59b..0529d62 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2888,6 +2888,9 @@
       <group>
         <ref name="hostdevcapsstorage"/>
       </group>
+      <group>
+        <ref name="hostdevcapsmisc"/>
+      </group>
     </choice>
   </define>
 
diff --git a/tests/lxcxml2xmldata/lxc-hostdev.xml b/tests/lxcxml2xmldata/lxc-hostdev.xml
index d98efb8..02a87a7 100644
--- a/tests/lxcxml2xmldata/lxc-hostdev.xml
+++ b/tests/lxcxml2xmldata/lxc-hostdev.xml
@@ -25,7 +25,7 @@
         <block>/dev/sdf1</block>
       </source>
     </hostdev>
-    <hostdev mode='capabilities' type='char'>
+    <hostdev mode='capabilities' type='misc'>
       <source>
         <char>/dev/tty0</char>
       </source>


-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]