[PATCH 1/7] conf: domcaps: Report device <rng>

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

 



This adds device <rng> reporting. Example output:

    <rng supported='yes'>
      <enum name='model'>
        <value>virtio</value>
        <value>virtio-transitional</value>
        <value>virtio-non-transitional</value>
      </enum>
      <enum name='backendModel'>
        <value>random</value>
        <value>egd</value>
      </enum>
     </rng>

Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 docs/formatdomaincaps.html.in  | 35 ++++++++++++++++++++++++++++++++++
 docs/schemas/domaincaps.rng    | 10 ++++++++++
 src/conf/domain_capabilities.c | 14 ++++++++++++++
 src/conf/domain_capabilities.h |  9 +++++++++
 4 files changed, 68 insertions(+)

diff --git a/docs/formatdomaincaps.html.in b/docs/formatdomaincaps.html.in
index 2583f9bead..22ddab4301 100644
--- a/docs/formatdomaincaps.html.in
+++ b/docs/formatdomaincaps.html.in
@@ -427,6 +427,41 @@
       element.</dd>
     </dl>
 
+
+    <h4><a id="elementsRNG">RNG device</a></h4>
+    <p>RNG device capabilities are exposed under the
+    <code>rng</code> element. For instance:</p>
+
+<pre>
+&lt;domainCapabilities&gt;
+  ...
+  &lt;devices&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
+    ...
+  &lt;/devices&gt;
+&lt;/domainCapabilities&gt;
+</pre>
+
+    <dl>
+      <dt><code>model</code></dt>
+      <dd>Options for the <code>model</code> attribute of the
+      &lt;rng&gt; element.</dd>
+      <dt><code>backendModel</code></dt>
+      <dd>Options for the <code>model</code> attribute of the
+      &lt;rng&gt;&lt;backend&gt; element.</dd>
+    </dl>
+
+
     <h3><a id="elementsFeatures">Features</a></h3>
 
     <p>One more set of XML elements describe the supported features and
diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng
index 3c42cb8075..d1b4d930d9 100644
--- a/docs/schemas/domaincaps.rng
+++ b/docs/schemas/domaincaps.rng
@@ -154,6 +154,9 @@
       <optional>
         <ref name='hostdev'/>
       </optional>
+      <optional>
+        <ref name='rng'/>
+      </optional>
     </element>
   </define>
 
@@ -185,6 +188,13 @@
     </element>
   </define>
 
+  <define name='rng'>
+    <element name='rng'>
+      <ref name='supported'/>
+      <ref name='enum'/>
+    </element>
+  </define>
+
   <define name='features'>
     <element name='features'>
       <optional>
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 5a8f48da61..03757ba8cd 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -543,6 +543,19 @@ virDomainCapsDeviceHostdevFormat(virBufferPtr buf,
 }
 
 
+static void
+virDomainCapsDeviceRNGFormat(virBufferPtr buf,
+                             virDomainCapsDeviceRNGPtr const rng)
+{
+    FORMAT_PROLOGUE(rng);
+
+    ENUM_PROCESS(rng, model, virDomainRNGModelTypeToString);
+    ENUM_PROCESS(rng, backendModel, virDomainRNGBackendTypeToString);
+
+    FORMAT_EPILOGUE(rng);
+}
+
+
 /**
  * virDomainCapsFeatureGICFormat:
  * @buf: target buffer
@@ -621,6 +634,7 @@ virDomainCapsFormat(virDomainCapsPtr const caps)
     virDomainCapsDeviceGraphicsFormat(&buf, &caps->graphics);
     virDomainCapsDeviceVideoFormat(&buf, &caps->video);
     virDomainCapsDeviceHostdevFormat(&buf, &caps->hostdev);
+    virDomainCapsDeviceRNGFormat(&buf, &caps->rng);
 
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</devices>\n");
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index 26f4b8c394..052191d284 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -96,6 +96,14 @@ struct _virDomainCapsDeviceHostdev {
     /* add new fields here */
 };
 
+typedef struct _virDomainCapsDeviceRNG virDomainCapsDeviceRNG;
+typedef virDomainCapsDeviceRNG *virDomainCapsDeviceRNGPtr;
+struct _virDomainCapsDeviceRNG {
+    virTristateBool supported;
+    virDomainCapsEnum model;   /* virDomainRNGModel */
+    virDomainCapsEnum backendModel;   /* virDomainRNGBackend */
+};
+
 typedef struct _virDomainCapsFeatureGIC virDomainCapsFeatureGIC;
 typedef virDomainCapsFeatureGIC *virDomainCapsFeatureGICPtr;
 struct _virDomainCapsFeatureGIC {
@@ -165,6 +173,7 @@ struct _virDomainCaps {
     virDomainCapsDeviceGraphics graphics;
     virDomainCapsDeviceVideo video;
     virDomainCapsDeviceHostdev hostdev;
+    virDomainCapsDeviceRNG rng;
     /* add new domain devices here */
 
     virDomainCapsFeatureGIC gic;
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux