]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Drop restrictions on rng backend path
authorCole Robinson <crobinso@redhat.com>
Wed, 13 Apr 2016 19:09:30 +0000 (15:09 -0400)
committerCole Robinson <crobinso@redhat.com>
Wed, 4 May 2016 22:47:18 +0000 (18:47 -0400)
Currently we only allow /dev/random and /dev/hwrng as host input
for <rng><backend model='random'/> device. This was added after
various upstream discussions in commit 4932ef45

However this restriction has generated quite a few complaints over
the years, so a new discussion was initiated:

http://www.redhat.com/archives/libvir-list/2016-April/msg00987.html

Several people suggested removing the restriction, and nobody really
spoke up to defend it. So this patch drops the path restriction
entirely

https://bugzilla.redhat.com/show_bug.cgi?id=1074464
(cherry picked from commit 67f2b72723c242969c5282fcb9acf00cc01f2a54)

docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args
tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.xml
tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-random.xml

index 33b6105f96a2dbf7b60c76347a2ef551c4b9dd46..53ae840da790c896f677d86cee31a7946e3f79ff 100644 (file)
@@ -6116,31 +6116,28 @@ qemu-kvm -net nic,model=? /dev/null
           to be used for the domain. The source model is configured using the
           <code>model</code> attribute. Supported source models are:
         </p>
-        <ul>
-          <li>'random' &mdash; /dev/random (default) or /dev/hwrng
-            device as source (for now, no other sources are permitted)</li>
-          <li>'egd' &mdash; a EGD protocol backend</li>
-        </ul>
-      </dd>
-      <dt><code>backend model='random'</code></dt>
-      <dd>
-        <p>
-          This backend type expects a non-blocking character device as input.
-          The only accepted paths are /dev/random and /dev/hwrng. The file
-          name is specified as contents of the <code>backend</code> element.
-          When no file name is specified the hypervisor default is used.
-        </p>
-      </dd>
-      <dt><code>backend model='egd'</code></dt>
-      <dd>
-        <p>
-          This backend connects to a source using the EGD protocol.
-          The source is specified as a character device. Refer to
-          <a href='#elementsCharHostInterface'>character device host interface</a>
-          for more information.
-        </p>
+        <dl>
+          <dt><code>random</code></dt>
+          <dd>
+            <p>
+              This backend type expects a non-blocking character device as
+              input. The file name is specified as contents of the
+              <code>backend</code> element. When no file name is specified
+              the hypervisor default is used. For qemu, the default is
+              /dev/random
+            </p>
+          </dd>
+          <dt><code>egd</code></dt>
+          <dd>
+            <p>
+              This backend connects to a source using the EGD protocol.
+              The source is specified as a character device. Refer to
+              <a href='#elementsCharHostInterface'>character device host interface</a>
+              for more information.
+            </p>
+          </dd>
+        </dl>
       </dd>
-
     </dl>
 
     <h4><a name="elementsTpm">TPM device</a></h4>
index 54c149dd52906d645549ea6ab09fb7ce3ccf9689..6ae30440ade169629f4db11f3e916483a5ff5b69 100644 (file)
             <value>random</value>
           </attribute>
           <choice>
-            <value>/dev/random</value>
-            <value>/dev/hwrng</value>
+            <ref name='absFilePath'/>
             <empty/>
           </choice>
         </group>
index 836e2864b5db2976be962a5f8ec8cea05e27ae15..2b16e9b46df5bc0f44d4daf292b08420228aded8 100644 (file)
@@ -11463,14 +11463,6 @@ virDomainRNGDefParseXML(xmlNodePtr node,
     switch ((virDomainRNGBackend) def->backend) {
     case VIR_DOMAIN_RNG_BACKEND_RANDOM:
         def->source.file = virXPathString("string(./backend)", ctxt);
-        if (def->source.file &&
-            STRNEQ(def->source.file, "/dev/random") &&
-            STRNEQ(def->source.file, "/dev/hwrng")) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           _("file '%s' is not a supported random source"),
-                           def->source.file);
-            goto error;
-        }
         break;
 
     case VIR_DOMAIN_RNG_BACKEND_EGD:
index ba97c1e8ee5a80eb765ac41f66d7f529dc811083..5a4d47be975c3f463bd5676b63ce3748dc56ca60 100644 (file)
@@ -18,6 +18,6 @@ QEMU_AUDIO_DRV=none \
 -boot c \
 -usb \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
--object rng-random,id=objrng0,filename=/dev/hwrng \
+-object rng-random,id=objrng0,filename=/dev/urandom \
 -device virtio-rng-pci,rng=objrng0,id=rng0,max-bytes=123,period=1234,bus=pci.0,\
 addr=0x4
index 71bd21a65c66c8d9dfacddce392a3b418480d736..a6e91fff3e586d98f37f72d5196885b6d3acaa55 100644 (file)
@@ -21,7 +21,7 @@
     <memballoon model='virtio'/>
     <rng model='virtio'>
       <rate bytes='123' period='1234'/>
-      <backend model='random'>/dev/hwrng</backend>
+      <backend model='random'>/dev/urandom</backend>
     </rng>
   </devices>
 </domain>
index e8a047866b544d40bcaa5d0ef9bb3e4d62b8bf4d..0bdefdef4436a370bf1fe40be8a9e3281fec6262 100644 (file)
@@ -25,7 +25,7 @@
     </memballoon>
     <rng model='virtio'>
       <rate bytes='123' period='1234'/>
-      <backend model='random'>/dev/hwrng</backend>
+      <backend model='random'>/dev/urandom</backend>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </rng>
   </devices>